Electronic – Using a microcontroller to program another microcontroller (on a wireless board)

microcontrollerprogrammingwireless

I am working on a project in which I want to include the functionality of reprogramming the main microcontroller via wireless transmission.

First, I have figured there needs to be a dedicated microcontroller programmed to facilitate this function, but how exactly would it need to be implemented?

Assuming the code is already compiled before transmission, would the code need to be stored in any specific way prior to being read and used to program the main controller?

Also, what exactly is the process required to facilitate the actual programming of the controller?

Best Answer

Some controllers can write to their own program flash under software control; others cannot. If you need to use a secondary processor to program the primary one, it's really not much different from any other task that requires willing certain pins in certain sequences with certain timing constraints. The one biggest thing to look for is that some parts can be programmed in a variety of ways, some of which may be much faster than others. If the part to be programmed can write to parts of its own flash under software control but can't do everything and thus requires the use of a secondary processor, it may sometimes be fastest to have the secondary processor program the primary one with just enough of a boot loader to receive its code via some other means (such as a UART) than to use the in-circuit programming mode for everything.