Hi there,
I'm having Problems getting my CC1101 to work.
I am trying to set the Radio to TX state and to transmitt some data. When I issue the CC1101_STX Strobe, I see a power consumption of 28mA.
But if I am trying to put the CC1101 to Idle or CC1101_SXOFF Mode afterwards, it seems if the CC1101 does not execute the command. (On my oscilloscope I see the Command) but power consumption shows that the CC1101 stays in TX Mode.
Following my Settings by the smartRF Studio
before applying this configuration I am changing some values:
[c]
CC1101_Configuration.CC1101_RF_CONFIG.pktctrl0 = 0x01; //Var pack length - CRC dis - Normal Mode(FiFo for RX and TX)- disable white data //changed by ps//0x12
CC1101_Configuration.CC1101_RF_CONFIG.pktctrl1 = 0b00000100; // Preamble quality default- disable automatic flush of RX FIFO- When enabled, two status bytes will be appende- No address check
CC1101_Configuration.CC1101_RF_CONFIG.mcsm2 = 0x07; //The RX timeout 7 (111)Until end of packet
CC1101_Configuration.CC1101_RF_CONFIG.mcsm1 = 0b111110; // Selects CCA_MODE; Reflected in CCA signal - Stay in RX - 2 (10)Stay in TX (start sending preamble) //changed by PS // 0x30
CC1101_Init(&cc1101_interface,&CC1101_Configuration,&patable_config);
CC1101_strobe(&cc1101_interface,CC1101_SXOFF,registerbuffer,cc1101_strobe_mode_write);//put CC1101 to sleep mode
mSleep(10000);//wait 10 seconds
[\c]
Then I am calling my TX Test function:
[c]
void CC1101_TX_example(void * pvParameters){
pvParameters = pvParameters; // avoids warning: unused parameter 'pvParameters'
cc1101_interface_t *cc1101_interface =( cc1101_interface_t* )pvParameters;
u8_t registerbuffer[2];
u8_t teststring[20];// ="teststring";
teststring[0]= 9;
teststring[1]= 't';
teststring[2]= 'e';
teststring[3]='s';
teststring[4]='t';
teststring[5]='s';
teststring[6]='t';
teststring[7]='r';
teststring[8]='i';
teststring[9]='n';
teststring[10]='g';
CC1101_strobe(cc1101_interface,CC1101_SFSTXON,registerbuffer,cc1101_strobe_mode_write);//enable fast TX on
while (1) {
// code your main event loop here
CC1101_FIFO_write(cc1101_interface,teststring,11);
//CC1101_register_access(cc1101_interface,CC1101_TXFIFO, teststring,cc1101_access_mode_burst_write,10 );
CC1101_strobe(cc1101_interface,CC1101_STX,registerbuffer,cc1101_strobe_mode_write);//
uSleep(200);
}
}
[\c]
My FiFo Write Function looks like this:
[c]
cc1101_errorcode_e CC1101_FIFO_write(cc1101_interface_t * cc1101_interface, uint8_t *buffer, int amount){
Assert(cc1101_interface!=NULL,ec_NULL);
Assert(buffer!=NULL,ec_NULL);
u8_t addressbuffer [1];
cc1101_errorcode_e cc1101_errorcode =cc1101_OK;
u8_t txFiFo_freeSlots = 0 ;
addressbuffer[0] = CC1101_TXBYTES;
ttc_portClr(&cc1101_interface->NSS_Port);
if(waitforSO_low)while(ttc_portGet(&cc1101_interface->SO_Port)==1); //Wait for SO Pin to go low
cc1101_errorcode|=ttc_spi_send_raw(cc1101_interface->SPI_Index,addressbuffer,1); //send Address
if(readcurrentstatus) cc1101_errorcode|=ttc_spi_read_byte(cc1101_interface->SPI_Index,&cc1101_interface->current_CC1101_status, 100); //read Status
addressbuffer[0] = CC1101_dummy_byte;
cc1101_errorcode|=ttc_spi_send_raw(cc1101_interface->SPI_Index,addressbuffer,1); //send dummy
cc1101_errorcode|=ttc_spi_read_byte(cc1101_interface->SPI_Index,&txFiFo_freeSlots, 0); //read Data
addressbuffer[0] = CC1101_TXFIFO;
if(amount>1) addressbuffer[0]|=CC1101_BURST_Bit;
txFiFo_freeSlots= txFiFo_freeSlots&0b111111;
if(txFiFo_freeSlots<amount){
cc1101_errorcode|=ttc_spi_send_raw(cc1101_interface->SPI_Index,addressbuffer,1); //send Address
cc1101_errorcode|=ttc_spi_read_byte(cc1101_interface->SPI_Index,&cc1101_interface->current_CC1101_status, 100); //read Status
for(int i = 0 ; i <amount;i++){
cc1101_errorcode|=ttc_spi_send_raw(cc1101_interface->SPI_Index,buffer,1); //send dummy
cc1101_errorcode|=ttc_spi_read_byte(cc1101_interface->SPI_Index,buffer, 10000); //read Data
buffer ++;
}
}else{
// //cut of data if txfifo is not empty enough
// //this must be changed so we do not loose any data.
// //maybe the buffer needs to be splitted
// cc1101_errorcode|= cc1101_FiFoBufferOverrun;
// return cc1101_errorcode;
cc1101_errorcode|= cc1101_FiFoBufferOverrun;
}
ttc_portSet(&cc1101_interface->NSS_Port);
return cc1101_errorcode;
}
[\c]
CC1101_SXOFF