2012-09-12 02:25 AM
Dear friends,
I'm using the eeprom emulation STM32F2xx_AN3390_FW_V1.0.0 for saving the configuraiton. I make some test code to understand the source code, I can test with 3 varibles with address 0x5555, 0x6666, 0x7777. But after I increase NB_OF_VAR ((uint8_t)0x05) and my souce code testing below. I read the value of address 0x8888 and 0x9999 are always zeros. I was wondering that friends can give me a helpluint16_t VirtAddVarTab[NB_OF_VAR] = {0x5555, 0x6666, 0x7777, 0x8888, 0x9999};void EE_Test(void){ u8 buff[5]; /* Store 0x1000 values of Variable1 in EEPROM */ for (VarValue = 0x1000; VarValue <= 0x100F; VarValue++) { EE_WriteVariable(VirtAddVarTab[0], VarValue); } /* read the last stored variables data*/ EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), ''BYTE 1'', 1); x16_to_str(VarDataTab[0], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); /* Store 0x2000 values of Variable2 in EEPROM */ for (VarValue = 0x2000; VarValue <= 0x200F; VarValue++) { EE_WriteVariable(VirtAddVarTab[1], VarValue); } /* read the last stored variables data*/ EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]); EE_ReadVariable(VirtAddVarTab[1], &VarDataTab[1]); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), ''BYTE 1/2'', 1); x16_to_str(VarDataTab[0], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[1], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); /* Store 0x3000 values of Variable3 in EEPROM */ for (VarValue = 0x3000; VarValue <= 0x300F; VarValue++) { EE_WriteVariable(VirtAddVarTab[2], VarValue); } /* read the last stored variables data*/ EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]); EE_ReadVariable(VirtAddVarTab[1], &VarDataTab[1]); EE_ReadVariable(VirtAddVarTab[2], &VarDataTab[2]); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), ''BYTE 1/2/3'', 1); x16_to_str(VarDataTab[0], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[1], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[2], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); /* Store 0x4000 values of Variable3 in EEPROM */ for (VarValue = 0x1000; VarValue <= 0x100F; VarValue++) { EE_WriteVariable(VirtAddVarTab[3], VarValue); } uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), ''BYTE 1/2/3/4'', 1); x16_to_str(VarDataTab[0], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[1], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[2], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[3], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); /* Store 0x5000 values of Variable3 in EEPROM */ for (VarValue = 0x1000; VarValue <= 0x100F; VarValue++) { EE_WriteVariable(VirtAddVarTab[4], VarValue); } uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), ''BYTE 1/2/3/4/5'', 1); x16_to_str(VarDataTab[0], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[1], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[2], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[3], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1); x16_to_str(VarDataTab[4], buff); uart_tx_puts(EZ_HMI_COM, uart_tx_get_buf_ptr(EZ_HMI_COM), buff, 1);}2012-09-12 08:01 AM
I read the value of address 0x8888 and 0x9999 are always zeros.
Your supplied code does not read them back.2012-09-26 07:05 PM