2010-12-07 04:50 AM
Error 42004 when writing to data flash?
2011-05-17 06:11 AM
Hi,
if your application needs a block (128 bytes) to be programmed very quickly (about 4 ms), you need to copy flash functions in RAM, as specified in FWLIB examples. Otherwise you can program a block from eeprom (without loading functions in RAM) writing consecutively 128 bytes without setting any FLASH->CR2 bit. In this latest case the time to program a block is about (128 x 4) ms.
P.S. In the firs case using FWLIB example remember to set in the linker TAB of STVD the E_W_ROUTs segment as specified in the attached picture.
brazov2
2011-05-17 06:11 AM
> you need to copy flash functions in RAM, as specified in FWLIB examples.
> P.S. In the firs case using FWLIB example remember to set in the linker TAB
> of STVD the E_W_ROUTs segment as specified in the attached picture.
Thanks brazov2,
For some reason I interpreted the documentation to mean that copying the flash write functions to RAM was only necessary when programming the application flash area, not the data flash. Now that I read that paragraph of PM0051 more carefully, this makes perfect sense. I will confirm if this works shortly.
-helyx
2011-05-17 06:11 AM
I have confirmed it. The problem was that I was writing to data flash from a function that was located in program flash.
The fix in my case (Raisonance compiler) was to add the ''inram'' keyword to the end of the function declaration:
void FLASH_ProgramBlock(u16 BlockNum, FLASH_MemType_TypeDef MemType, FLASH_ProgramMode_TypeDef ProgMode, u8 *Buffer) inram
{
...
}
Thank you so much! I was really pulling my hair out on that one.