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.

TMDSCNCD28379D: Flow of updating firmware in the field with USB flash programmer

Part Number: TMDSCNCD28379D
Other Parts Discussed in Thread: C2000WARE

Currently with the USB flash programmer demo you do the following:

  • In Code Composer launch a program
  • In Code Composer select CPU Reset
  • In memory window update memory location 0x0D00 to 0x0C5A to enter bootloader mode
  • In Code Composer select run
  • Attach USB cable from control board (J8) to computer
  • Use the USB flash programmer executable as follows - usb_flash_programmer.exe  F2837xD_usb_flash_kernels_cpu01.dat  my_project.dat
    • Flash kernel is loaded into RAM
    • Bulk transfer of my_project.dat over USB occurs with the USB flash kernel writing the image to flash.
    • Once writing is complete it jumps to location of firmware loaded and starts to run

My question is how would this work in a real life scenario where we needed to do an update of firmware for our project in the field (i.e. no Code Composer that I can reset the CPU and set the boot mode at 0x0D00)?

I am trying to understand the steps/changes we would need to take to get this to work in the field?

Thanks for your help.

  • Hi, 

    There are two boot modes - emulation mode or standalone mode. The above steps mentioned are for emulation mode. 

    For emulation mode ,  boot process is to be emulated when the device is reset while the emulator is connected. For standalone boot, the process requires the user-configurable  DCSM OTP (one-time programmable) registers to be programmed. 

    So for testing /development, you can use the emulation mode but if you want standalone boot, you will have to program the OTP register.

    Pls refer section "4.2 Boot ROM registers" in TRM to make the device boot to USB bootloader.  Get boot mode selection can be customized through the BOOTCTRL register. Pls refer Table 4-8. Get Mode Decoding on CPU1.  0xD00 address correponds to EMU_BOOTCTRL register .  You can use the Z1_BOOTCTRL for standalone boot. 

    Note : If you change the BOOT Config, your changes will be permanent. And every time it will boot to USB.

    Best Regards

    Siddharth

  • Thank you for this information.

    With our device we would want to boot from FLASH, but would need to periodically update the firmware in FLASH. So I think we would we would want to keep the default in the BOOTCTRL register.

    In this use case what is the common way of performing an update of firmware located in FLASH via USB?

  • Just to follow up on this. I am trying to understand how we can perform a field firmware update with the USB flash programmer where our firmware would by default boot from flash on a power up / reset?

    If we were to power up our device with the default setting in the BOOTCTRL register of booting from flash, I am not sure what we would need to do to get the USB flash programmer to work since the BOOTCTRL register is not set for USB bootloader? 

    Is this not possible?

    I would think this is a common use case of your device booting from flash and you want to update the flash firmware via the USB?

    Thanks for your help.

  • Hi Brent,

    You can refer to the section 4.6 Configuring Get Boot Options from the Technical Reference Manual of the device. It is on page no. 607 which you can download from here.

    This section explains how you can switch between different boot modes to perform the type of firmware update that you have mentioned. Let me know if there are any further questions.

    Thanks,
    Ronak

  • Thank you for the response. I had read section 4 before. I guess I am just not understanding something. Or a lot of things. Blush

    In production you use OTP Boot ROM registers Z1_BOOTCTRL and Z2_BOOTCTRL (not emulation mode).

    In Figure 4-6 page 614 it has the following steps:

    1. Find out which boot pins to read – user configured or Factory default.
    2. Check Zx_BOOTCTRL register to see if value is 0x5A. If value is 0x5A do the following steps else use default boot pins.
    3. Check Zx_BOOTCTRL register to see if pin 0 is valid. If so, set BOOT PIN 0.
    4. Check Zx_BOOTCTRL register to see if pin1 is valid. If so, set BOOT PIN 1.
    5. When both pins are high you get Boot Mode 3 - GET MODE where you read OTP Boot Mode values.
    6. For example, if the OTP is set to 0x0C your boot mode is USB and you start the boot loading over USB.

    In our devices a user will routinely plug in the device and boot from FLASH. As a result, we want the default to be Flash boot.  So, this means that in the OTP Zx_BOOTCTRL register(s) the key is NOT set to 0x5A or it is set to 0x5A and the BMODE value is something NOT in table 4-8.

    Then comes my use case where I want to update FLASH via the USB programmer. Since the OTP Zx_BOOTCTRL register(s) does NOT have the key set to 0x5A (or it may be, but BMODE value is something other than in table 4-8) and BMODE is NOT set to 0x0C for USB Boot, how do I use the USB flash programmer? How do I switch boot modes?

    Can you help clear up my misunderstanding?

  • Just wanted to follow up on this?

    Is my understanding correct in that you CANNOT change boot modes once you have set up the OTP BOOTCTRL register(s)? Whatever you set in the BOOTCTRL register is the ONLY way you will boot?

    In the Technical Reference section 4.5, page 606, Table 4-6 bits 8-15 determine the boot mode. Bits 16-23 and 24-31 you configure the boot select pins.

    So to boot from FLASH you would set bits 8-15 to 0xB (per table 4.8) in the BOOTCTRL register. I believe you would leave the boot select pins in the BOOTCTRL register as default in this case since in section 4.10.6 where it list GPIO pin assignments there are none for FLASH?

    To boot from USB to use the ROM USB bootloader we would set bits 8-15 to 0xC (per table 4.8) in the BOOTCTRL register. Bits 16-23 and 24-31 in the BOOTCTRL register would be set to 42 and 43 for USB per section 4.10.6 where GPIO pin assignments are defined.

    Again in our device we would want to boot from flash the majority of the time. We would want to switch boot modes from FLASH to USB when we wanted to update the firmware via USB.

    I have to believe there is a way to switch boot modes and I am just not understanding something correctly?

    Thanks for any help or insight.

    Brent

  • Just following up on this again. 

    Is my understanding I stated above correct or am I misunderstanding something?

    What is interesting is that if you look at the C2000 serial flash programming guide you see the following for the 4x device.

    You can switch boot modes from FLASH to CAN based on the boot mode select pins.

    In the 37x case you have:

    So, when those boot mode select pins are both high you either boot from FLASH or are in GET boot mode where the BMODE value in the OTP BOOTCTRL determines how you will boot. So, no option to switch like in the 4x device?

    If you cannot switch boot modes, in my case switch from FLASH to USB when I want to update the firmware then the only thing I can think of is:

    1) Include the boot code / library found at C:\ti\c2000\C2000Ware_4_03_00_00\libraries\boot_rom\f2837xd\revB into our project

    2) By default, we would boot our project from FLASH and in our project, we would need to determine if a USB is attached via GPIO pin(s) at boot up.

    3) If USB is attached call the USB_Boot() in USB_Boot.c. This will be able to read in the flash kernel, write it to RAM, jump to its main, and start executing.

    4) The flash kernel in RAM would then read in the application, write it to FLASH, jump to its main in FLASH and start executing. 

    Would this work?

    Any working examples of this?

    In this use case it kind of stinks that you need to copy the USB boot code that is in ROM and place it your applications FLASH taking up valuable space.

    Thanks for any insight or comments,

    Brent

  • Hi Siddhart,

    I am hoping you can provide an answer to my question(s) above. Is my understanding which I stated below correct in that once you program the OTP BOOTCTRL register(s) you are not able to switch? Specifically in the case of both Boot Pins are high you get Boot Mode 3 - GET MODE where you read OTP Boot Mode values. There is really no way to switch? I am hoping I am misunderstanding something. 

    And that to switch boot modes, in my use case 99% of the time booting from FLASH, 1% booting from USB to update firmware, I would need incorporate the BOOT ROM code at C:\ti\c2000\C2000Ware_4_03_00_00\libraries\boot_rom\f2837xd\revB into our application. Then detect if a USB is attached in our code and call USB_Boot() from our code?

    Thanks for your help,

    Brent

  • The answer is NO, you cannot change boot modes once it is set.

    To do this in your application you would need incorporate the BOOT ROM code/library  at C:\ti\c2000\C2000Ware_4_03_00_00\libraries\boot_rom\f2837xd\revB into your application. Then detect if a USB is attached in your code and call USB_Boot().

    TMS320F28379D: Configuring OTP BOOTCTRL Register - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1249359/tmdscncd28379d-update-blink-led-application-by-calling-usb_boot-in-application-code/4727236#4727236

    I will say that it is unfortunate that you need to include the Boot Rom code/library into your application taking up precious FLASH application space. 

    Brent