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.

TMS320F28379D: Configuring OTP BOOTCTRL Register

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi Team,

We are working on TMS320F28379D control card. We are able to do USB flashing using usb_flash_programmer.exe, to do this we have configured EMU_BOOTCTL register with value 0xC5A.

1. Now we would like to program BOOT_CTRL OTP registers for USB boot mode and test usb_flash_programmer.exe and. Can you tell us, how to read current value of BOOT_CTRL register and how to configure BOOT_CTRL register for USB boot mode?

2. Our understanding is that, Once BOOT_CTRL register configured for USB boot mode, if the device connected to a USB Host it will boot from USB or it will boot from internal FLASH. Is this correct?

Thanks&Regards,

Varada pavani.

 

  • Hi Varada,

    1. Please refer to the C2000™ Software Controlled Firmware Update Process for more details : http://www.ti.com/lit/an/spracn1/spracn1.pdf

    2. As mentioned in the Technical Reference Manual "By default, Get boot mode executes flash boot when in standalone mode or wait boot when an emulator is connected to the device." So I think what you wrote is correct.

    Thanks and Regards

  • Hi,

    Once you program BOOT_CTRL to USB boot mode, you will not have the option to boot to flash.

    In order to program BOOT_CTRL you can see the blinky with dcsm example, or you can use the On-Chip flash programmer to program the OTP location.

    If you want the option to boot to flash or USB, then you should configure your device to always boot to flash and then have your flash application determine whether or not it should call into the USB Bootloader from boot ROM.

    Hope this helps.

    sal

  • Hi Sal,

    Thanks for the input.

    So what you are saying is that if we configure the BOOT_CTRL register with USB boot we cannot come back to Flash boot mode.

    I cannot make out clearly from your Statement "If you want the option to boot to flash or USB, then you should configure your device to always boot to flash and then have your flash application determine whether or not it should call into the USB Bootloader from boot ROM." Could you please elaborate further/make it clear.


    Your statement says that "call USB boot-loader from boot ROM". How to do this? could you please suggest?

    Thanks,

    varada pavani.

  • Your understanding is correct. By programming USB boot mode as the GET MODE option, you eliminate your ability to boot to flash.

    Instead, if you want both options, always boot to flash.

    At the start of your flash application you can check some pin or the USB connection to see if your device is signaled to do a firmware update through USB. If it is signaled to do a USB flash programmer update, then make a function call into Boot ROM by linking the Boot ROM symbols into your project and then make the function call to the USB boot loader to start the firmware update process. Otherwise, just continue with your flash application.

    Please see other forum posts regarding this. Others have implemented this. The procedure is straight forward and the forum will help you as well.

    sal

  • Hi Sal,

    1. We can able to identify the GPIO status for USB connection from the application.

    2. I have included Boot Rom symbols in to my project as follows is this right?

    properties-->Include options>/home/ti/C2000Ware_2_00_00_02_Software/libraries/boot_rom/f2837xd/revB/rom_symbol_libs 

    3. Can you please provide me any document or any thread for function call to boot rom and usb bootloader from my application?

    Thanks and regards,

    varada pavani.

  • The source code is available for you to view. The Boot ROM documentation in the TRM will also be helpful.

    Include the symbol library like you have (.lib) and then #include "c1_bootrom.h" into your source code file which will make the USB boot loader function call.

    The function is Uint32 USB_Boot(Uint16 bootMode). This is located in USB_Boot.c

    The bootMode parameter is not used, so you can pass anything to it that you wish. This function, as you can see in the source code, will configure the AUXCLK and then run the USB bootloader in ROM. Then you should be able to enumerate with the host and establish a usb connection to use USB flash programmer.

    sal

  • Hi Sal,

    We are calling USB Boot loader from application as follows.

    EntryAddr = USB_Boot(USB_BOOT);

    But unable to start the USB Boot loaderWhile debugging using CCS we noticed that USB_Boot() Function was returning FLASH_ENTRY_POINT, Because USB Module is not enabled. Below is the code snippet from USB_Boot function.

    //If the USB module is not enabled, bypass the bootloader

    if (DevCfgRegs.DC12.bit.USB_A == 0)
    return FLASH_ENTRY_POINT;

    Here my query is that how to enable the USB module before calling the USB_Boot() from the application?

    Thanks,

    Varada pavani.

  • Are you using F28377 or F28379? What is your part number? Does it have USB?

    The USB may not be enabled because you are using the debugger and CCS. You may not be running through the boot ROM after a reset, thus the c1brom_device_config() function is not executed from boot ROM in the c2brom_boot.c file.

    So, in your final application you may not need to enable the USB, but for your development you can write to the DC12 register yourself.

    DevCfgRegs.DC12.bit.USB_A = 1;

    Hope this helps,

    sal

  • Hi Sal,

    After calling USB_BOOT from my application we can able to see usb device(F28x7x USB Boot Loader) in device manager.

    DevCfgRegs.DC12.bit.USB_A = 1;
    uint32_t EntryAddr = USB_Boot(USB_BOOT);
    return EntryAddr;

    But we are unable to flash our new firmware using usb_flash_programmer.exe

    usb_flash_programmer.exe F2837xD_usb_flash_kernels_cpu01.dat blinky_cpu01.dat.

    Are we missing anything here?

    Please find the below screenshots and the error messages.

  • Have you been able to get it to work booting to USB bootloader?

    I recommend you get that working first, and then start creating your solution. This will help you debug your issues.

    sal

  • Hi Sal,

    Device is  able to enter in to USB Boot loader.And on host PC detected as F28x7x USB Boot Loader in device manager after calling USB_Boot() from the application.

    Enumeration was successful using command line usb_flash_programmer.exe -l .

    Performing device check only

    Manufacturer: Texas Instruments

    Product ID: TMS320F28X7X USB Boot Loader

    Serial number: 2

    To Flash the firmware usb_flash_programmer.exe is used as below, During this transferring F2837xD_usb_flash_kernels_cpu01.dat was successful But flashing new_image.dat was failing. Please check the below logs.

    usb_flash_programmer.exe F2837xD_usb_flash_kernels_cpu01.dat  new_image.dat

    Manufacturer: Texas Instruments

    Product ID: TMS320F28X7X USB Boot Loader

    Serial number: 2

    Sending 14206 bytes of data from the file F2837xD_usb_flash_kernels_cpu01.dat ... Done!

    14206 out of 14206 bytes sent

    success!

    Error enumerating device interface: 0x0103
    This may mean that the device is not attached or the driver is not installed
    Error: Couldn't open the USB device

    Are we missing anything from application side? Other than USB_Boot() do we need to initialise  anything?

  • Hi,

    I do not believe there is anything different you need to do?

    Can you confirm that the kernel is entirely linked to load and run from RAM?

    Can you confirm that your flash application is entirely linked to load and run from flash?

    Have you gotten the solution working by using EMU boot to boot to USB bootloader? I am asking if you have gotten the DFU solution working before trying to get it working when booting to flash and then the USB bootloader from your applicaiton.

    sal

  • HI,

    Also, please try loading the kernel via CCS and running it on its own and connecting with the PC application and only loading the flash application .dat file.

    Let me know if this works.

    sal

  • Hi Sal,

    Can you confirm that the kernel is entirely linked to load and run from RAM?
    Yes, but is this about F2837xD_usb_flash_kernels_cpu01.dat ?

    Can you confirm that your flash application is entirely linked to load and run from flash?
    Can you please elaborate little more on this?

    Have you gotten the solution working by using EMU boot to boot to USB bootloader? I am asking if you have gotten the DFU solution working before trying to get it working when booting to flash and then the USB bootloader from your applicaiton.
    Yes, below is the procedure we followed for EMU Boot to boot to USB Bootloader.

    1. Connect the target with switch settings 11

    2. Open Memory Browser and update the Memory Location 0xD00 with 0x0C5A.

    3. Then connect USB from PC to the Micro USB Port on top of F2837xD Control Card.

    4. Press CPU Reset and run button on CCS.

    5. On Host PC Control card detected as "F28x7x USB bootloader" in device manager.

    6. Executed the following command in host PC as below and able to flash the new firmware.
    "usb_flash_programmer.exe F2837xD_usb_flash_kernels_cpu01.dat new_image.dat"

    Also, please try loading the kernel via CCS and running it on its own and connecting with the PC application and only loading the flash application .dat file.

    We have tried loading the kernel (F2837xD_usb_flash_kernels_cpu01) via CCS and it is running, but on host PC it is showing as "unknown USB Device" .

     

    Thanks,

    varada pavani.

  • If you are able to get the solution working when using EMU boot mode, I am not sure why it would not be working when calling into the Boot ROM USB_Boot() function.

    What I mean is that your flash application should entirely be linked to load to flash since the USB kernel is not able by default to program RAM. Whatever data it receives it uses the flash API to program, and hence only programs the flash.

    This is likely your issue.... After calling USB_Boot() the function is returning and not branching to the entry point of the kernel. You need to branch or make a function call to the entry point of the kernel which is sent and returned from USB_Boot().

    sal

  • Hi Sal,

    Yes, it seems that something is wrong with the entry point returned by USB_Boot. 

    We have modified blinky_cpu01 firmware and below is the code snippet.

    uint32_t gpio46_value = GPIO_readPin(46);
    if(gpio46_value == 1) //Checking whether USB is connected or not.
    {
                //USB is connected with HOST PC.
                DevCfgRegs.DC12.bit.USB_A = 1;
                EntryAddr = USB_Boot(USB_BOOT); //Calling USB_Boot function.
                return EntryAddr;
    }

    Is the above function call is enough or need to call anyother function to branch to Entry point?


    We have included the rom symbols to the project.

    added the following lib path “ti/C2000Ware_2_00_00_02_Software/libraries/boot_rom/f2837xd/revB/rom_symbol_libs/c1_ROM_API/F2837xRevB_c1bootROM_BootROMSymbols_fpu32.lib” in “Project properties -->Build-->C2000 Linker --> File Search Path”.

    Added the following files to project.
    Shared_Boot.c
    USB_Boot_Funcs.c
    USB_Boot.c
    USB_Structs.c
    from the below location “/ti/C2000Ware_2_00_00_02_Software/libraries/boot_rom/f2837xd/revB/rom_sources/F2837x_bootROM/cpu01-bootROM/source

    During debug I have noticed that EntryAddr returned by USB_Boot fucntion is 0x00000000. Is this correct?

    Am I doing anything wrong?

  • I am a little confused as to what you are doing...

    I thought you were calling USB_Boot from your application. Here are the steps you should take.

    1a - device) Call USB_Boot from your application.

    1b - host) Use the usb flash programmer to load the kernel to the device.

    2a - device) branch to the entry point. This will branch to the kernel you just loaded to RAM. The entry point is likely 0x00000000. This will execute the flash kernel.

    2b - host) Use the usb flash programmer to load the flash application.

    3 - device) The kernel will branch to the entry point of the flash application upon completion.

    sal

  • Hi Sal, Please check my response in-line.

     

    I thought you were calling USB_Boot from your application. Here are the steps you should take.

    Yes we are calling USB_Boot function from the application.

    1a - device) Call USB_Boot from your application.

    Device : Checking the USB connection with HOST and Calling USB_Boot function in application.

    1b - host) Use the usb flash programmer to load the kernel to the device.

    Host: using the usb flash programmer to load the kernel as below. Here I have included the log of usb flash programmer.

    usb_flash_programmer.exe F2837xD_usb_flash_kernels_cpu01.dat new_image.dat"

    usb_flash_programmer.exe F2837xD_usb_flash_kernels_cpu01.dat  new_image.dat

    Manufacturer: Texas Instruments

    Product ID: TMS320F28X7X USB Boot Loader

    Serial number: 2

    Sending 14206 bytes of data from the file F2837xD_usb_flash_kernels_cpu01.dat ... Done!

    14206 out of 14206 bytes sent

    success!

    Error enumerating device interface: 0x0103
    This may mean that the device is not attached or the driver is not installed
    Error: Couldn't open the USB device


    From the above log it looks like thatF2837xD_usb_flash_kernels_cpu01.dat” was loading to the device, after that USB was getting removed from the device and flashing of the application was failing.

    2a - device) branch to the entry point. This will branch to the kernel you just loaded to RAM. The entry point is likely 0x00000000. This will execute the flash kernel.

    After USB_Boot function call, is it required to call any function to branch to entry point?

    2b - host) Use the usb flash programmer to load the flash application.

    3 - device) The kernel will branch to the entry point of the flash application upon completion.

    Since the USB device is removed from the host after Kernel is loaded, loading flash application was failing.

    Thanks,

    Pavani,

  • Yes, it is required to branch to the entry point after loading the kernel. You are not doing 2a.

    sal

  • Hi Sal,

    Thanks for the support. We are able to do firmware up-gradation over USB on CPU1 Flash.

    Now we are trying to update both CPU1 and CPU2 flash through USB.  We have referred one of the thread related to  usb firmware upgrade for both the CPU Flash. Here is the link .

    Here i have mentioned build configuration of all images.

    F2837xD_usb_flash_kernels_cpu01.dat-- DUAL

    F2837xD_usb_flash_kernels_cpu02.dat --RAM

    blink_dc_cpu1.dat--CPU1_FLASH_STANDALONE

    blink_dc_cpu2.dat--CPU2_FLASH.

    With the above binaries we tried to update the firmware as shown in the below command.But it failed.Please check the log.

    usb_flash_programmer.exe F2837xD_usb_flash_kernels_cpu01.dat blink_dc_cpu1.dat  F2837xD_usb_flash_kernels_cpu02.dat blink_dc_cpu2.dat

    Manufacturer: Texas Instruments
    Product ID: TMS320F28x7x USB Boot Loader
    Serial number: 2

    Sending 17166 bytes of data from file F2837xD_usb_flash_kernels_cpu01.dat... done!
    17166 out of 17166 bytes sent
    Success!
    Manufacturer: Texas Instruments
    Product ID: TMS320F2837xD USB Boot Loader
    Serial number: 2

    Sending 9268 bytes of data from file blink_dc_cpu1.dat...
    Error sending bulk transfer: 0x0079
    256 out of 9268 bytes sent
    USB operation failed!
    Since firmware upgrade with the binaries built by us was failing , we have tried with the binaries you have shared.

    from  the above thread we have downloaded dual2.zip and we used binaries from this and it worked.So here my query is that do we need to add anything in the project properties in usb_flash_kernels ? or Are we missing anything?

    Thanks,

    pavani.

  • Hi Pavani,

    I will be unable to debug this for you specifically. If you provide more details and start the debug process and provide me updates, then I will be better able to assist you.

    To help with debug, you can try to load the cpu2 kernel and run it with CCS and then load the CPU2 flash application to it using the PC tool. Then you can see what the device is doing.

    However, you are unable to flash the CPU1 image, so you need to start debugging there. Start with this, and then you can post here again with what you find.

    sal