Do ARM Jtag pins need configuring?

I'm debugging an issue on an STM32G431 (32bit M4 core) where when I start a motor the debugger crashes. By crashing I mean all windows turn to garbage and I no longer have debugger control of the MCU. Before I start the motor the JTAG runs fine and displays and updates windows as I would expect.

My question is do the five JTAG lines need any special configuring? I read in ref manual that after reset they come up in a mode to operate as JTAG pins so I am not doing anything with them in the code. Also, I do not have any external pull-ups or pull downs, as the reference manual says this is done in the MCU.

Do these pins need to be 'locked' so that other code cannot accidently change the configuration or write to them?

I am using Keil MDK5 latest version and the Segger J-Link EDU with latest drivers.

Thanks for your help,