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/LAUNCHXL-F28069M: Flash API, Not Programming,f28069_can_flash_kernel example,

Part Number: LAUNCHXL-F28069M

Tool/software: Code Composer Studio

Hi, I have Issue with the following imported code.

C:\ti\c2000\C2000Ware_3_03_00_00\device_support\f2806x\examples\c28\f28069_can_flash_kernel

I'm using 

Code Composer Studio

Version: 8.2.0.00007

The flash API function for flashing flash gives me status code 12

Shared_boot.c Line: 208

status = Flash_Program((Uint16 *) BlockHeader.DestAddr,
                         (Uint16 *)progBuf, BlockHeader.BlockSize, &FlashStatus);

What I'm doing is running debugger and then sending a stream. I can see the code waiting for the bytes arriving on the can and then I have breakpoint triggered on one of the status values. 


I have tracked the meaning of the status code to the documentation. Here:

file:///C:/ti/c2000/C2000Ware_3_03_00_00/libraries/flash_api/f2806x/docs/Flash2806x_API_Quickstart.pdf

This might mean example code has problem with memory allocation. I might be wrong It could be a red herring.

I had some prior issues with the example code

htt ps://e2e.ti.com/support/tools/ccs/f/81/p/953837/3525807#3525807


where there was bug when importing project and I also posted about some sections warnings. It could be a red herring.

While the flashing function does not work in the debugger or through CAN stream.

I was able to make the erasing function work in debugger or through CAN stream by commenting out Flash Program block section. I have also modified arguments to the function for additional sectors erasure.

status = Flash_Erase((SECTORA | SECTORB | SECTORC | SECTORD|SECTORE|SECTORF|SECTORH),
                         &FlashStatus);

I confirmed the erasure with the memory browser at 0x3D8000. 

  • Jakub,

    Can you check the map file if any section is mapped to ROM or OTP or outside valid memory range?

    Thanks and regards,

    Vamsi

  • Hi, thanks for reply

    from the 

    www.ti.com/.../sprs698h.pdf

    I can see that SPRS698H


    and 

    My map file is here

    link.zip

    Maybe those? If you could please double check.

    RAMM0 starting at 0x50 not 0x40.

     RAMM0                 00000050   000003b0  000000ee  000002c2  RWIX

    .reset     0    003fffc0    00000002     DSECT
                      003fffc0    00000002     rts2800_fpu32.lib : boot28.obj (.reset)

    Maybe those (longshot)?:

    Are those ever updated? Wrong version? Is this problem related to those?

    abs   003ffebb  _Flash2806x_Program             
    abs   003ffebd  _Flash2806x_Erase   

  • Hi Jakub,

    The status code 12 you're receiving is 'STATUS_FAIL_ADDR_INVALID'. This should mean that the FlashAddr argument passed to the function below is incorrect, or that the length goes outside of flash/OTP.

    extern Uint16  Flash_Program(Uint16 *FlashAddr, Uint16 *BufAddr, Uint32 Length,
                                 FLASH_ST *FProgStatus);

    Is the location of BlockHeader.DestAddr always a location within flash? It seems to get incremented in the example code. Also should check the Length being passed to the function to make sure it's staying within flash

    Best,

    Kevin

  • Thanks for that Kevin
    Maybe information I told before is a red herring.

    I'm stuck. I'm unable to replicate the code 12 any more. Even tried replicating my steps and importing the project again.

    I have also noticed that the debbugger does not point to the CAN while loop for the stream any more unless I press pause. I don't think I had to do that previously. Here.

     

    When debugging  the program goes outside the debugging memory. I get to see this.

    When debugging and stepping and looking at disassembly. program seems to not reach the flash function at all any more and gets stuck somewhere

    So In that code the program gets to erase the flash and then It tries to get size in words of the first block. It appears to be wrong as BlockHeader.blocksize is 0.

    While look does not execute as result.

    Then it tries to load the entry address to flash. That means if successful or not then run from new or old flash? It goes through some push pop stacking to configure register for correct operation. Goes through some Itrap registers still dont know what that means. and then gets stuck in this loop here.


    This is an example code I shouldn't have any problems with it.

  • This is what I'm sending on CAN. I have a secondary CAN device that does sniffing. Here is what's happening on the can bus. I'm trying to send this when debugging.

  • 
    

    Upto a point all of the can reads store values in the memory as such. For example final address gets value stored in the

      

    just fine


    // // Get the size in words of the first block // BlockHeader.BlockSize = (*GetWordData)();

    ( What I can see) When this gets called it does not jump to the function. Would the debugger be able to keep up if its written as pointer to a function? Here obviously want to get a return value from can of 2 bytes but it gets stuck. I cant step anymore without suspending the debugger. If I suspendit I get message that is outside of memory.

    So questions?
    Is the declaration syntax wrong?
    Is the pointer address corrupted in some way?
    Is there alternative way to call functiona that might work?
    Is this debuggable problem or it cant be debugged with debugger?

  • Another question. Im using -M variant of the microprocessor and it has slight different things. Any chance that is the culprit?

  • Looks like the problem was me streaming while the program was performing erasing functions.
    I cant really see any interrupts or fifo in there. My assumptions were wrong on the features of the software.

    Single stepping helped alot.

    In my example the program buffer memory was at 0xa040.

    The status returned was 0. Finally!!

    I checked the flash memory and here it is.

    I need to make some changes to suit my application. 

    I'm going to test it abit more before I will mark it as resolved.

  • Hi Jakub,

    Happy to hear you got it working now. I think there may be a bug based on what you've found.

    I think the below change should be made to the CAN_Boot.c file for the (*GetWordData)(); line to work.

       //
       // Assign GetWordData to the CAN-A version of the
       // function. GetWordData is a pointer to a function.
       //
       GetWordData = &CAN_GetWordData;

    I'll make a note for this to be looked into further.

    Best,

    Kevin

  • Thanks Kevin,

    Sorry to confuse you but my code works without changing it also.

    I have deleted the part you are referring to to not confuse anyone else.

  • Hi Jakub,

    OK, no problem. Looking into it more it seems either way works within the C language.

    Best,

    Kevin