IAP function to write into flash returns always 2

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IAP function to write into flash returns always 2

ソリューションへジャンプ
578件の閲覧回数
juanabelaira
Contributor III

I want to write some data into a specific, not used by code, area of flash.

I'm using the functions included in the LpcOpen library v2.20,  Chip_IAP_PreSectorForReadWrite, Chip_IAP_EraseSector and Chip_IAP_CopyRamToFlash.

I can prepare and erase sectors, but when copying data into flash it always returns 2 and data is not written (checked that)

Yes, I have interrupts disabled

I'm working on LPC 1519

The offending line is:

while( 0 != Chip_IAP_CopyRamToFlash((uint32_t)0x00020000, (uint32_t *)UpBuffer, 0x400) );

And UpBuffer is (for test purposes) defined and set up as:

static uint8_t UpBuffer[1024];

for(j=0; j<0x400; j++) UpBuffer[j] = (uint8_t)j;

Any ideas?

1 解決策
410件の閲覧回数
juanabelaira
Contributor III

Solved... The return code was '2'. I read somewhere that this means busy but it's 'Source Address not in word boundary'

My source address was, unfortunately, an int8 array re-cast as int32.

After using a proper int32 array, everything is fine.

元の投稿で解決策を見る

1 返信
411件の閲覧回数
juanabelaira
Contributor III

Solved... The return code was '2'. I read somewhere that this means busy but it's 'Source Address not in word boundary'

My source address was, unfortunately, an int8 array re-cast as int32.

After using a proper int32 array, everything is fine.