I have a question on cc1120 official example. According to the cc1120_vchip_easy_link_rx.c I find that the runRX is using ISR-like mode to read data from FIFO, and the code is presented as below.
This receive process includes a series of operation. Only after I have reset the packetSemaphore to ISR_IDLE, and reset CC112X_SRX, can I start the next receive.
So my question is ,if there is another packet transmission before my reset, can I receive this packet correctly? Will that packet be stored into RXFIFO automatically and wait for my read or just be simply discarded?
// Wait for packet received interrupt if(packetSemaphore == ISR_ACTION_REQUIRED){ // Read number of bytes in rx fifo cc112xSpiReadReg(CC112X_NUM_RXBYTES, &rxBytes, 1); // Check that we have bytes in fifo if(rxBytes != 0){ // Read marcstate to check for RX FIFO error cc112xSpiReadReg(CC112X_MARCSTATE, &marcStatus, 1); // Mask out marcstate bits and check if we have a RX FIFO error if((marcStatus & 0x1F) == RX_FIFO_ERROR){ // Flush RX Fifo trxSpiCmdStrobe(CC112X_SFRX); } else{ // Read n bytes from rx fifo cc112xSpiReadRxFifo(rxBuffer, rxBytes); // 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++; /**************************************/ UART_Printf(rxBuffer,rxBytes); /**************************************/ halLedToggle(LED1); } } } // Reset packet semaphore packetSemaphore = ISR_IDLE; // Set radio back in RX trxSpiCmdStrobe(CC112X_SRX); }