2021-02-08 07:59 AM
Hi everyone,
I'm doing tests with sigfox using the deboboad X-NUCLEO-S2868A2, and with the example everything works.
However in the final product I will not have an EEprom where to store the sigfox credentials (id and Pac) and therefore I would like to use the flash NVM to do this.
I tried to write in flash the NVM_BoardDataType structure with the fields filled in as follows:
NVM_BoardDataType boardData;
boardData.id = 0x12AA4812;
boardData.rcz = 1;
boardData.pac [0] = 0x00;
boardData.pac [1] = 0x12;
boardData.pac [2] = 0x0F;
boardData.pac [3] = 0x03;
boardData.pac [4] = 0xc9;
boardData.pac [5] = 0x22;
boardData.pac [6] = 0xc6;
boardData.pac [7] = 0xe9;
boardData.freqOffset = 0x02FAF2AA;
boardData.rssiOffset = 0;
boardData.lbtOffset = 0;
uint8_t * P_Data = (uint8_t *) & boardData;
NVM_Write ((uint32_t) 0x0800FF00, sizeof (NVM_BoardDataType), P_Data, NVM_WRITE_MODE_ERASE);
NVM_ConfigType config;
config.nvmType = NVM_TYPE_FLASH;
config.boardDataAddress = 0x0800FF00;
config.sfxDataAddress = 0x0800FF80;
config.messageSequenceNumber = 0;
P_Data = (uint8_t *) & config;
NVM_Write ((uint32_t) 0x0800FF80, sizeof (NVM_ConfigType), P_Data, NVM_WRITE_MODE_ERASE);
The data is saved in flash at the specified address, so I call the ST_Sigfox_Init (...)
In ST_Sigfox_Init (...) there are :
nvmConfig.nvmType = NVM_TYPE_FLASH;
nvmConfig.sfxDataAddress = (uint32_t) FLASH_USER_START_ADDR;
nvmConfig.boardDataAddress = (uint32_t) FLASH_BOARD_START_ADDR;
SetNVMInitial (& nvmConfig);
if (enc_utils_retrieve_data_from_flash (sfxConfig, UID_ADDRESS, UID_LEN)! = 0)
ret_err = ST_SFX_ERR_CREDENTIALS;
This last call always returns with ST_SFX_ERR_CREDENTIALS ...
What am I doing wrong ?
Should I write the data to flash in another way? Which ?
Do they need to be encrypted?
Thanks a lot to anyone who can help me!
2022-05-30 12:45 AM
Hello,
Did you resolve this issue ?