cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431RB is part of examples EEPROM emulation

MM..1
Chief III

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 ?

3 REPLIES 3

@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 ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

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;

 

 

@mÆŽALLEm hmm i add unlock flash before init and start working. But now every boot MCU and EE_Init fill pages in emulated zone with zeroes. Can somebody explain 

/*********************************************************************/ /* Step 8: Perform dummy write '0' to get rid of potential */ /* instability of line value 0xFFFFFFFF consecutive to a */ /* reset during write here */ /* Only needed if recovery transfer did not occured */ /*********************************************************************/ if (recoverytransfer == 0U) { #ifdef DUALCORE_FLASH_SHARING status = VerifyPagesFullWriteVariable(0U, 0U, EE_INIT_WRITE); // The dummy write can be skipped in case pages are full // because in this case potential instability can not happen if ((status != EE_OK) && (status != EE_PAGE_FULL)) { return EE_WRITE_ERROR; } #else #ifdef FLASH_LINES_128B uint64_t to_write[2] = {0}; status = VerifyPagesFullWriteVariable(0U, to_write, EE_INIT_WRITE); #else status = VerifyPagesFullWriteVariable(0U, 0U); #endif // The dummy write can be skipped in case pages are full // because in this case potential instability can not happen if ((status != EE_OK) && (status != EE_PAGE_FULL)) { return EE_WRITE_ERROR; } #endif }
View more