How to update peripheral firmware through UART

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to update peripheral firmware through UART

Jump to solution
4,469 Views
Federico_R
Contributor II

Hello,

I have a system based on MK60DX256 with a WiFi Module producted by BlueGiga.

The WiFi module is connected to MCU through UART0 and UART4 (the module is provided with 2 UART).

Actually I use UART0 to communicate with the WiFI Module.

I need to update the firmware of WiFi Module and I would update it through UART, in particular UART4 that isn't used.

Moreover my MCU include a bootloader MSD.

This is my question: Can I put WiFi's firmware into USB Disk (created by the bootloader) and them upload it to WiFi module through UART?

Thanks for the help!

Federico

Labels (2)
0 Kudos
1 Solution
2,722 Views
mjbcswitzerland
Specialist V

Hi Federico

The uTasker Kinetis project supports USB-MSD in an AT45DB161 (16 Mbit SPI Flash) by enabling the following defines:

- #define SPI_FLASH_FAT // enable FAT in SPI flash

- #define SPI_FLASH_AT45DB161 // enable SPI device type

with option of 512 or 528 byte pages [#define SPI_FLASH_PAGE_LENGTH 512 or #define SPI_FLASH_PAGE_LENGTH 528]

- #define USB_INTERFACE // enable USB interface

- #define USB_MSD_LOADER // enable USB-MSD class

Then the application can use the integrated utFAT interface to read from the drive in the SPI Flash and copy the data to a UART.

Since you haven't developed with the uTasker framework you will need to find solutions for the following:

1. USB driver and USB-MSD class (if not already available)

2. Adapt the MSD class (if not an option in it already) to work with SPI Flash (will need an SPI driver and driver interface to the chip type used)

3. Integrate a FAT file system with SPI Flash support (interface should be shared with USB-MD class) to allow the application access to the files that were written by the USB host.

An alternative that I see, however, is to adapt the USB-MSD boot loader to emulate two LUMs (one for the firmware upload and one for a second SPI disk). Then the application needs neither its own USB-MSD mode nor FAT since the loader can save the file linearly and not as FAT. This can be performed quite easily with the uTasker serial loader as long as SPI Flash from ATMEL, ST or SST (or compatible) are available.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market


View solution in original post

0 Kudos
10 Replies
2,722 Views
mjbcswitzerland
Specialist V

Federico

Assuming the Wifi module allows firmware upgrade via the UART, the K60 can of course do that part.

However I think that your question is probably more due to the fact that you would like to use the MSD loader to transfer this firmware to your board. This will therefore depend on the capabilities of the MSD loader - which one do you use?

Normally the MSD loader will be emulating FAT12 and allowing the PC to write software to your processor - you could of course mix your SW version with the WiFi firmare so that it is 'embedded' in the complete code, assuming there is enough space for both in the processor's flash.

Otherwise you will need a MSD version that allows storage in a particular medium (flash disk inside the K60, SD crad or SPI Flash etc.) and then your K60 SW will need to be able to read the same file system so that it can complete the programming step. This is probably an MSD mode that the K60's application performs rather than an MSD loader function.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market


0 Kudos
2,722 Views
Federico_R
Contributor II

Hi Mark,

thanks for the reply.

Yes, I can upgrade firmware through the UART.

I don't know which MSD loader is implemented in the firmware because the firmware was develop by another person.

On my board there is an SPI 16-Mbit Flash Memory. It's possible to store the WiFi Firmware into the Flash Memory using MSD? Which type of MSD I need to install to achieve this goal?

Thanks for your time.

Federico

0 Kudos
2,723 Views
mjbcswitzerland
Specialist V

Hi Federico

The uTasker Kinetis project supports USB-MSD in an AT45DB161 (16 Mbit SPI Flash) by enabling the following defines:

- #define SPI_FLASH_FAT // enable FAT in SPI flash

- #define SPI_FLASH_AT45DB161 // enable SPI device type

with option of 512 or 528 byte pages [#define SPI_FLASH_PAGE_LENGTH 512 or #define SPI_FLASH_PAGE_LENGTH 528]

- #define USB_INTERFACE // enable USB interface

- #define USB_MSD_LOADER // enable USB-MSD class

Then the application can use the integrated utFAT interface to read from the drive in the SPI Flash and copy the data to a UART.

Since you haven't developed with the uTasker framework you will need to find solutions for the following:

1. USB driver and USB-MSD class (if not already available)

2. Adapt the MSD class (if not an option in it already) to work with SPI Flash (will need an SPI driver and driver interface to the chip type used)

3. Integrate a FAT file system with SPI Flash support (interface should be shared with USB-MD class) to allow the application access to the files that were written by the USB host.

An alternative that I see, however, is to adapt the USB-MSD boot loader to emulate two LUMs (one for the firmware upload and one for a second SPI disk). Then the application needs neither its own USB-MSD mode nor FAT since the loader can save the file linearly and not as FAT. This can be performed quite easily with the uTasker serial loader as long as SPI Flash from ATMEL, ST or SST (or compatible) are available.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market


0 Kudos
2,722 Views
Federico_R
Contributor II

Hi Mark,

thanks for the complete explanation!

For the moment I wan't use an Operative System. I will use it in my future version of firmware.

I think that: Can I make a bridge trough Virtual COM (USB) and WiFi's UART, in order to have a direct communication to WiFi module through the PC?

Thanks

Federico

0 Kudos
2,722 Views
mjbcswitzerland
Specialist V

Hi Federico

If you configure a USB-CDC device to UART bridge the PC can directly communicate with the device connected on the UART.

Reference in the uTasker project framework:

#define USB_INTERFACE // enable USB device

#define USE_USB_CDC // enable USB-CDC class

#define USB_CDC_COUNT   6 // the number of USB-CDC/UART bridges (min. 1 and maximum 6 on K60)

Regards

Mark

Kinetis: µTasker Kinetis support

K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
2,722 Views
Federico_R
Contributor II

Hi Mark,

thanks for the reply, but I looking for a solution without uTasker, for the moment.

Federico

0 Kudos
2,722 Views
mjbcswitzerland
Specialist V

Hi Frederico

There are USB-CDC examples in the Freescale software that you may be able to use.

Since I can only support the uTasker framework I can't help you with the details so you will need to study the packages available and make any adaptations necessary to fit into your project.

What I can still offer is a USB-MSD boot loader alternative with two upload disks (assuming the SPI flash matches a supported one) - one loading your firmware to flash and the other loading your WiFi's firmware to SPI Flash in place of your existing MSD boot loader. This would have no implications for your existing application SW and probably be the most efficient solution for you since you would only need to be able to read (linear) data from the SPI Flash.

Regards

Mark

Kinetis: µTasker Kinetis support

K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market


0 Kudos
2,722 Views
Federico_R
Contributor II

Hi Mark,

you solution is very interesting.

A question: Do I have to create a bootloader with uTasker and than I can load my existing firmaware without any modification (such as adding a OS)?

Thanks

0 Kudos
2,722 Views
mjbcswitzerland
Specialist V

Hi Frederico

I have attached some binary files for TWR-K60 boards which show how the USB-MSD boot loader can be used as a dual-LUM device.

Two hard drives appear as  "PROG_DISK_1" and "PROG_DISK_2" and processor firmware can be loaded to "PROG_DISK_1".

"PROG_DISK_2" can be used to load different files to different areas of Flash (or different Flash devices). It will load to the same place as "PROG_DISK_1" in this particular configuration but the destination can be set to SPI Flash etc. (In the case of SPI Flash the driver is assumed to be available or else needs to be added).

This can be built for any KL or K device with USB using CW, KDS, IAR, Keil, Crossworks, Atollic, CooCox, Green Hills, GCC or VisuaStudio so is flexible and requires no special porting (the attached binaries also support KBOOT UART and KBOOT-HID in parallel but many configurations, including SD card and/or Ethernet are also possible with a single define controlling each).

Further features of the USB-MSD loader are that the SW file information belonging to the loaded file (its name, date, size) is also visible and the firmware can be copied back, with optional password protection. The operation is compatible with Windows 8.1, previous Windows versions and MAC OS X.

Regards

Mark

Kinetis: µTasker Kinetis support

K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
2,722 Views
mjbcswitzerland
Specialist V

Hi Frederico

The boot loader can work together with any application - the only thing that needs to be defined is the start address of the application. More details are at http://www.utasker.com/forum/index.php?topic=1866.0

Regards

Mark

Kinetis: µTasker Kinetis support

K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos