初始化ST25RU3993时发现中断初始化有点异常,不是每一次都能产生FIFO中断,debug时,RST调试两三次才能产生一次fifo中断。不知道问题在哪
注:
STM32F405+ST25RU3993,80M主频,使用的是EVEL的代码移植的。
//读取版本
st25RU3993SingleRead(ST25RU3993_REG_DEVICEVERSION,&myBuf[0]);
if(myBuf[0] != 0x61)
{
return 1;
}
//晶体振荡器稳定
st25RU3993SingleRead(ST25RU3993_REG_AGCANDSTATUS,&myBuf[0]);
if((myBuf[0]&0x01) != 0x01)
{
return 2;
}
//检查SPI连接
myBuf[0] = 0x55;
myBuf[1] = 0xAA;
myBuf[2] = 0xFF;
myBuf[3] = 0x00;
for(i=0;i<4;i++)
st25RU3993SingleWrite(ST25RU3993_REG_MODULATORCONTROL1+i, myBuf[i]);
memset(myBuf, 0x33, sizeof(myBuf));
for(i=0;i<4;i++)
st25RU3993SingleRead(ST25RU3993_REG_MODULATORCONTROL1+i,&myBuf[i]);
if((myBuf[0]!=0x55) ||
(myBuf[1]!=0xAA) ||
(myBuf[2]!=0xFF) ||
(myBuf[3]!=0x00))
{
return 3; // data bus interface pins not working ----ok
}
// //检查外部中断是否正常
st25RU3993CLearIrqReg();
st25RU3993SingleWrite(ST25RU3993_REG_IRQMASK1, 0x20);//FIFO中断使能
// // set up 48Byte transmission, but we supply less, therefore a fifo underflow IRQ is produced
st25RU3993SingleWrite(ST25RU3993_REG_TXLENGTHUP, 0x03);
st25RU3993SingleCommand(ST25RU3993_CMD_TRANSMCRC);
st25RU3993Con
tinuousWrite(ST25RU3993_REG_FIFO,myBuf,4);
st25RU3993ContinuousWrite(ST25RU3993_REG_FIFO,myBuf,4);
st25RU3993ContinuousWrite(ST25RU3993_REG_FIFO,myBuf,4);
st25RU3993ContinuousWrite(ST25RU3993_REG_FIFO,myBuf,4);
st25RU3993ContinuousWrite(ST25RU3993_REG_FIFO,myBuf,4);
st25RU3993ContinuousWrite(ST25RU3993_REG_FIFO,myBuf,4);
st25RU3993WaitForResponse(RESP_FIFO);
if(!(st25RU3993GetResponse() & RESP_FIFO))
{
return 4;
}
st25RU3993ClrResponse();
st25RU3993SingleCommand(ST25RU3993_CMD_HOP_TO_MAIN_FREQUENCY);