Skip to content

Conversation

@Lance0724
Copy link

No description provided.

Fixed incorrect cache memory usage, and revised the interrupt handling logic.
@obra
Copy link
Contributor

obra commented Mar 29, 2025

What's the error you ran into in EEPROM commit?

@maxgerhardt
Copy link
Member

Mhm I do see #131 being open in reference to the FlashStorage.h which also relates back too EEPROM.h (?), but the changes here seem unrelated to it. They seem to be clearing up error codes in the flash controller after some operations.

Could you in short describe in what conditions this fixes an error for EEPROM as well as what buggy behavior this fixes in the I2C slave code?

@Lance0724
Copy link
Author

Hi,
Please forgive that my description in the PR was not accurate, and the commit message was rather brief.

My code roughly executes the following process:

// static EEPROMClass<EEPROM_EMULATION_SIZE> EEPROM;
#include <EEPROM.h>

EEPROM eeprom;
eeprom.begin();
eeprom.write(address, someValue);
eeprom.commit();
value = eeprom.read(address)

I can read the value that was just written.

However, after re-powering the MCU, the flash still contains the original value;
The commit did not actually write it.

I am using the MCU gd32e230f8v6.

@Lance0724
Copy link
Author

Lance0724 commented Mar 30, 2025

I'm not exactly sure of the specific cause.
This is the first time I've encountered an issue with an Arduino library, and it's also my first time using GD32.

I modified the code based on the following example:

void fmc_program(void)
{
    /* unlock the flash program/erase controller */
    fmc_unlock();

    address = FMC_WRITE_START_ADDR;
    /* program flash */
    while(address < FMC_WRITE_END_ADDR){
        fmc_word_program(address, data0);
        address += 4U;
        fmc_flag_clear(FMC_FLAG_END | FMC_FLAG_WPERR | FMC_FLAG_PGERR);
    }

    /* lock the main FMC after the program operation */
    fmc_lock();
}

This code was found in the GD32 demo.
gigadevice-firmware-and-docs-main\GD32E23x\GD32E23x_Firmware_Library_V1.1.2\Examples\FMC\Erase_Program\main.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants