通过SWD协议给
STM32E103芯片烧写程序的时候发现,在烧写过程中,数据能发送出去(reveive_success_mark==1),读SR->FLASHBUSY也能置位,但是SR->FLASHEOP一直置位超时,跪求各位大神帮忙看一下是什么问题,感谢!!!
下面是出问题部分的代码:
reveive_success_mark=0;
nRF51_return_
timeout=0;
TIM3_ENABLE(); //开定时器3,共25ms超时
do
{
reveive_success_mark=swd_write_block(addr,Send_buffer,TransMaxLen);
if(nRF51_return_Timeout>NUMdelay)
{
TIM3_DISABLE();
return ERROR_TIME_HALT;
}
}while(!(reveive_success_mark==1));
TIM3_DISABLE();
Delay_n_ms(500);
/*判断是否忙*/
reveive_success_mark=0;
nRF51_return_Timeout=0;
TIM3_ENABLE(); //开定时器3,共25ms超时
do
{
reveive_success_mark=swd_read_word(FLASH_SR, val);
if(nRF51_return_Timeout>NUMdelay)
{
TIM3_DISABLE();
return ERROR_TIME_HALT;
}
}
while(!((reveive_success_mark==1) ((val FLASHBUSY)==FLASHREADY)));
TIM3_DISABLE();
Delay_n_ms(500);
/*判断是否成功操作*/
reveive_success_mark=0;
nRF51_return_Timeout=0;
TIM3_ENABLE(); //开定时器25ms
do
{
reveive_success_mark=swd_read_word(FLASH_SR, val);
if(nRF51_return_Timeout>NUMdelay)
{
TIM3_DISABLE();
return ERROR_TIME_HALT;
(每次都会因超时进入此地方,加长超时无效)
}
}
while(!((reveive_success_mark==1) ((val FLASHEOP)==FLASHEOP)));