?今天發(fā)現(xiàn)之前的之前工程師遺留的問題,他在usb中斷的時候調用了寫flash,這樣會容易出錯是嗎?正常情況下,中斷函數(shù)是不運行操作flash的。因為寫flash會進入安全模式,安全模式一般會關閉總中斷。想和原廠確認一下,是否usb中斷不能操作flash。謝謝
case UIS_TOKEN_OUT | 4:? ? ? ?
if( U_TOG_OK )
{
len = USB_RX_LEN;
UEP0_CTRL ^= bUEP_R_TOG;/* ·?×? */
UEP0_CTRL = UEP0_CTRL & ~ MASK_UEP_R_RES | UEP_R_RES_NAK;??
//state = 1;
//if(Ep0Buffer[64] == 0x05 && Ep0Buffer[65] == 0x01 && Ep0Buffer[66] == 0x01 && Ep0Buffer[67] == 0x00 && Ep0Buffer[68] == 0x08 && Ep0Buffer[69] == 0x05){
//state = 2;
//}else{
//state = 1;
//}
//if(Ep0Buffer[65] == 0x01){
//state = 2;
//}
if(Ep0Buffer[65] == 0x01){
memset(HIDData1,0,sizeof(HIDData1));//°?HIDData1??0
memcpy(HIDData1, &Ep0Buffer[66], Ep0Buffer[64] - 1);
WriteDataFlash(0, &HIDData1, sizeof(HIDData1));
}