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.

TMS570LS1224: CAN Bootloader - Application Example Code

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

I finally got back getting my application code to write the necessary "magic number" to memory to initiate a firmware update, and was able to get things working. Assuming the upload worked correctly, there should be a Blinky_FEE.zip file attached that contains a full project for a TMS570 Launchpad that alternates blinking the two on-board LEDs. If a CAN message with ID = 0x001 is sent with data = 0xFFA5A5A5A5, the "magic number" is overwritten and the board is reset, causing the bootloader to wait for a new image.

I will be using FEE in my application to hold state values between power cycles, so I added that to this project to ensure no conflicts with the F021 FAPI functions.I am using the FAPI functions, basically copied from the bootloader source and wrapped in example code from the "Advanced F021 Flash API Erase/Program Usage" application report (SPNA148).

Bank 7 sectors 1 and 2 are reserved for my state variables; I used sector 15 (0xF020 F000) for the magic number location to prevent interference.

I've been able to switch back and forth between the binary from this project and my actual application using the bootloader with no issues, and am very happy to finally get this working. However, I am concerned that I may be missing something that will come back to bite me later, so if anyone has time to look at `setMagicNumber()` in `bsp.c`, I'd appreciate it.

- Tom

8206.Blinky_FEE.zip

  • Hello Tom,

    Yes, you can store the magic work in sector 15 of bank 7. For each application update, the sector 15 of bank 7 must be erased twice:

    1. Application gets command (0xFFA5A5A5A5) from CAN for update, then application erases sector 15 and writes different magic-word to sector 15

    2. Bootloader updates the Application. After the application is successfully uploaded, the bootloader erases the sector 15 and writes the right magic-word to sector 15

    Another way you can try is to use 2nd FEE (for example sector 14 and sector 15) to store this magic number. The sector (14 or 15) won't be erased until it is full.

  • Hello,

    HalCoGen is able to generate FEE driver for 2 FEEs:

    1. select number of FEE

    2. Define number of blocks, and there locations (1st FEE or 2nd FEE)

    3. Select physical sectors for 1st FEE and 2nd FEE

  • Thanks for the feedback. All of the memory reads and writes in my application are working as I want them to, as noted in my last post.

    I am using FEE (two blocks) for the state variables I need to maintain between power cycles, and native F021 API calls for writing over the CAN update "magic number" since FEE writes don't always use the same memory location. I assume that is for wear leveling. I don't want to make any changes to the bootloader code, so I will continue to use the native F021 API for the magic number.

    I am using two CAN buses for redundancy, so at some point I will change the bootloader to use whichever bus the initial ping comes in on rather than the hard-coded CAN1 to cover a loss of that bus.

    Thanks again for the help!

    - Tom