Bonjour,J'ai des difficultés pour enregistré un compteur en mémoire flash de donnée (0x100000).Mon compteur est "toti".je code : "erreur = R_FLASH_Write(toti , 0x101010, 0x4);"Au préalable je fait " erreur = R_FLASH_Open(); erreur = R_FLASH_Erase(FLASH_DF_BLOCK_64, 1);les commandes retournent toutes "FLASH_SUCCESS".Au reset "toti" est à "0" et est bien enregistré dans la mémoire flash.En suite "toti" est incrémenté.C'est à ce moment que cela ne va plus car la commande "flash write" utilise l'adresse de "toti" incrémenté et non pas la valeur de "toti" alors que j'affiche bien la valeur de "toti".J'ai essayé de fixer une adresse RAM pour "toti" (#pragma ADDRESS toti 0xA4000) et de remplacer "toti" par l'adresse "0x4000" dans l'instruction "flash write" mais la valeur de "toti" n'est pas à cette adresse. J'ai essayé d'autre adresse de la mémoire RAM sans plus de succes.Comment indiquer à la commande "flash write" que "toti" est une variable de donnée et non une adresse ?Merci à tous pour l'aide.Etienne
Hello,I have difficulty recording a counter in flash data memory (0x100000).My counter is "toti".I code: "error = R_FLASH_Write(toti, 0x101010, 0x4);"First I do "error = R_FLASH_Open(); error = R_FLASH_Erase(FLASH_DF_BLOCK_64, 1);the commands all return "FLASH_SUCCESS".On reset "toti" is at "0" and is well recorded in the flash memory.Then "toti" is incremented.This is when it goes wrong because the "flash write" command uses the address of the incremented "toti" and not the value of "toti" while I display the value of "toti".I tried to set a RAM address for "toti" (#pragma ADDRESS toti 0xA4000) and replace "toti" with the address "0x4000" in the "flash write" instruction but the value of "toti" is not at this address. I tried other RAM memory addresses without any more success.How to indicate to the "flash write" command that "toti" is a data variable and not an address?Thanks all for the help.Etienne
Per the FIT flash doc:
As such your code implementation, assuming the source variable is not an array:
error = R_FLASH_Write(uint32_t)&toti, DataFlashAddr, sizeof(toti));
I would offer this recommendation - for the type of frequent data that you want to update / store, you might consider the FIT VEE (Virtual EEPROM), instead of trying to manage the update storage yourself.
RX Family Virtual EEPROM Module Using Firmware Integration Technology
The VEE implements wear-leveling and provides protection against data-loss due to reset of power loss. It will require a little more in resources to use this but it should be worth the investment.
Merci pour la réponse, c'est OK.
Thanks for the reply, it's OK.