2015-01-12 01:52 AM
Hello,
i'm using an STM32F407ZET6 with SPI1, SPI2, SP3 and SWD. SPI1 and SPI2 are always working fine. SPI3 works when the CPU is running without debugging. Whenever I set a breakpoint SPI3 Clock (PortB3) has strange pulses. I checked how to disable JTAG on STM32F4 in RM0090. It shoud be done automatically when Changing the Pin Configuration: ... GIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; ... And changing the Alternate Function mapping: GPIO_PinAFConfig(SCK->GetPort(), SCK->GetPinSource(), GPIO_AF_SPI3); Both is done in my code and as SPI3 is working (logic analizer and SPI-Chip is responding) as long as I break debugging via breakpoint or halt. However when I set a breakpoint SPI3 fails as SCK outputs something. I can also see that AFRL3 is always changed back to 0 and OSPEEDR3 is always changed back to 3. Can anybody give me advice how to solve this issue?2015-01-12 02:11 AM
PB3 is SWO, so maybe your toolchain is trying to switch on the serial-wire-output. Read the manual to your toolchain, or browse through its settings.
JW2015-01-12 04:06 AM
Hello Jan,
I guess you think the toolchain (IAR EWARM) is reactivating JTAG, again? The Datasheet for the STM32F407XX DM00037051 says: PA13 AF0: JTMS/SWDIO PA14 AF0: JTCK/SWCLK PA15 AF0: JTDI PB3 AF0: JTDO/TRACES -> would be JTAG output PB4 AF0: NJTRST I tried SEGGER J-Link and IAR I-Jet, both are configured for SWD as interface. On the microcontroller only SWDIO, SWCKL, /RESET, VCC and GND are connected to the debugging probe. So normally when the toolchain reactivates JTAG it shouldn't be able to debug as the JTAG-Pins are not connected to the probe. However, I asked IAR, if they know an issue depending on EWARM and STM32 with SPI and SWD-debugging. Thank you, Martin2015-01-12 04:11 AM
And this is with what JTAG pod and debugger/toolchain?
Check the errata, seem to recall a problem with the JTAG/SWD pins and reducing utilization. Does the SPI device have a Chip Select?2015-01-12 04:15 AM
> I guess you think the toolchain (IAR EWARM) is reactivating JTAG, again?
No. SWO is an optional auxilliary debug/trace/whatever-you-call-it output in the SWD mode. I don't IAR, but maybe this video might help you https://www.youtube.com/watch?feature=player_detailpage&v=pusvyW-pbsU#t=71 JW2015-01-12 05:33 AM
Hello,
I tried the following debug probes: SEGGER J-Link PLUS IAR I-Jet with the IAR Embedded Workbench for ARM V7.30.4 I thought I didn't find anything related to SWD in DM00037591, but I'll double check this. The SPI-Chip has a chip-select pin, but I'm using this controlled by Software.SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; ...From: clive1
Posted: Monday, January 12, 2015 1:11 PMSubject: STM32F407ZGT, SPI3 and Debugging with SWDAnd this is with what JTAG pod and debugger/toolchain?
Check the errata, seem to recall a problem with the JTAG/SWD pins and reducing utilization. Does the SPI device have a Chip Select?2015-01-14 11:40 PM
Hello Jan,
the attached movie didn't help, this is just how to activate the route to IAR. But on IAR i-Jet there was an extra Feature -> Project-Properties -> Debugger -> I-Jet/JTAGjet -> Trace Trace data collection Mode: None The J-Link does not have this Feature. I tried connecting to J-Link via GDB Server and after that, SWO is no longer reactivated. So I guess it's again an IAR related problem. IAR still didn't answer yet (not a good sign with a valid service and update license agreement for 820 EUR / year) Thank you for your help2015-01-19 11:04 PM
Hello,
IAR EWARM 7.30 does not support activating or deactivating SWO when using a J-Link. All settings related to SWO don't touch J-Links SWO Interface configuration. You have to run J-Link.exe manually and use the commands ''SWOStart'' and ''SWOStop''