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: Programming TMS320F28379D Microcontroller Through CAN

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hello,

I would like to have both the functionality to run the TMS320F28379D microcontroller from FLASH and to program the microcontroller over CAN.  I had a few questions about this:

1.  Is this possible to do without needing to develop a custom bootloader?

2.  Is it correct that for both running from FLASH and programming via CAN I should have GPIO72 and GPIO84 set to high?  (I'm basing this on Table 9-14 Device Boot Mode on page 197 of the datasheet where I assume we would want to be in "Get Mode" for both operations, correct?)

3.  Based on Table 4-8 of the technical reference manual, I see that by default flash boot occurs when in "Get mode" and that "CAN Boot 0" occurs when the BMODE bit field in the BOOTCTRL register is set to 0x07.  Since BMODE is software controlled rather than hardware controlled, how can I tell the MCU whether to boot from flash or boot from CAN?  (I will usually be booting from flash, but there will almost certainly be times I need to reprogram the MCU through CAN.)

4.  If I set BMODE = 0x07, will there be any timeout that will occur where, if no CAN signal is received, the MCU is then booted from flash?

Thanks,

Kevin

 

Thanks,

Kevin

  • Kevin

    1. No, you'll need to put a custom bootloader in flash. The code for the ROM bootloaders is in C2000Ware for your reference.

    2. Yes, both pins high will get you flash boot mode.

    3. These boot values are going into OTP and therefore can only be set once. You can leave it unprogrammed for flash boot, but once you program it to CAN boot, GetMode will always run the CAN bootloader. 

    4. There is no timeout in the CAN bootloader. If you have a CAN host that sends incorrect key, then it will boot to flash. However, if you don't send anything, it will never timeout and be stuck in the CAN bootloader.

    Best regards

    Chris

  • Chris,

    Thanks for your reply.  I've never done a custom bootloader before.  With a custom bootloader, will it be possible to use one of the GPIOs to tell the MCU whether to boot from flash or boot from CAN?

    Thanks,

    Kevin

  • Kevin,

    Yes, that is a possibility. Basically, it boils down to this: You always need to boot to flash. In your application code, you could wait for a specific data pattern from the CAN bus. Reception of this data signals that flash programming is warranted. You could then branch to the CAN boot-loader in the ROM itself. Or you could make that decision based on the state of the GPIO pin, access to which may not always be available in applications. 

  • Hareesh,

    Thanks for your reply.  For our application, we will sometimes not have anything connected to the CAN bus.  In that case, we want to be able to be able to run the program stored in flash. 

    Therefore I assume that the first approach you mentioned ("you could wait for a specific data pattern from the CAN bus. Reception of this data signals that flash programming is warranted") would not be possible.

    Is there a way to boot from flash if no data is received from the CAN bus after a certain amount of time?

    Or is the only way to make the decision whether to boot from FLASH or CAN by using a GPIO (controlled via a toggle switch for example) ?

    Thanks,

    Kevin

  • Therefore I assume that the first approach you mentioned ("you could wait for a specific data pattern from the CAN bus. Reception of this data signals that flash programming is warranted") would not be possible.

     

    The application waits for, say, 2 seconds for this data pattern. If the pattern is not received, it proceeds with the regular application. If such waiting is not practical, yes the GPIO method would be a solution. 

    Is there a way to boot from flash if no data is received from the CAN bus after a certain amount of time?

    As mentioned above, this needs to be handled in your application. The CAN boot-loader in boot-ROM does not support such an option.

  • Hareesh,

    Could you please clarify what you mean by "You could then branch to the CAN boot-loader in the ROM itself" ?  Can you do this in the application code rather than needing a custom bootloader?

    Is it possible without needing a custom bootloader to always boot from FLASH (by setting GPIO72 and GPIO84 to high in hardware) and then

    1.  If there is a specific data pattern from GPIOs, branch to the CAN boot-loader from my application code and re-program the MCU through CAN

    2.  If there is not that specific data pattern from GPIOs, run the existing program stored in flash  

    Thanks,

    Kevin

  • Could you please clarify what you mean by "You could then branch to the CAN boot-loader in the ROM itself" ?  Can you do this in the application code rather than needing a custom bootloader?

    Yes, you can branch to the CAN boot-loader in the boot-ROM from your application, if flash programming is warranted. I haven’t tried this myself but I don’t see a reason why this wouldn’t work.

    Is it possible without needing a custom bootloader to always boot from FLASH (by setting GPIO72 and GPIO84 to high in hardware) and then

    Yes.

    1.  If there is a specific data pattern from GPIOs, branch to the CAN boot-loader from my application code and re-program the MCU through CAN

    Yes.

    2.  If there is not that specific data pattern from GPIOs, run the existing program stored in flash 

    Yes. Did you really mean to say data pattern from GPIOs? I think you only need to read the level of a single GPIO pin to determine whether you would like to run the application or branch to the CAN bootloader in ROM to start pulling in data through the CAN port.

  • Hareesh,

    Thanks for your reply.  Is there any example in C2000Ware that demonstrates how to branch to the CAN-bootloader from within my application code?

    Thanks,

    Kevin

  • No such examples exists. You should be able to load the symbols in C:\ti\c2000\C2000Ware_3_03_00_00\libraries\boot_rom\f2837xd\revB\rom_sources\ccs_files\cpu01\Release to determine where to jump to.

    Note that the device state (PLL multiplier/divider etc) may not be exactly identical to what it would have been had you invoked the CAN boot-loader via boot-ROM.