cc1200 在使用的过程中 连续不断的收发数据 --cc1200会进入死机状态--工作电流变小
收发的处理函数在主函数中处理,发射和接收的管脚脉冲通过中断处理的,
while(1)
{
if(Flag_TX==1)
{
// USART1_SEND(0XB1);
// delay_ms(1);
// Write packet to TX FIFO
cc120xSpiWriteTxFifo(Tab_TxBuffer, (Count_TxBuffer+1));
// Strobe TX to send packet
trxSpiCmdStrobe(CC120X_STX);
Flag_Status=2; //·¢ËÍ״̬
// cc120xSpiReadReg(CC120X_MARCSTATE, &marcState, 1);
// UART4_SEND(marcState);
// Wait for interrupt that packet has been sent.(Assumes the GPIO connected to the radioRxTxISR function is set to GPIOx_CFG = 0x06)
while(PacketSemaphore != ISR_TX);
// Clear semaphore flag
PacketSemaphore = ISR_IDLE;
// Clear TX flag
Flag_TX = 0;
// trxSpiCmdStrobe(CC120X_SFTX); //Flush the TX FIFO buffer
// Set radio in RX
trxSpiCmdStrobe(CC120X_SRX);
Flag_Status=1;
// delay_us(40);
}
if(PacketSemaphore == ISR_RX) // Wait for packet received interrupt
{
// Read number of bytes in RX FIFO
cc120xSpiReadReg(CC120X_NUM_RXBYTES, &Count_RxBuffer, 1);
// Check that we have bytes in FIFO
if(Count_RxBuffer != 0)
{
// Read MARCSTATE to check for RX FIFO error
cc120xSpiReadReg(CC120X_MARCSTATE, &marcState, 1);
// Mask out MARCSTATE bits and check if we have a RX FIFO error
if((marcState & 0x1F) == RX_FIFO_ERROR)
{
// Flush RX FIFO
trxSpiCmdStrobe(CC120X_SFRX);
}
else
{
// Read n bytes from RX FIFO
cc120xSpiReadRxFifo(Tab_RxBuffer, Count_RxBuffer);
for(i=0;i<Count_RxBuffer;i++)
{
UART4_SEND(Tab_RxBuffer[i]);
}
read_temp = StatusByteAnalysis(Tab_RxBuffer[Count_RxBuffer-2],Tab_RxBuffer[Count_RxBuffer-1]);
UART4_SEND(read_temp>>8);
UART4_SEND(read_temp);
UART4_SEND(Count_RxBuffer);
// // Check CRC ok (CRC_OK: bit7 in second status byte)
// // This assumes status bytes are appended in RX_FIFO
// // (PKT_CFG1.APPEND_STATUS = 1)
// // If CRC is disabled the CRC_OK field will read 1
// if(rxBuffer[rxBytes - 1] & 0x80) {
// // Update packet counter
// packetCounter++;
// }
}
}
// trxSpiCmdStrobe(CC120X_SFRX); //Flush The Rx FIFO
trxSpiCmdStrobe(CC120X_SRX); // Set radio in RX
PacketSemaphore = ISR_IDLE;
// delay_us(40);
}
这可能是怎么造成的啊?