Hi everyone.
I'm making a bootloader for the GD32E103, and i can't write on memory, even using the libraries from gigadevice.
This is a simple code i made to test it.
int main(void) { SysTick_Config(SystemCoreClock / Systick_Frequency); NVIC_SetPriority(SysTick_IRQn, 2); Setup(); //just configuring ports, timers and others update = Decide_Update(); if(update) Update_Setup(); //Here is where i configure the fmc /* Infinite loop */ while (1) {;} } void Update_Setup(void) { fmc_prefetch_enable(); fmc_unlock(); fmc_program_width_set(FMC_PROG_W_32B); fmc_dbus_enable(); fmc_ibus_enable(); } void TIMER1_IRQHandler(void) { if(timer_interrupt_flag_get(TIMER1, TIMER_FLAG_UP) != RESET) { if(update) { stado = fmc_word_program(0x08004000, 0xaabbccdd); fmc_flag_clear(FMC_FLAG_END); } timer_interrupt_flag_clear(TIMER1,TIMER_FLAG_UP); } }
Don't getting any problem erasing the pages, or that seems, but when write, didn't change the memory bytes and didn't get any error in the fmc bytes.
I will apreciate so much some help, this is getting me mad.
Ty :)
Found the error.
fmc_program_width_set(FMC_PROG_W_32B); Sets '1' to the PGW bit of the WS register, and have to set a '0', i used FMC_PROG_W_64B instead to get a 32bit BW.
There is an error on the library.