Previously we used sd card to upgrade the program. We have to insert the sd card into the computer every time, copy the program to the sd card, and then insert it into the sd card slot of mcu to update the program. This method seems to be a bit troublesome, so we implemented a more convenient method. It no longer needs to insert or remove the SD card from PC and MCU. Use the usb function of mcu to recognize mcu as a storage U disk. When we need to update the program, connect the MCU’s usb interface to PC. After the computer recognizes it, copy the program that needs to be burned in. Then the bootloader will recognize the file and then upgrade the application. Bootloader detects changes of the file, not the existence of the file. In other words, if the a000.bin file has already existed in the sd card, the application will not be updated. When this a000.bin is overwritten with another a000.bin, the operation of updating the application will be performed.
2 Bootloader’s implementation
The schematic for SD card is shown below. The board uses SDHC module to communicate with SD card.
Figure 1. Figure 1.Schematic for SD card
We use the 2.6.0 version of FRDM-K64F’s SDK. You can download the SDK in our website.
The link is “mcuxpresso.nxp.com”.
The schematic for USB is shown below.
Figure 2. Schematic of USB
Bootloader uses SDHC, fatfs, usb, flash, So we should add files to support them. Our code is based on the example “usb_device_msc_sdcard_lite” that belongs to usb example.
In main code, the program will initialize the usb, sd and fatfs. Then the computer will communicate will MCU. Finally, PC will recognize the mcu as a u-disk.