IMPORTANT NOTE

This method is tested and works only by using  RS-232 connectrion (USART 1). Firmwae update through RS484 is not impemented.

Regularly, the firmware of the controller can be updated by using Roborun+ utility through USB or RS232 port of the controller. In systems that do not support Roborun+, a firmware update can be performed through the controller’s MCU USART (both RS232 and RS485 options are available) by using the sample source code provided by Roboteq. By integrating this code, the user application can communicate with the controller and implement a firmware update by using YModem protocol. Please note that the code is provided as-is without any responsibility from Roboteq.

 

How the firmware update is being performed

The controller enters bootloader every time it powers ON and checks if it will receive a firmware update request. The request to perform firmware update through USART is a set of 5 ‘w’ in a row (“wwwww”) that will be received through USART. If the special characters are not received within 200 ms, the controller will check if there is a request to go to DFU mode (firmware update though USB) and if not, it will jump to main application. The only check that the controller will perform before jumping to main, is to see if the first bytes of the application memory are written. Below you can see a flow chart illustrating the Bootloader sequence:


  

 



On the sender side, the application needs to reset the controller and then send a sequence of “w” (at least five) within 200 ms. Then it will wait for the controller responses and it will start the firmware update by using the YModem protocol. All these actions are being performed by the sample code provided by Roboteq. A flow chart follows:


Sender Flow chart




Some key points that can be derived from the flow charts are:

  • The controller enters bootloader only after reset
  • If the controller is unresponsive, it will not be able to receive a reset command, so a manual reset is necessary (power cycle). Then the firmware update can be initiated by sending “wwwww”
  • If the controller has no communication with Roborun+, a firmware update can be performed only through USART. The DFU request can be sent only from Roborun+ and without this request, the USB will not be defied.  
  • When the controller gets a DFU request it will stay in DFU mode until the firmware update is completed or the controller is reset
  • If the controller has reset five times in less than 10 sec (this can happen by bad script or wrong firmware) it will go in DFU mode
  • If the application memory is not written, the controller will go in DFU mode

 

How to run the source code


The the source files should be requested by Roboteq. The FirmwareUpdateCLI.rar file includes the following files:

  • FirmwareUpdateCLI.c
  • ymodem.c
  • ymodem.h
  • makefile

The user can integrate the sample code into its implementation or run the makefile and create an executable of the FirmwareUpdateCLI.

The makefile takes as arguments the COM port and the firmware, so those two parameters need to be modified inside the file:

 

Then the following command can be sent to start the update process: 

make clean all

The code will be built and run, and the update progress will be visible through command line. If everything is done properly, the user should receive a success message!