cancel
Showing results for 
Search instead for 
Did you mean: 

F42x MCU flash program read operation gets wrong results.

ausera uirwaij
Associate III

my read flash reading is bellowing:

unsigned short * pAddr = (unsigned short * )​0x08004000;

unsigned short read_value=0;

for(int i=0;i<10;i++)

{

read_value = *(pAddr +i);

printf(.....,read_value );

}

---------------

I add read_value to watch window ,however, read_values are not corresponding to data in flash.

pAddr+i is 0x08004002 but not 0x08004001 in watch window when pAddr = 0x08004000 and i=1;

pAddr+i is 0x08004004 but not 0x08004002 when pAddr = 0x08004000 and i=2;

and the read_value =*(pAddr+i )​ results in read_value wrong data.

Why pAddr+i is not expected ?

1 REPLY 1

Not sure what the question is, and there's not enough information to unravel the riddle.

What I can tell you is that POINTERs advance by the size of the item they are referencing. The unsigned short in this example being 16-bits, and 2 bytes in size.

>>Why pAddr+i is not expected ?

​You're expecting the wrong thing

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..