AnsweredAssumed Answered

STM32L0 MCU EEPROM write

Question asked by kosakovski.evgeni on Jul 29, 2014
Latest reply on Sep 15, 2014 by Montassar BEN ROMDHANE
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.

Outcomes