We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I'm using the STM32F105 and unfortunately I have a problem regarding to the serial wire debugging.
Abstract: In my application I have to use both, SPI2 and SPI3 simultaneously. In order to use SPI3 without remapping I want to disable the JTAG Port as discribed in chapter 29.4.4 in the RM0008 to free PB3. That means I just want to use PA13 and PA14 (Serial Wire) for debugging purposes. Therefore I added the following lines at the beginning of my source code (just after main()):
RCC->APB2ENR |= (1 << 2)|(1 << 0)|(1 << 3); /* Enable PortA, PortB, Enable AFIO */ AFIO->MAPR &= 0xF8FFFFFF; /* reset SWJ_CFG */ AFIO->MAPR |= 0x02000000; /* enable sw, disable jtag */
In addition I disabled the Trace function in the debug section of the ULINK2, disabled the SWJ and enabled the usage of SW.
Problem:
I'm able to program the target. Then the function of SPI2 and SPI3 is correct. BUT if I enter the debugger suddenly SPI3 stops working. The clock output of SPI3 (PB3) which is usually used for tracing doesn't output a clock signal any more. The rest of the application works fine besides SPI3.
When I want to reprogram or reset the target, the problem still remains. Even if I leave the debugger. This happens until I remove VDD from the target.
When VDD was removed I'm able to reprogram the target. Then the application runs with the correct function. But when I enter the debug mode again the problem appears again.
I hope anybody can help me
Thanking you in anticipation Best regards
Thomas