1

I've written a lot of firmwares for embedded dev boards like Arduinos and Teensys, but am still new to PCB design. Right now I'm attempting to bring a multi-MCU design into limited production, and I'm looking for a way to flash the processors on the board through a single interface, and hopefully with a single file. I'm hoping to make this as easy as possible for the user to update in the future.

Last time I did this for a large-scale factory environment, it made sense to just drop a whole Teensy onto my board. But this time I need to miniaturize down to a square board less than an inch and a half on a side. I still like the idea of dropping an open-source board design onto my PCB, and would like to clone three board schematics onto my single board, along with various items for power, an IMU, LED drivers, etc. I can understand if that sounds like a noob thing to do, but from my perspective, it gets the thing up and running faster with very little downside, and my code already relies on open-source, so it makes sense to me.

So I would like to drop in three instances of a dev board design, most likely the Seeeduino Xiao, or possibly the Adafruit Feather. Both use the same Cortex M0 processor, but the feather breaks out more pins. Both of the boards are programmable through USB, as well as something called UF2. But they also both break out SWD pads, which are for serial flashing and debugging. I'm wondering if I can use these to program remotely from an ISP on the board.

I've learned several ways these boards can be programmed, but so far I've been unable to decipher the best way to do it in my end product. Here's some reading I've done so far:

https://learn.adafruit.com/adafruit-feather-m0-basic-proto/adapting-sketches-to-m0

https://learn.sparkfun.com/tutorials/arm-programming/all

https://www.sigmdel.ca/michel/ha/xiao/seeeduino_xiao_01_en.html

https://www.sigmdel.ca/michel/ha/xiao/seeeduino_xiao_sercom_en.html#warning

https://wiki.seeedstudio.com/Arduino-DAPLink/

https://learn.adafruit.com/programming-an-m0-using-an-arduino

https://www.pemicro.com/downloads/flash_algorithm/ARM_SPI_external_flash_alg_download.cfm

Any advice you might offer would go a long way. At this point I'm assuming by cloning in these board layouts, I'll be able to compile for that board as I normally do (VisualMicro for Visual Studio), and somehow produce a binary file that would flash all three processors. But I'm totally green when it comes to this kind of thing. So things that are obvious to you guys, I likely am totally unaware of.

Thanks for your time!

K-Space
  • 11
  • 2
  • Is flashing each MCU individually at the beginning acceptable? If so, you can just write a booloader that responds to another MCU and chain them together. But if you want even the initial flashing to happen then you need to pick a programming JTAG interface and follow their instructions. Something that supports flashing multiple MCUs qualifies it as a commercial production device, so expect to pay a hefty sum for it. – DKNguyen Mar 03 '21 at 21:33
  • I'm ok with programming them individually in production if it makes economic sense, but the more difficult requirement is that the end user should be able to plug the board in with a single USB port and have some simple process that updates all three MCUs. Ideally they would be able to do this with a single distributed file or folder, but if I had to build some sort of app or executable to do it, then I would. – K-Space Mar 03 '21 at 21:40
  • Then a master and slave bootloader is what you're looking for which is not really different than a regular bootloader except another MCU is sending commands and binary instead of your PC. – DKNguyen Mar 03 '21 at 23:30
  • Thanks for the advice. Any chance you could recommend a link to some reading material or some good things to google? – K-Space Mar 04 '21 at 19:14
  • I think ST has an app note about bootloaders for the STM. Ultimately you need to just need to figure out how to write to flash, how to get a serial protocol working, and a way to execute from RAM (or another memory bank). How to use the CRC for hash checking is good too. – DKNguyen Mar 04 '21 at 21:37
  • I hate to point out the obvious... if you didn't design it in from the start how will it work later? Have you thought about designing a programming interface an analog switch with 1 input and 3 outputs to the various boards? You can then manually (or automatically select the board ou are talking too. I did this using a serial port to select the port, an the output of a USB debugger to program. – Simon Peacock Mar 06 '21 at 23:41
  • Well, I haven't designed it yet. That's why I'm here asking the difficult questions. These boards have program/debug pins, and so I thought this would be an easy question to ask. I thought that ISP chips for multiple SWD connections would surely be common, but that does not appear to be the case whatsoever. So I've now scrapped the whole idea and gone with something else. – K-Space Mar 24 '21 at 20:25

3 Answers3

0

You can use the JTAG ports in a daisy chain. BUT make sure you can get a programmer solution as well (I think ST devices are JTAG position aware). You can then select the code for each processor in the chain and download all of them at once.

Simon
  • 349
  • 1
  • 2
  • Unfortunately, I don't believe these boards support JTAG. Only SWD: https://embeddedcomputing.weebly.com/seeeduino-xiao-m0.html – K-Space Mar 04 '21 at 21:27
0

Which is the size of the batch? The Xiao turned SWD programmer is more a proof of concept than a real programmer. Go for a Segger programmer-debugger: it comes with excellent software and support.

Rei Vilo
  • 101
  • Rei! Thank you so much for taking a look at my question!!! Unfortunately, I cannot require my end user to use a Segger device. I'm looking for a way for the average user to update my board in the field, which contains three Xiao or feather boards integrated into the main board. – K-Space Mar 04 '21 at 22:14
0

Well, after asking the difficult questions, it appears there is no simple user-friendly answer for programming multiple boards such as these. The boards have program/debug pins, and so I thought this would be an easy question to ask. I thought that dedicated ISP chips for multiple SWD connections would surely be common, but that does not appear to be the case whatsoever. So I've now scrapped the whole idea and gone with something else. I was able to consolidate it down to two MCUs using a Teensy and a Xiao for all pre-production hardware, and will later investigate using an STM32F411 and an Atmega later on down the road. Thank you all for the input! It's definitely helped move me in the right direction.

K-Space
  • 11
  • 2
  • Question: why would you put an ATmega onboard if you've already got an STM32/ATSAMD etc? I think you probably do not need all these "development boards" and could actually consolidate down to a single microcontroller. A bit more investment in programming time, but so much easier to handle physically. – awjlogan Mar 24 '21 at 20:48
  • Because I'm running an extremely time-sensitive process on the side, and cannot afford to spend clock cycles doing anything else or I'll miss asynchronous external receive events. And no, they can't be interrupt-driven. – K-Space Mar 25 '21 at 23:04