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.

Trouble to erase / program flash F28335 SECTORA

Hi :

I am working on a program to do on-field firmware upgrading for my F28335. I encounter some trouble when it comes to erase SECTORA. My firmware program is contained in SECTORD and SECTORA so in order to update it I have to erase both sectors first. I use a Intel hex file as input and I have built the protocol to decode it.

Here is the steps I follow :

  1. Host computer triggers DSP firmware upgrade mode via SCI   -- works
  2. DSP copies Flash_API to SARAM (L3) and couple SCI functions as well to SARAM (L3) -- works
  3. Host Computer sends the command to erase SECTORA~H -- doesn't work   ; but it works if I erase B~H
  4. Based on my Intel Hex file, the Host Computer sends the command to download firmware in SECTORD first (it works if I erase B~H) and then SECTORA -- fail in any case : the API returns status 31 STATUS_FAIL_ZERO_BIT_ERROR, which makes sense since I have not been able to erase it earlier.

So my question is what are the requirements I have to follow if I want to erase SECTORA ?

I have look on the forum but could find the answer to my problem. Any suggestions/ ideas is welcome.

Thank you.

EDIT :

One additional data : I am monitoring the code with CCS and xds100v2 as jtag emulator.

Also here is my command for the hex generation :

"${CG_TOOL_HEX}" -i "${BuildArtifactFileName}" -o "${BuildArtifactFileBaseName}.hex" -order MS -romwidth 16 -fill 0xffff

  • Cedric,

    There is nothing special about flash sector A on F28335 device.  It should erase same as the other sectors B through H.  I suspect a hardware problem.  Have you tried erasing sector A using CCS?  Does it work?  Also, have you tried another board?

    This has nothing to do with your issue erasing sector A, but a side note: typically, you don't want to erase sector A when you do a field flash upgrade.  Reason is that if something goes wrong during reflashing (e.g., power lost), you cannot easily recover without JTAG since sector A contains the jump-to-flash bootmode target address.  You generally want to put a secondary bootloader in SectorA that contains the flash API algos, your serial port driver, and the reprogramming kernel.  Also, usually some checksum type of check that determines if a valid application is loaded into the other flash sectors.  The secondary bootloader runs after reset.  If a valid app exists in the flash, it branches to it.  If not, it enters flash reprogramming mode.  There's more information in this thread:

    http://e2e.ti.com/support/microcontrollers/c2000/f/171/p/257010/899722.aspx#899722

    Regards,

    David

  • Hi David,

    First of all, thanks a lot for taking the time to look at my problem, I appreciate working with you guys from TI. 

    There is nothing special about flash sector A on F28335 device.  It should erase same as the other sectors B through H.  I suspect a hardware problem.  Have you tried erasing sector A using CCS?  Does it work?  Also, have you tried another board?

    Yes, by using CCS I can erase eveything, I have checked the Debug options and all my sectors are checked for erasing. I have not tried another board. I can erase without problem sectors B to H. My thought that I may had to enter a password to be able to erase SECTORA or something like that. An option I have not tried is to exit the debug mode of CCS  before erasing sector A, maybe the debug mode is causing problem?

    You generally want to put a secondary bootloader in SectorA that contains the flash API algos, your serial port driver, and the reprogramming kernel

    OK. I will follow your advice, everything you mentioned here is in sector D but it makes more sense to have it to sector A ... as long as I am sure I don't want to update it later.

    That rises another question, does it mean that for an upgrading firmware, I have to ignore the part of my hex file related to sector A ?

     Also, usually some checksum type of check that determines if a valid application is loaded into the other flash sectors.  The secondary bootloader runs after reset.  If a valid app exists in the flash, it branches to it.  If not, it enters flash reprogramming mode. 

    I know we start talking about another subject but if I understand correctly you recommend me to have my checksum algorithm be part of my secondary bootloader (in SECTORA) and run at every boot-up to see if the code located in another sector?

  • Cedric,

    Cedric 40627 said:

    Yes, by using CCS I can erase eveything

    That suggests nothing is wrong with the device itself.  CCS uses the same flash APIs that you are using.  I guess I'd focus on SectorA.  Write a simple code project that you link to RAM (just use CCS to load it) and have it erase sector A only.  We need to figure out why you can't erase sector A.  Are you sure you have the clock setup correctly in the APIs?

     

    Cedric 40627 said:

    That rises another question, does it mean that for an upgrading firmware, I have to ignore the part of my hex file related to sector A ?

    You use two seperate projects.  One for the secondary bootloader, the other for your main app.  You only flash update the main app.  This is not linked to sector A, so you don't need to ignor anything in the hex file.

    Cedric 40627 said:

    I know we start talking about another subject but if I understand correctly you recommend me to have my checksum algorithm be part of my secondary bootloader (in SECTORA) and run at every boot-up to see if the code located in another sector?

     
    Exactly.  The secondary bootloader does a checksum on the other flash sectors to make sure the main app is valid.
     
    - David
  •  I guess I'd focus on SectorA.  Write a simple code project that you link to RAM (just use CCS to load it) and have it erase sector A only.  We need to figure out why you can't erase sector A.  Are you sure you have the clock setup correctly in the APIs?

    With my current project I have tried to erase only sectorA and same issue but I will follow your recommendation and create a new project. I will double also check my clock settings but I am pretty sure that it is configured correctly, otherwise why the other sectors would erase/program correctly ? Nonetheless I will check and keep you posted ( I don't have my computer right now). 

    You use two seperate projects.  One for the secondary bootloader, the other for your main app.  You only flash update the main app.  This is not linked to sector A, so you don't need to ignor anything in the hex file.

    Got it ! :) 

    Thanks for your help, I will keep you posted.