1
\$\begingroup\$

I am using the Atmel ARM M0+ MCU (ATSAMD20J18). I have written a bootload for it. The bootloader will check the first few bytes (lets call it magic key) from an external SPI flash memory to determine whether to enter the bootload mode. If the bytes are correct, it will copy data from the same SPI flash to the MCU's internal flash.

The problem is for the first time programming (for example in manufacturing), I need to have both the bootloader and the first version application firmware programmed in the MCU before we send out the product. Therefore I am thinking that I can program the bootloader to the MCU, and then using some method to program the external SPI flash with the application firmware and the magic key.

The question is how can I program the extenal SPI flash? I found a similar thread here: "How do I write to SPI flash" However, besides to write the binary format application firmware, I also need to write the magic key and the length of the application firmware to the first few bytes of the flash. I prefer to do In-circuit-Programming if possible.

\$\endgroup\$
1
\$\begingroup\$

Oh maybe load a program through jtag of the mcu and have it do the work. Bit bang with boundary scan, design your board with a header to hold mcu in reset or isolate spi bus if you have to and program it directly with something like this USB to spi decice (comes with c API for host).

You could order the flash parts preprogrammed from any distributor, you could buy a gang programmer or use the sockets in my link above to program them yourself before attaching them.

If you are doing ict you can do it as part of the test on the end of the line. For high volume reprogramming I've even seen people make little programming devices you can just plug into your board hit a button and let it reprogram. The list goes on and on, just depends how you want to handle it.

This shouldn't be too hard with a little planning.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.