2014-07-29 05:44 AM
Hi.
I use Nucleo board with STM32L0x3 MCU. There are special sequence for EEPROM TYPEPROGRAM_BYTE process?
I can write 4 bytes data (TYPEPROGRAM_WORD) but can't write 1 byte data (TYPEPROGRAM_BYTE):uint32_t
Address = 0;uint32_t
data32 = 0x12345678;uint8_t
ubData[10] = {0};// write 4 bytes example - work
while
(Address < FLASH_USER_END_ADDR){
if
(HAL_DATA_EEPROMEx_Program(TYPEPROGRAM_WORD, Address, data32) == HAL_OK){
Address = Address + 4;
}
else
{
Error_Handler();
}
i -= 4;
}
// write
1
byte example –does not work
while
(i > 0){
if
(HAL_DATA_EEPROMEx_Program(TYPEPROGRAM_BYTE, Address, ubData[i]) == HAL_OK){
Address = Address + 1;
}
else
{
Error_Handler();
}
i -= 1;
}
Thanks.2014-09-15 01:55 AM
Hi kosakovski.evgeni,
This API should work BYTES as it works with WORDS. The Address must be between DATA_EEPROM_BASE and DATA_EEPROM_END. Could you please activate the debug mode in order to check the validity of the input parameters by following the two steps below:#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf(''Wrong parameters value: file %s on line %d
'', file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif