Author Topic: Debugging and/or flashing multiple microcontrollers  (Read 441 times)

0 Members and 1 Guest are viewing this topic.

Offline Dr_Neoo

  • Contributor
  • Posts: 5
  • Country: se
Debugging and/or flashing multiple microcontrollers
« on: February 26, 2020, 11:37:50 pm »
Hello,
I'm working on a system which will exsist of multiple microcontroller (STM32). The boards will not be easily accessible once installed and I have been considering different solution on how to program or debug each one after installation. Some of the ideas I have considered so far are:

* Simply breaking out each SWD header to a connector and using this with an external debugger. Biggest downside is need for a large connector.
* Using a bootloader via uart/can/usb. Downside is loosing debugger functionality and is not guranteed to reduce wiring.
* Creating an internal PCB with an embedded usb hub and one ST-Link or similar debugger for every microcontroller in the system. Seems like the best solution but I'm unsure how running through a hub will affect the debuggers?

The system is a one-off and will be used for development so cost isn't the main consern. The focus is getting something that can be integrated in a small space without large amount of time needed to develop it.

How would you go about solving this? I'm sure there are a lot of possible solutions I have not considered so I look forward to hear your thoughts!
 

Offline Prehistoricman

  • Regular Contributor
  • *
  • Posts: 201
  • Country: gb
Re: Debugging and/or flashing multiple microcontrollers
« Reply #1 on: February 27, 2020, 01:13:18 am »
How about having a tristate buffer on each micro that gets switched on when you want to talk to that specific micro? The enable signal can go via a shift register to achieve only 2 wires for n devices.

Offline Scrts

  • Frequent Contributor
  • **
  • Posts: 625
  • Country: lt
Re: Debugging and/or flashing multiple microcontrollers
« Reply #2 on: February 27, 2020, 04:09:27 pm »
AFAIK normal JTAG requires a 10 pin header? Just route as a normal daisy chained JTAG going from TDI to TDO and routing TCK and TMS to each device...
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 4724
  • Country: fr
Re: Debugging and/or flashing multiple microcontrollers
« Reply #3 on: February 27, 2020, 04:18:40 pm »
AFAIK normal JTAG requires a 10 pin header? Just route as a normal daisy chained JTAG going from TDI to TDO and routing TCK and TMS to each device...

That would work for normal JTAG, but not for SWD. There is no easy way to daisy-chain SWD. But you can handle this with some extra logic.
 

Offline Pack34

  • Frequent Contributor
  • **
  • Posts: 669
Re: Debugging and/or flashing multiple microcontrollers
« Reply #4 on: February 27, 2020, 04:54:19 pm »
Isn't this what bootloaders are for? Program through the UARTs and chain all of them together. Then when you doing a programming cycle, just target the one at the end of the chain and then work your way back.
 

Offline Dr_Neoo

  • Contributor
  • Posts: 5
  • Country: se
Re: Debugging and/or flashing multiple microcontrollers
« Reply #5 on: February 28, 2020, 08:42:58 pm »
AFAIK normal JTAG requires a 10 pin header? Just route as a normal daisy chained JTAG going from TDI to TDO and routing TCK and TMS to each device...

Thanks for the suggestion. I have not worked with JTAG before and searched around a bit for daisy chained STM32 processors. Do you have any recommendations for good resources on the subject?
 

Offline Doctorandus_P

  • Frequent Contributor
  • **
  • Posts: 634
  • Country: nl
Re: Debugging and/or flashing multiple microcontrollers
« Reply #6 on: February 29, 2020, 08:07:05 am »
JTAG is a standarised protocol just by many manufacturers of uC's FPGA's and other logic chips.

If you're unfamiliar with JTAG, then start by reading a bit about JTAG itself to build up a bit of background.
https://en.wikipedia.org/wiki/JTAG
"External links" on the wikipedia page llinks to further tutorials.

The JTAG protocol itself is standarised, but the way a programmer that uses it communicates with a PC is not.
A long time ago I built an "Altera Byte Blaster". Back then it was a TTL chip on a breadboard with wires to the LPT port.

There are many manufacturers of programmers that use JTAG, lots of them are proprietary, but open source variants also come to mind.
"Black magic probe" pops up in my mind, but I have no experience with it.

ST sells ST-Link which does JTAG.
 

Offline dmendesf

  • Regular Contributor
  • *
  • Posts: 71
  • Country: br
Re: Debugging and/or flashing multiple microcontrollers
« Reply #7 on: February 29, 2020, 10:24:16 am »
It's true that JTAG is daisy-chainable but check if your programmer has the capability to program/debug the Nth device in a chain ... My experience is that outside the world of FPGA programmers only very expensive and proprietary ones (designed for board level debugging) have this capability.
 
The following users thanked this post: Heartbreaker

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 4724
  • Country: fr
Re: Debugging and/or flashing multiple microcontrollers
« Reply #8 on: February 29, 2020, 03:08:59 pm »
Dang guys. AFAIK and as I said above, most STM32 MCUs (that I know of at least, maybe except some very old ones?) support SWD but not JTAG.
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 5951
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Debugging and/or flashing multiple microcontrollers
« Reply #9 on: February 29, 2020, 03:42:48 pm »
How about use a mux controlled by an Arduino or similar to select which microcontroller is connected for debug?
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline prasimix

  • Supporter
  • ****
  • Posts: 1411
  • Country: hr
    • EEZ
Re: Debugging and/or flashing multiple microcontrollers
« Reply #10 on: February 29, 2020, 04:12:06 pm »
* Biggest downside is need for a large connector.

You need just 3-pin connector for SWD, with 2 or 2.54 mm raster it is not so big or about 5 mm is too big in your case?

Offline bson

  • Supporter
  • ****
  • Posts: 1619
  • Country: us
Re: Debugging and/or flashing multiple microcontrollers
« Reply #11 on: February 29, 2020, 07:20:29 pm »
* Simply breaking out each SWD header to a connector and using this with an external debugger. Biggest downside is need for a large connector.
The 0.050" 10-pin connector used by STlink V3 is really quite small and easy to drop down just about anywhere.
The connector that mates to the stock cable is a Samtec FTSH-105-01-L-DV-K (PDF datasheet).
Another option is to use Tag-Connect TC2030-NL, which needs only a footprint and requires nothing to be populated on the board.  A legged version that grabs a pair of holes exists too (I've used both and they work well, but the legged one is preferable IMO during development as it's more secure).  Slightly bigger, but also very easy to fit.  Note that the cable ends in a 6 pin .1" IDC; an adapter board for STLink v3 is trivial.

« Last Edit: February 29, 2020, 07:24:55 pm by bson »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf