This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

使用CC1200相关问题

Expert 2137 points
Other Parts Discussed in Thread: CC1200

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);
}

这可能是怎么造成的啊?

  • 查一下buffer是否溢出,有没有overflow报错。同时建议你用PER test代码测试一下:www.ti.com/.../swrc219

  • 谢谢 Viki Shi您的回答,你说检测overflow报错是看 寄存器MARC_STATUS1 吗?还有何时查看buffer 溢出能仔细告诉吗?
    因为这个问题困扰了我很久。望您详细的回答。
  • 是 MODEM_STATUS1寄存器
    现在不确定是不是buffer overflow,你先查一下寄存器看看。假如确实是溢出---RXFIFO_OVERFLOW / RXFIFO_UNDERFLOW,有如下几个原因:
    1、CPU被其他事情占用,没有读出RXFIFO
    2、没有使用长度过滤,并且接收长度大于127字节的数据包(只有当程序设置为,等待全部数据包发送完成才进行读取时会出现该问题)
    3、每次接收到数据以后没有把RXFIFO中的所有数据读出来,留下了部分数据,最终导致溢出