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.

read content of flash address

Other Parts Discussed in Thread: UNIFLASH

Hello,

I need to read the content of a FLASH address. I want to verify that this sector is erased or not. I try with this code

if( (Uint16*)0x337FFE == 0xFFFF){
...
}

and the compiler returns me #43 operand types are incompatible ("Uint16 *" and "unsigned int"). How I can to do that? thanks!!

  • Hi Pablo,

    Why not try Erase function in FLASH API?  If Erase function succeeds STATUS_SUCCESS is returned.

    Do check and let me know whether this solves your query.

    Regards,

    Gautam

  • Hello Gautam!

    I want to know if there is any program in flash. Maybe the FLASH is not erased because is the first time that this DSP is used, and the program is not loaded yet. I only want to read the content of any FLASH address.

    In the watch window of code composer I can see the value of this position writting *0x30FFFF.

    Thanks!

  • Pablo Trujillo said:
    I want to know if there is any program in flash.

    Here are few steps you can follow using CCS Uniflash then:

    1. Assume you've programmed 100 boards and now you need to verify whether the boards are really programmed or not.

    2. Keep your out file ready, all you need to do is Open CCS Uniflash and use the Verify function. Load the out file and it will automatically verify. You can see whether the same code is present or different/no code etc....

    Pablo Trujillo said:

    Maybe the FLASH is not erased because is the first time that this DSP is used, and the program is not loaded yet. I only want to read the content of any FLASH address.

    Flash is always in the erased state when it arrives from factory.

    Pablo Trujillo said:
    In the watch window of code composer I can see the value of this position writting *0x30FFFF.

    Unless you go to debug window how can you check the watch window contents ? Also, to get into debugging you need to program the mcu.

    Regards,

    Gautam

  • hello!,

    Thanks for recomend me the CCS Uniflash, I didn't know this program. For my issue, I will use the verify function, for compare the content of an address of Flash with 0xFFFF, if the function returns me STATUS_SUCCESS, this means that the flash is erase, in other case, there is any program loaded.


    Greetings!

  • That's Great, Pablo!

    Goodluck & Regards,

    Gautam

  • Looks like you've found another solution, but an answer to your original question might be helpful in the future.

    The reason for the error is that you're only casting 0x337FFE to a pointer type. You also need to dereference the pointer by putting an asterisk in front, like this:

    if (*(Uint16 *)0x337FFE == 0xFFFF) {

    This is equivalent to:

    Uint16 *flashAddr = (Uint16 *)0x337FFE;
    if (*flashAddr == 0xFFFF) {

    Another way to do this is to use array notation:

    Uint16 *flashAddr = (Uint16 *)0x337FFE;
    if (flashAddr[0] == 0xFFFF) {

    if ( ((Uint16 *)0x337FFE)[0] == 0xFFFF) {   //Same thing without a variable

  • Hello Adam!

    Your code works perfectly!! Thanks!!

    Greetings!