关于 AT91SAM7x256/512中写Flash的问题
AT91SAM7x256/512,在写Flash时,对其发出编程命令后AT91C_BASE_MC->MC_FCR=AT91C_MC_CORRECT_KEY|AT91C_MC_FCMD_START_PROG|(AT91C_MC_PAGEN&(page<<8));
在等待Flash Ready Status时,一直跳不出循环,即FLASH一直没有准备好接收下一条命令
void AT91F_Flash_Ready(void)
{
unsigned int status;
do {
status = AT91C_BASE_MC->MC_FSR;
}
while ((status & AT91C_MC_FRDY) == 0);
}
注:同一批硬件,有的板子没这个问题,有的存在这一现象。如果不写Flash,硬件是没问题的。
请问哪位大虾有遇到类似的问题,请指点。 问题找到了,在技术文档中,在寄存器MC_FMR中关于FMCN有这样两句话:
Before writing Non Volatile Memory bits (Lock bits, General Purpose NVM bit and Security bits), this field must be set to the number of Master Clock cycles in one microsecond. //修改Lock bit/NVM/Security bit时,设置为48
When writing the rest of the Flash, this field defines the number of Master Clock cycles in 1.5 microseconds. This number must be rounded up.//写Flash数据,设置为48*1.5
页:
[1]