This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1310: About bootloader and firmware update

Other Parts Discussed in Thread: CC1310, CC2650, CC2538

HI:

I am trying to  use USB->UART adapter to CC1310 UART to program the flash. I have read swra466af.pdf  and many relative posts on this fortum already. But I still have some question:

1. CC1310 enters bootloader mode just only in this two condition:  

            a. when there is no valid image in flash;

           b. when   "Bootloader enable" and "Backdoor enable",  then you can use an external  pin to force the device into bootloader.

but how to do in this situation:  there is a valid flash image and the image code disabled bootloader end backdoor.  How can I force the device into serial bootloader mode??And what about a factory/brand new chip, is it possible to use uart/SPI and the chip as slave or is mandatory to first setup it over jtag? 

2. I am considering implementing a user application firmware update solution through UART without external pin and external intervention of physical handling. Does this means I need to write a user bootloader to judge whether jump to user application or start a flash operation for a user application update???

  • Hi,

    summery said:
     there is a valid flash image and the image code disabled bootloader end backdoor.  How can I force the device into serial bootloader mode?

    You will not be able to enter the bootloader form the application since the only way is to change the CCFG parameters. The page containing the CCFG parameters is locked during compile time

    I am not sure about this but I presume that you would still be able to modify the value when you connect the debugger.

    Refer to this thread for more details. It's for the CC2650, but it's the same IC as CC1310, just different radio.

    summery said:
    ?And what about a factory/brand new chip, is it possible to use uart/SPI and the chip as slave or is mandatory to first setup it over jtag? 

    By default, a brand new chip will have the bootloader backdoor enabled.

    Refer to table 4 for default factory values:

    summery said:
    Does this means I need to write a user bootloader to judge whether jump to user application or start a flash operation for a user application update???

    Yes, you would have to write your own bootloader and you can decide when to jump to application or bootloader mode.

    Unfortunately, I haven't found much information about how to do this.

    Regards,

    Michel

  • Thanks a lot!
    Now I can force the cc1310 go to bootloader successful and read device information(such as device ID / flash size) successful by sending serial bus commands. But now I have a problem: Next stepI need to erase the flash then send and write the exacutable file to the device flash, but I found that the exctuable file complied from CCS which format is .out is larger than the flash size! My .out file is 2.74MB, and I can use SmartRF Flash Programer 2 via XDS100v3 to program the .out file to the cc1310 success and the application can work well. But Accutally the CC1310-7XD has just 128kb flash size. Why the SmartRF Flash Programer 2 can program a lager file to the device and let it work well? How can I do to program the application file to the flash via uart?? Do I need to change the exacutalbe file format?
  • In CCS you can right click on the project, select properties.

    Under Build you will find "ARM hex utility". Activate this to make a hex file.

    The .out file contains a lot of information usable for different tool chain, the image is just part of the file.
  • Thank you TER, and I configurate the project properties as you refer to and got the destinate hex file. Then I use SmartRF Flash Programer 2 via XDS100v3 to program the hex file to the cc1310and the application can work well. But when I use my upgrate firmware to program the cc1310 through UART, it seems succeed (cause all the serial bus command got correct echo), but it cannot run the appliation well. I wrote my upgrade firmware according to the swcu117f.pdf and swra466a.pdf. I don't know why it can be programed successful but cannot run the application well.
  • After CMD_DOWNLOAD and CMD_SEND_DATA( x N) , send all the update file to the device and get the correct echo, then I directly judge the update process succeed, without calculate CRC32, does it the reason that it cannot run new exacutable file correct? Is the step that calculate CRC32 is integral to the update process??
  • Did you use the CMD_RESET after you finished uploading your data? (Refer to section 4.3.7 in SWRA466)
    Also, CRC32 calculation is not a required step but it is highly recommended to verify the data that you wrote to flash.
    Michel
  • Michel Solecki said:

    Yes, you would have to write your own bootloader and you can decide when to jump to application or bootloader mode.

    Unfortunately, I haven't found much information about how to do this.

    Michel,

    This is unfortunately not possible as the ROM bootloader checks the CCFG bootloader enable flag every time it parses a command.

    Regards,
    Svend

  • Hi Svendt,

    Thanks for your response.

    I understand that it would not be possible to use a custom bootloader to jump into the ROM bootloader, which makes sense.

    But if I write my own custom bootloader that I would store in the flash, I would be able to use my own logic and jump the application (SP and PC) to the proper location to start my application. Is that correct? (I have done it on an MSP430, so I'm guessing this should also be possible on the CC2538).

    Regards,
    Michel
  • I think it is theoretically possible, but I gave up this implementation plan last, because the device's flash size is not bigger enough for my application if I put the cutstom bootloader in flash.
  • Yes, I send the CMD_RESET after all the hex file was send to the flash correctly, and I even got the correct echo "0x00 0xcc" for the reset command. But it still cannot run the new exacutable file corectly. Now I have only one idea about this puzzledom that is to verify the CRC,even though I don't know whether it can do some help.
  • It is intresting that the CRC32 I read from the device via COMMAND_CRC32 after I uploaded all the hex file to the device is equal to the hex file CRC32. But the device still cannot run the new programed file successful. Now I don't know what to do. Can you give me some suggestion?
    The follow is my upgrade steps:
    go to bootloader ----> send CMD_PING ---> CMD_GET_CHIP_ID ---> GET FLASH SIZE ---> CMD_SECTOR_ERASE ----> CMD_DOWNLOAD ----> CMD_SEND_DATA( xN) ----> CMD_CRC32 --->CMD_RESET.
    Every command got the correct echo and and it seemed that the program process is successful, but the device cannot run the programed file. Uh. I need some help.......
  • The latest:  After I programed the device with my own update firmware via UART and it cannot run application weill,  I use the CMD_MEMORY_READ command to read sevral sector and contrasts it with the hex file at the same address,  then I found  that they are the same;  Next, I  use the SmartRF Flash Programmer2 to program the device via XDS100V3, and  it can run application well, then I use the CMD_MEMORY_READ command to read sevral sector and contrasts it with the hex file at the same address,  I found that the data are diffrent.   I really can't understand........

  • Michel Solecki said:

    But if I write my own custom bootloader that I would store in the flash, I would be able to use my own logic and jump the application (SP and PC) to the proper location to start my application. Is that correct?

    Yes, that is correct. Please note that if your image uses TI RTOS modules from ROM (configured in the .cfg file), the image will place modules needed by ROM on page 1 of the image (leaving page 0 available for e.g. a boot loader).

  • Summery,

    Can you first erase the device with Smart RF Flash Programmer 2 to ensure you don't simply overwrite ?
    Also make sure that the CCFG section at the last page of flash is existing and is flashed in.

    To be able to properly support you, please attach the binary contents after reading back what is flashed into the device by the bootloader and what is flashed into the device by the Flash Programmer 2. You can do this by reading back using the Smart RF Flash Programmer 2 in the "Edit" tab.
  • Hi svendbt:

    1. My hex file is 103508 (0x019454) bytes, and I programed it start at 0x00000000, so the last byte address is 0x019454,  and the CCFG section is start at 0x01FFDB,  that is to say I didn't overwrite CCFG anf CCFG is safe. 

    2. I made some test that saved the data after program the device by my own update firmware and by Flash Programmer 2, The data were read by Flash Programmer 2 in "Edit" tab. 

    Follow is the data picture I saved:

    At 0x00000000:

    At 0x0193f0:  (Remember, the hex file total length is 103508 (0x019454)bytes,  0x0193f0 is 103408)

    That' s it.

    So who can explain why the SmartRF Programmer 2 flashed the device with different data compared with primitive file, but the device can run well , and I programed the device with the same data compared with the primitive file, but it just cannot run??????

  • Hi Summery,

    Make sure to also include CCFG in your image.

    From what I can see, You have taken a file in intel HEX format, viewed it as binary and then used the bootloader to flash in this data. This will flash in random data which will cause the device to crash directly out of boot with a BusFault first which then is escalated to a hard fault and the CPU will lock up. This is since your stack pointer and interrupt vectors are basically garbage.

    You need to flash a binary file into the device which contains the actual image bytes. The binary can either be generated by the tool chain (CCS), converted from the HEX file with various hex2bin utils found online or you can use the Python IntelHex package.

    Recommended reading:
    https://en.wikipedia.org/wiki/Intel_HEX

    Regards,
    Svend

  • Thanks a lot svendbt!
    I changed the compile output file format to bin and then test my updata firmware, the result was what I expected and the device can run well after programed.