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.

CCS/TMS320F28035: Trying to program application into flash using f2803x_flash_kernel example

Part Number: TMS320F28035


Tool/software: Code Composer Studio

So here's what I'm trying to do.

I have a customer who wants to be able to write a new standalone application to flash via CAN.  I have taken the f2803x_flash_kernel example and modified it just a bit for CAN support.  I have also configured my eval board to boot into CAN_boot mode.

I am able to boot into CAN_boot mode and write my modified flash kernel to RAM (I think).  I have verified this using hardware breakpoints.  However, I am unable to write the standalone application to flash.  I know the application works because it's one I've been using just fine and it programs just fine to flash via JTAG.  Starting with a good application in flash (written via JTAG) and while observing flash memory via the memory browser in code composer, it seems the flash memory is being erased ok by the flash kernel, but as CAN data bytes are being sent, the flash memory bytes cycle back and forth between 0x0000 and 0xFFFF rather erratically as far as I can tell.  Flash is never written with any meaningful data.  When the CAN transmission ends, all Flash memory is 0xFFFF.  My CAN data transmission was created using hex2000 in combination with a script I wrote to construct the sequence of 2 bytes CAN messages.  I fairly confident I'm doing this correctly as I can successfully write both the flash kernel and an application built for RAM into RAM via CAN.  I just can't seem to write to flash using the flash kernel.

Any help I can get would be great.  I can't find anything wrong in my modified flash kernel example.  I have commented out the InitPll call in the flash kernel as I wanted to keep everything the same as the boot rom set it up.

EDIT:  So I have now have two issues.

1) I've discovered that the flash erase works just fine, but it takes a while and the CopyData seems to just go on trying to program flash while it's being erased.  If I send the first sequence of CAN Data just up to the first block size, then wait until the flash memory is erased, then send the remaining CAN data, it seems to write to flash just fine.  Is this a known limitation?  You can't send the actual write data via CAN until you know the flash is erased?

2) Even though it seems my application wrote to flash just fine, when it boot to flash it does not run the application.  I can't tell what's it's doing.  I've compared the first several dozen words in flash memory after being written by my kernel vs being written by code composer via JTAG and they match so I assumed the flash memory was written correctly.  Perhaps I need to check it all?

EDIT2: Another clue, when I program via my CAN flash kernel, the flash entry point (0x3F7FF6 - 0x3F 7FF7) contains 0xFFFF.  But when I program via code composer JTAG, that location contains a valid value (0x007E and 0x88B0) which seems strange to me.  I guess I'm not sure what that value means.  I figured it would contain the entry point of my flash application.

EDIT3: Hmm, it seems my CAN traffic does have the commands to write to that spot, it just.....didn't I guess.

02 00
3F 00
F6 7F
7E 00
B0 88

EDIT4: So if I change my CAN transmission so it writes to 0x3F7FF6 first, it writes to it just fine.  But if send my entire application, it seems it's "giving up" somewhere in the middle as a bunch of the last addresses to be written to are just 0xFFFF.  I need to troubleshoot the CopyData function as it doesn't seem to work correctly after some time.

EDIT5: it works!! Unfortunately, to get it to work, I had to slow down my CAN transmission from 10 ms to 100 ms.  I'm not so sure why the flash kernel running out of RAM isn't able to keep up with 10 ms.  Also, at 100 ms flashing over CAN simply takes too long.  I need to figure out why it needs to be so slow.  Also, there's still the issue of having to wait for an unknown amount of time for the flash to erase before you can send the actual data to write.

I have attached my modified flash kernel project.

f2803x_flash_kernel.zip

  • Hi Adam,

    I have the same interest about flashing device via CAN. The modified flash kernel project you uploaded, is also similar to what i'm thinking to solve the topic.
    However, I don't understand some points:
    1. How do you configure the device to boot into CAN_boot mode? is it by modifying the OTP? so far, my understanding is OTP can be programmed once, so no chance to boot from flash after OTP is configured to CAN_boot.
    2. what is the PC tool/software you use to load the application? is it custom software, or modified version of serial_flash_programmer.exe from TI, or third party's?

    I hope somebody from TI can help you to find the solution.

    Cheers
    Luiz
  • 1) Yes, that's how I've done it so far.  I've modified OTP.  Yes, it is one time programmable.  I'm still very much in the R&D phase so I just wanted to get something working for now.

    2) I've been loading the application over CAN by sending 2 bytes at a time.  The .out file must first be converted to serial transmission bytes via hex2000 using the following command.  hex2000 <filename.out> -boot -gpio8 -a