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.

Sys/Bios Bootloader

Other Parts Discussed in Thread: TMS320F28335

I have a system running SYS/BIOS on the TMS320F28335.  I made a bootloader for this which resides in Sector A while the main code is allocated to sectors B to H.  All seems to work fine until I start a sequence that triggers a series of interrupt.  When I do this the watchdog is triggered and the system resets.  This does not happen when I run without the bootloader. 

My process for loading the code is as follows:

1)      Compile software to get .out file

2)      Use the Hex2000 utility to convert the file to hex

3)      Use custom utility to convert the hex file to a mirror image of the flash, stripping out what is not in sectors B to H.  In this case this is just the reset vector which is already set to run the bootloader.  The bootloader will run the _C_INT00 when it want to start the main code.

4)      Bootloader loads the code into some external RAM and then erases sectors B to H and copy the data to the program flash (using the TI API function).

My first though was that the interrupt vectors where not be copied correctly, but I checked them with and without the bootloader and they are all the same.  Plus I think have a bad vector table would cause major issue with SYS/BIOS running.

Kind of stumped at this point, what have I missed?

  • After some more digging the issue appears to be with the DMA.  Part of the sequence that I am triggering includes a DMA transfer from the ADC.  If I disable this, all works as expected.


    Ed

     

  • Hi Ed,

    If I understand correctly, you are placing the bootloader code in Flash SECTOR A and placing rest of the SYS/BIOS code in Flash SECTOR B to H. If this is correct, then I did not understand why are you erasing Flash SECTORS B to H in step4 ?

    Are you connected to the debugger when you test your bootloader ? If yes, then can you try adding a breakpoint in one of the interrupt hadlers to see if the interrupt is getting triggered ? The PIE interrupt vector table is at 0xD00 so you can have a look at that address in the Memory Viewer to make sure the interrupt vector table is correct.

    Best,

    Ashish

  • Ashish,

    Correct the bootload is in sector A.  I erase the sectors B to H whe I need to load new main firmware.  In most case the bootloader would not do this, ti would just run the main program (_c_int00). 

    I have confirmed there are no issues with the vectors as I compared them with and without bootloader and they are the same. 

    From what I have found so far it appears released to a DMA transfer that I am doing.

    Ed

     

  • Ashish,

    I have some more information that I think will help narrow this issue down:

    1)      In both case (with and without bootloader),  the main program, is contained in Sectors H and G and, Sectors B to F are blank.

    2)      In both cases, the data in sector G and H (the main program) is identical except for the very first word.  When I use the bootloader this is a checksum that I use to verify that there is a good program present.  When I don’t use the bootloader this value is blank (0xffff).

    By my mind this only leaves two possibilities, although I’m sure there is something I’m missing:

    a)      There is something in sector A that the main program expects that is not there.  This does not appear to be the case as the only thing that my conversion utility strips out from sector A is 2 words from 0x33fff6 which is the boot to flash entry point which I need to use for the bootloader.

    b)      There is a problem with the way I’m starting the main program.

    Does that make sense to you?

    Ed

  • Slowly getting closer to the answer for this.  I found that the reset happen when I try to start ADC sequencer #2.  Also I’ve found that none of the ADC readings are working when I’m running with the bootloader.

    Ed

     

  • I found the issue.  I had started the bootloader from one of the code composer example projects which had the ADC initialized.  In this initialization it was enabling INT1.6 (ADCINT) which I don’t use in the main code (I use the sequence interrupts).  Removing this initialization fixed the issue.

    Ed

  • Hi Ed

    I am doing something similar same processor. are you aware the flash sectors are paired ie the bootloader will be in sector A and H?

     

    Mark

  • Mark,

    I don't think your statement is correct.  I have my bootloader working and it erases Sector H indepentantly of sector A. 

    What have you seen that brings you to this conclusion?

    Ed

  • Ed

    The FLASH API example code has comment where it says to erase both A&H for starters. I was hoping TI would chime in on this as an engineer who is no longer here at work also claimed that one sector might become wore out or corrupt if pairing was not observed. all TI c2000 flash devices use pairing of sectors

    Of couse if your boot loader code never got bigger than one sector and you lived in A and erased H you wouldnt see an issue

    I was just trying to be helpful and at the same time get some affirmation for both of us from TI on the proper procedure maybe David Foley of TI  can chime in

    Take a look at this

    http://e2e.ti.com/support/microcontrollers/c2000/f/171/p/111828/698790.aspx

  • Mark,

    I see what you mean now. This is very interesting. The danger if I understand this correctly is leaving one of the paired sectors in depletion mode, which should only happen if we have a power loss during an erase.  Correct?  

    The best way to avoid this issue that I can see is to avoid using Sector H if you use sector A for the bootloader. 

    The other thing that can be done is to minimize the chance of a power loss during the erase.  Depending on the system this may be hard to do.

    Thanks for pointing this out.

    Ed

  • Hi Ed

    Yes we reserved 1/4 ( 2 sectors for the boot) which makes our app limited to 6 sectors

    I was hoping we could have TI comment on this here (-:

    It would be nice to know if there are any other issues besides the power loss issue that may cause problems

    Originally I was told internally at work  that flash wear out was an issue if you did not erase pairs but I have no documentation to support this

    Be nice to to know if this is false

    that way if we need the last sector later for the app we understand the risk. Even using CAN to load the app in the loader it should be easy to keep the boot loader size to one sector 

  • mark lazarewicz1 said:

    Hi Ed

    Yes we reserved 1/4 ( 2 sectors for the boot) which makes our app limited to 6 sectors

    I was hoping we could have TI comment on this here (-:

    It would be nice to know if there are any other issues besides the power loss issue that may cause problems

    Originally I was told internally at work  that flash wear out was an issue if you did not erase pairs but I have no documentation to support this

    Be nice to to know if this is false

    that way if we need the last sector later for the app we understand the risk. Even using CAN to load the app in the loader it should be easy to keep the boot loader size to one sector 

    Hi Mark,

    The trigger for depletion is the interruption of a flash erase operation prior to completion.  This leaves the sector in an over-erased state.  A common root cause is power interruption but strictly speaking, anything that halts the CPU during erase could potentially result in flash sector depletion.

    To my understanding, the same "risk" of data reliability applies to wear-out as it does to depletion since the flash sectors are balanced.