I am trying to send one byte of data using the CC1101 and then put it back in sleep state. I have the following code set up to handle the calibration, transmission and sleep,
void send_data(void) { CSn = 0; while (SDI); SSPBUF = SIDLE; while(BF == 0); SSPBUF = SCAL; while (BF == 0); __delay_us (800); SSPBUF = 0x3F; //Single byte written to the TX FIFO while (BF == 0); SSPBUF = 0x04; //write data while (BF == 0); //wait for SPI buffer to empty SSPBUF = STX; while (BF == 0); __delay_us (4); SSPBUF = SPWD; while (BF == 0); CSn = 1; }
I can see something is being transmitted using a spectrum analyzer and the status bytes I see on the SPI lines for each command sent are always 0x0F (IDLE state and at least 15 bytes available) except at the SPWD command, the status changes to SETTLING state but still with at least 15 bytes available.
I followed the settings recommended in the SmartRF studio and believe the registers were all successfully configured. Am I missing a necessary delay somewhere or is there some other order the above commands need to be in?
Any guidance would be most appreciated!