问答

汇集网友智慧,解决技术难题

sumwms

TA的家园币:39  

  • GD32F103VET6 FMC 512KB flash,后256KB无法写入数据

    使用GD32F103VET6芯片进行flash读写,经过测试发现flash写操作只能在前256KB,在后256KB则无法进行写操作,查看手册针对这两块内存的区别在指令零等待或延时,但是对读写操作上会存在什么区分呢?擦除使用fmc_page_erase接口如下是操作demo:/***@description:EEPROMreaddata*@param:uint16_twrite_addr:EEPROMaddr(firstaddr:)*uint8_t*buffer:Temporarystoragecache[output]*uint16_tlength:len(unit:BYTE)*@return:success:0|fail:1*/staticintflash_write_word(uint32_twrite_addr,constuint32_t*buffer,uint16_tlength){uint16_ti=0;uint32_t*tempBuff=NULL;fmc_state_enumstate=FMC_PGERR;if(buffer==NULL||((write_addr%4)!=0)){return-1;}if((write_addr)<FLASH_STORE_BASE_ADDR||((write_addr+length*4)>=(FLASH_BASE_ADDR+FLASH_SECTOR_SIGLE_SIZE*FLASH_SECTOR_TOTAL_SIZE))){return-1;}tempBuff=(uint32_t*)buffer;fmc_unlock();__disable_irq();for(i=0;i<length;i++){fmc_flag_clear(FMC_FLAG_BANK0_END);fmc_flag_clear(FMC_FLAG_BANK0_WPERR);fmc_flag_clear(FMC_FLAG_BANK0_PGERR);state=fmc_word_program(write_addr+4*i,*(tempBuff+i));if(state!=FMC_READY){__enable_irq();fmc_lock();return-1;}}__enable_irq();fmc_lock();return0;}

    GD32 MCU fm gd32F103 flash TE

    2021-06-15 2