Other Parts Discussed in Thread: MSP430FR5994
Dear Sirs:
I’ve been using the cc1200 in sniff mode. There is a glitch that I don’t understand. With code that
waits for gpio0 to go high (PKT_SYNC_RXTX)
waits for one byte to be received then reads it. This is our Message Type byte.
Waits for two more bytes to be read then reads these two bytes.
Well it should be through by now. Works fine on first reception after power up but on additional transmissions seems to hang up without even producing gpio0 (PKT_SYNC_RXTX).
Now if the code merely reads the no bytes in the fifo after this is completed, the unit does not hang up but will then read any number of transmission packets.
I have no idea what is causing this, but probably one of your experts will see easily what I’m doing wrong.
Thanks,
John Moore
The Receive Code is:
registerConfig(); //configure radio
// Calibrate radio
trxSpiCmdStrobe(CC120X_SCAL); //in TranscInit.c
// Wait for calibration to be done (radio back in IDLE state)
do {
cc120xSpiReadReg(CC120X_MARCSTATE, &marcState, 1);
} while (marcState != 0x41);
// Calibrate the RCOSC
calibrateRCOsc();
// Infinite loop
while( 1) //Receive loop
{
LED2(0); //turn off grn led
// Set radio in RX Sniff Mode
trxSpiCmdStrobe(CC120X_SWOR); //Start automatic RX polling sequence (Wake-on-Radio). TranscInit.c
//wait for packetsync_rxtx to arrive:
Sync= P1IN & 0x4; //check gpio0 for sync semaphore
while(Sync ==0)
Sync=P1IN & 0x4;
// Wait for packet to be received
//while(packetSemaphore != (1 ))//Rx Comes from irq but having probs with it
LED2(1) ; //turn on grn led
// Clear semaphore flag
packetSemaphore = ISR_IDLE; //0
while(rxBytes ==0)
cc120xSpiReadReg(CC120X_NUM_RXBYTES, &rxBytes, 1); //Read no bytes in Rx FIFO. subs.c
cc120xSpiReadRxFifo(rxBuffer, 1); //read first byte has type. in subs.c
MessType= rxBuffer[0];
//while( (GPIOPort) !=0)
// GPIOPort= P1IN & 0x4 ; //wait for GPIO0 to go low indicating end of packet
// Read all the bytes in the RX FIFO
while(rxBytes !=2)
cc120xSpiReadReg(CC120X_NUM_RXBYTES, &rxBytes, 1); //Read no bytes in Rx FIFO.
cc120xSpiReadRxFifo(rxBuffer, (rxBytes)); // already read first byte.
//The following statement is necessary to prevent ‘hanging’ on subsequent transmissions:
cc120xSpiReadReg(CC120X_NUM_RXBYTES, &rxBytes, 1); //test Read no bytes in Rx FIFO. subs.c