2016-04-28 4:24 PM
STM32 programming interface doubts
Hello all.I'm new to ST microcontrollers (STM32 in this case) and JTAG interface. I'm doing the schematic of a project where one of these microcontrollers will be used:- STM32F401RCT6, STM32F373CCT6 or STM32F091CCT6-> For the 2 first part numbers, I noticed that:TMS = pin PA13TCK = pin PA14TDO = pin PB3TDI = pin PA15 nRST = pin 7-> For the 3rd part number, I noticed that:TMS = pin PA13 (SWDIO)TCK = pin PA14 (SWCLK)TDO = ???TDI = ??? nRST = pin 7-> TRST signal is on PB4 for the 2 first part numbers. For the 3rd part number, I didn't found.-> My doubts are:(1) Is TMS always on pin PA13, TCK always on pin PA14, TDO always on pin PB3 and TDI always on pin PA15 for STM32 family?(2) Can I obtain the minimum JTAG programming interface by using TMS, TCK, TDO, TDI and nRST? (5 pins), plus GND and VDD?(3) Are TDO/TDI signals of programmer directly connected TDO/TDI signals (respectively) of STM32 MCU? Or do I need to cross the signals? For example, connecting TDO of programmer to TDI of STM32 MCU and TDI of programmer to TDO of STM32 MCU?(4) Is the TRST signal required for programming? Or do I need just the nRST of programmer connected to nRST pin of STM32 MCU?I'm planning to use the ST-LINK/V2 programmmer, together with a 20-to-10 pin adapter board/cable:ST-LINK/V2 programmmer:http://www2.st.com/content/ccc/resource/technical/document/user_manual/65/e0/44/72/9e/34/41/8d/DM00026748.pdf/files/DM00026748.pdf/jcr:content/translations/en.DM00026748.pdf20-to-10 pin JTAG adapter:https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/resources/ARM-JTAG-20-10-schematic.pdfAs seen in the 10 pin connector, the TRST signal isn't used, only VDD, GND, TMS, TCK, TDO, TDI, nRST...Regards in advance. #jtag2016-04-28 7:19 PM
The Cortex-M0 parts (F0, L0, etc) do not support JTAG, only SWD
These parts can all be programmed using SWDIO, SWCLK, NRST and GND, for the non-M0 parts PB3 (SWO) can be use for trace and debug channel (SWV Serial Wire Viewer). Unless you have other JTAG parts in your design, or are doing board level boundary scan, wouldn't SWD suffice?2016-04-28 7:28 PM
For our F2/F4 designs (144-pin) we use the cited Olimex adapter, and a fully populated 10-pin connector. I don't have the schematics to hand, but I can debug via SWD or JTAG.
We recommend/supply ST-LINKs based on their cost, I personally prefer J-Link and U-Link pods, and the boundary scan stuff is done with proprietary tools.2016-04-28 8:01 PM
(Perhaps a little of topic but...)
I have sometimes seen posts such as this one (at least the first part about the pins on various devices) and I must admit that I cannot understand why such questions arise.In my experience every device has a different set of characteristics (peripherals, speed etc.) and these are used to select the device for the purpose. Given the device I then set about the design and ultimately the board layout which must conform to the specific pin layout of the MCU.I would really like to know why the OP is wanting to ensure that certain functions occur on the same pins for differing MCUs? Surely this is starting the design process from the wrong point but I would appreciate hearing the counter argument so I can understand it.Susan2016-04-28 9:25 PM
Perhaps it is a NUCLEO type design, where one board must serve many devices.
Here we've used a 144-pin footprint that is common amongst a range of F2/F4 parts, including some that had not yet shipped (2MB), and this permitted a minor BOM change, where a significant price delta was occurring between 256KB flash versions, and 1MB ones, or where more memory and an FPU, or encryption was required by a customer. Not sure this worked with things like the 401C where some idiocy occurred in the power pins and such, but it worked across a sufficiently broad range of parts to do what we needed.2016-04-29 10:55 AM
clive1 and susan:
The PCB will contain just one of the 3 mentioned microcontrollers, most probably the STM32F401RCT6.About the doubts:(1) Is TMS always on pin PA13, TCK always on pin PA14, TDO always on pin PB3 and TDI always on pin PA15 for STM32 family?In place of word ''always'' I wanted to say ''normally''. I had this doubt because by checking the datasheet of the 3 mentioned microcontrollers they sound to have the same JTAG pinout (on the same ports, PA13, PA14, PA13, PB3), and also by viewing some google images about the JTAG interface of STM32.(3) Are TDO/TDI signals of programmer directly connected TDO/TDI signals (respectively) of STM32 MCU? Or do I need to cross the signals? For example, connecting TDO of programmer to TDI of STM32 MCU and TDI of programmer to TDO of STM32 MCU?
(4) Is the TRST signal required for programming? Or do I need just the nRST of programmer connected to nRST pin of STM32 MCU?Following this image of the link bellow. TDO/TDI of programmer are directly connected do STM32 TDO/TDI (respectively), and TRST is optional (won't be used in my case).https://en.wikipedia.org/wiki/JTAG
2016-04-29 11:09 AM
If we use the STM32F401RCT6 or STM32F373CCT6:
This is exactly what I want (be able to debug via SWD or JTAG), so I will use the same adapter board and a ''SMD 10pin 1.27mm pitch connector'' like this on PCB:http://www.digikey.com/product-search/en?keywords=3220-10-0300-00If we use STM32F091CCT6:I think I'll use the same 10-pin connector on PCB, however some signals won't be used, only SWDIO, SWCLK, NRST and GND, as you said, right?Thanks for the help.2016-04-29 11:16 AM
1) Yes
3) Correct, directly connected as named, or with multiple devices chained as diagramed3) No, but it can also be programmed with a subset of pins, and we haven't really ascertained why JTAG is important here vs SWD. Do you have multiple JTAG devices in a chain, do you do boundary scan?2016-04-29 11:45 AM
Hi.
No, there will be just one JTAG device, the microcontroller.I'm just starting to read about boundary scan, that's something new to me, I'm trying to figure out how this works in practice.Regards.