Hello, I'm having similar issue, it seems that after some programmations when using that pins as GPIO, the controller gets locked, or BDM cannot communicate with controller.
After entering in this conditions, the controller gets OK again after:
1) power off the controller
2) Unplug BDM
3) Power on controller
4) Wait for pins to go back to SWD mode
5) Plug again BDM
At this point it go back work.
We use those pins in this way:
1) Reset bit SIM_SOPT_SWDE_MASK in SIM_SOPT
2) Configure GPIOx_PDDR, PORT_PUEL, GPIOA_PSOR, GPIOA_PCOR, GPIOA_PIDR
3) Do some stuff
4) Set to back configurations for GPIOx registers
5) Set bit SIM_SOPT_SWDE_MASK in SIM_SOPT
And it happens that the next programmation doesnt work, until I do the operations I listed above.
Is there some news in this discussion that can help me?
Thanks in advance,
Sandro