Skip to main content
Graduate II
April 3, 2025
Question

STM32G431RB is part of examples EEPROM emulation

  • April 3, 2025
  • 1 reply
  • 407 views

I try run on 431CB and have issues. EE_Init return error. 

Work this X-Cube-EEPROM realy on CB or only on RB ??? Howto correct ?

    This topic has been closed for replies.

    1 reply

    Super User
    April 3, 2025

    @MM..1 wrote:

    I try run on 431CB and have issues. EE_Init return error. 


    So have you, eg, stepped in the debugger to find what causes that error?

     


    @MM..1 wrote:

    Work this X-Cube-EEPROM realy on CB or only on RB ??? 


    The only difference between Cx and Rx is the number of package pins:

    AndrewNeil_0-1743694056789.png

     

    so that shouldn't have any effect on the internal operation

     


    @MM..1 wrote:

    Howto correct ?


    First step, as always, is to find what's actually going wrong ...

    MM..1Author
    Graduate II
    April 3, 2025

    MM1_2-1743699975101.png

     

    HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
    {
     /* Wait for the FLASH operation to complete by polling on BUSY flag to be reset.
     Even if the FLASH operation fails, the BUSY flag will be reset and an error
     flag will be set */
    
     uint32_t tickstart = HAL_GetTick();
     uint32_t error;
    
     while (__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY))
     {
     if ((HAL_GetTick() - tickstart) > Timeout)
     {
     return HAL_TIMEOUT;
     }
     }
    
     /* Check FLASH operation error flags */
     error = (FLASH->SR & FLASH_FLAG_SR_ERRORS);
     if (error != 0u)
     {
     /* Save the error code */
     pFlash.ErrorCode |= error;
    
     /* Clear error programming flags */
     __HAL_FLASH_CLEAR_FLAG(error);
    
     return HAL_ERROR;

    here is error and flag set is 

    MM1_0-1743699838979.png

    MM1_1-1743699871394.png

     case STATE_PAGE_ACTIVE:
     {
     /* Set new Page status to STATE_PAGE_ACTIVE status */
     if (FI_WriteDoubleWord(header2, EE_PAGESTAT_ACTIVE) != HAL_OK)
     {
     return EE_WRITE_ERROR;
     }
     ubCurrentActivePage = Page;
     }
     break;