I have broken open a few circuits of some electronics (DVD player, handheld game device) and I can see the microcontrollers in them. However, I have no idea how they get their programs onto them! There is no micro usb or usb plug anywhere on them! How would they have gotten their program onto there?
How the code gets loaded will depend on the type of microcontroller being used. Some possible schemes used:
- The MCU gets its program code from a ROM (read only memory) that is manufactured onto the part.
- The MCU has FLASH memory built onto the chip that contains the program code. This FLASH may be programmed in a number of ways. (see below)
- The MCU may load its program code from an external memory chip. This external memory could be a ROM, serial FLASH, FRAM chip or for some older types of products an EEPROM or parallel FLASH.
Embedded products that have the program code on re-programmable memory such as the on-chip FLASH or serial FLASH chip as mentioned above can have their program code loaded via:
- The code is programmed into the bare component before it is soldered down to the board.
- Sometimes the MCU or FLASH device is placed into a socket where it can be removed for programming at the chip level using an external programmer.
- There may be a special connector or header that is used to connect an external programming device that allows loading of the program code.
- Some high volume products do away with the connector mentioned above and allow access via spring loaded pins to test points on the board to permit a programmer to access the FLASH programming pins.
There area a couple of other ways of getting a program into a micro controller.
If the volume is high enough and the design is stable the controller can be manufactured with the program in it. This is referred to as mask programing. This is expensive to set up but for very high volumes it become economical.
The program can be loaded by a special piece of hardware that you load the chip into before assembly on the PCB.
Finally it could be still loaded on the pcb. Even though you don't see a usb header there may be connection points for the chip which still allows in circuit programming.