Hey All,
I can receive a packet sent by SmartRF, but not by my firmware. I'm really confused on why. I use an Atmel Xmega for the main processor.
Here are some code snippits:
// Initial settings on CC1101 Init:
CC1101_RF_SETTINGS.IOCFG0 = 0x06; CC1101_RF_SETTINGS.PKTCTRL0 = 0x05; CC1101_RF_SETTINGS.FSCTRL1 = 0x06; CC1101_RF_SETTINGS.FREQ2 = 0x21; CC1101_RF_SETTINGS.FREQ1 = 0x62; CC1101_RF_SETTINGS.FREQ0 = 0x76; CC1101_RF_SETTINGS.MDMCFG4 = 0xF5; CC1101_RF_SETTINGS.MDMCFG3 = 0x83; CC1101_RF_SETTINGS.MDMCFG2 = 0x13; CC1101_RF_SETTINGS.DEVIATN = 0x15; CC1101_RF_SETTINGS.MCSM0 = 0x18; CC1101_RF_SETTINGS.FOCCFG = 0x16; CC1101_RF_SETTINGS.WORCTRL = 0xFB; CC1101_RF_SETTINGS.FSCAL3 = 0xE9; CC1101_RF_SETTINGS.FSCAL2 = 0x2A; CC1101_RF_SETTINGS.FSCAL1 = 0x00; CC1101_RF_SETTINGS.FSCAL0 = 0x1F; CC1101_RF_SETTINGS.TEST2 = 0x81; CC1101_RF_SETTINGS.TEST1 = 0x35; CC1101_RF_SETTINGS.TEST0 = 0x09; CC1101_RF_SETTINGS.LQI = 0x80; CC1101_RF_SETTINGS.RSSI = 0x80;
// Place CC1101 in TX mode.
void ccxxx0_TxMode(void){ char regStatus =0; ccxxx0_Strobe(CCxxx0_SIDLE); while (regStatus != 0) { regStatus = ccxxx0_ReadStatus(CCxxx0_MARCSTATE); } ccxxx0_Strobe(CCxxx0_SFTX); // flush Tx buff }
void send_RF_msg(char message_type, char *msg, char length_lessThan59, char destination){ unsigned char tx_msg[64]; unsigned char msg_len;
unsigned char source =1; char index;
if (length_lessThan59 > MAX_MSG_LENGTH) { length_lessThan59 = MAX_MSG_LENGTH; } msg_len=1; tx_msg[msg_len++]= destination; tx_msg[msg_len++]= source; tx_msg[msg_len++]= message_type; tx_msg[msg_len++]= length_lessThan59; for (index=0; index<length_lessThan59; index++) { tx_msg[msg_len++] = msg[index]; } tx_msg[0]=msg_len;
ccxxx0_TxMode(); ccxxx0_WriteBurst(CCxxx0_TXFIFO, tx_msg, msg_len); // addr= 1 byte, payload= bytes, PKTLEN= addr + payload ccxxx0_Strobe(CCxxx0_STX); // activate Tx!
while (gpio_pin_is_high(CC1101_GDO0)); // wait for GDO0 to be cleared -> end of packet.
I can see the CC1101 draw the power and it seems like it's transmitting something, but the SmartRF and my Receiver is not picking it up.
Any ideas what might be wrong?
I'm checking my states right after I send the STX
and see the following on MarcState:
0x0f
0x2f ........many times, then last one
0xdc
When i try to send data via Burst Write
I get :
0x7f ... Many times
Then last one
0x27
Most of these don't seem to match the table located in http://www.ti.com/lit/ds/symlink/cc1101.pdf page 93, unless I am reading it wrong...??
Any help I can get would be great.
My register settings are now:
RF_SETTINGS rfSettings = { 0x0B, // IOCFG2 GDO2 Output Pin Configuration 0x06, // IOCFG0 GDO0 Output Pin Configuration 0x47, // FIFOTHR RX FIFO and TX FIFO Thresholds 0x05, // PKTCTRL0 Packet Automation Control 0x06, // FSCTRL1 Frequency Synthesizer Control 0x23, // FREQ2 Frequency Control Word, High Byte 0x31, // FREQ1 Frequency Control Word, Middle Byte 0x3B, // FREQ0 Frequency Control Word, Low Byte 0xF8, // MDMCFG4 Modem Configuration 0x83, // MDMCFG3 Modem Configuration 0x13, // MDMCFG2 Modem Configuration 0x14, // DEVIATN Modem Deviation Setting 0x18, // MCSM0 Main Radio Control State Machine Configuration 0x16, // FOCCFG Frequency Offset Compensation Configuration 0x43, // AGCCTRL2 AGC Control 0xFB, // WORCTRL Wake On Radio Control 0x17, // FREND0 Front End TX Configuration 0xE9, // FSCAL3 Frequency Synthesizer Calibration 0x2A, // FSCAL2 Frequency Synthesizer Calibration 0x00, // FSCAL1 Frequency Synthesizer Calibration 0x1F, // FSCAL0 Frequency Synthesizer Calibration 0x81, // TEST2 Various Test Settings 0x35, // TEST1 Various Test Settings 0x09, // TEST0 Various Test Settings 0x80, // RSSI Received Signal Strength Indication 0x01, // MARCSTATE Main Radio Control State Machine State 0x94, // VCO_VC_DAC Current Setting from PLL Calibration Module};
My debug program is
void debug_cc_state(void){ unsigned char marcstate_table[1024]; unsigned int ii; for(ii=0;ii<1023;ii++) { CC1101_ReadRegister(CC1101_MARCSTATE, &marcstate_table[ii]); for (int i=0; i<1000; i++); // delay cycles } // implment an arbitrary manipulation of "marcstate_table" so the compiler // does not remove all the results during optimization. marcstate_table[0] = marcstate_table[1023]+1; }
I rewrote some code as well.
Any ideas what could be the problem, or why my MARCSTATE values are not as I am expecting?
Best Regards,
Mike
I'm still trying to debug this problem.
It seems like (to me and I'm not an expert) that the CC1101 is Transmitting, maybe, at very low power?
Here is the chart from the Spectrum Analyizer.
Any feedback would be great, I really need help!
Also attached is my SmartRF config.
1884.cc1101_432012.xml
After trying different configurations, this CC1101 is not transmitting.
So, I used another function to read the MARCSTATE right after entering TX mode and I get:
0x00.......for about 1016 array counts, then i get
0xc2 -- Unknown
0x16 -- TXFIFO_Undeflow
0x00 - Sleep
0x02 - XOFF
0x30 - Unknown
0x20 - TX_END
0xdd - Unknown.
Perhaps, I need to write to TXFIFO before activating TX?
So I added an Extra STX after a Burst Write to TXFIFO.
My MARCSTATE array points are now like this:
before point 987; 0x00.
from point 987;
[987] 0x06 unsigned char{data}@0x272b ... -- VCOON [988] 0x54 unsigned char{data}@0x272c -- Unknown [989] 0x06 unsigned char{data}@0x272d [990] 0x54 unsigned char{data}@0x272e [991] 0x00 unsigned char{data}@0x272f [992] 0x06 unsigned char{data}@0x2730 [993] 0x54 unsigned char{data}@0x2731 [994] 0x06 unsigned char{data}@0x2732 [995] 0x54 unsigned char{data}@0x2733 [996] 0x06 unsigned char{data}@0x2734 [997] 0x54 unsigned char{data}@0x2735 [998] 0x00 unsigned char{data}@0x2736 [999] 0x00 unsigned char{data}@0x2737 - Sleep [1000] 0x01 unsigned char{data}@0x2738 - IDLE [1001] 0x4d unsigned char{data}@0x2739 - unkown [1002] 0x00 unsigned char{data}@0x273a - Slee [1003] 0x00 unsigned char{data}@0x273b [1004] 0x01 unsigned char{data}@0x273c - idle [1005] 0x4d unsigned char{data}@0x273d -- unkown [1006] 0x00 unsigned char{data}@0x273e [1007] 0x00 unsigned char{data}@0x273f [1008] 0x00 unsigned char{data}@0x2740 [1009] 0x00 unsigned char{data}@0x2741 [1010] 0xc2 unsigned char{data}@0x2742 [1011] 0x16 unsigned char{data}@0x2743 [1012] 0x00 unsigned char{data}@0x2744 - sleep [1013] 0x02 unsigned char{data}@0x2745 - Xoff [1014] 0x30 unsigned char{data}@0x2746 - unknown [1015] 0x20 unsigned char{data}@0x2747 - unkown [1016] 0xdd unsigned char{data}@0x2748 - ?? [1017] 0x52 unsigned char{data}@0x2749 [1018] 0x27 unsigned char{data}@0x274a [1019] 0x00 unsigned char{data}@0x274b [1020] 0x00 unsigned char{data}@0x274c [1021] 0x00 unsigned char{data}@0x274d [1022] 0x00 unsigned char{data}@0x274e [1023] 0x00 unsigned char{data}@0x274f
So .. nothing useful that I can find with a Burst Write.
After a single write of 16 bytes :
[992] 0x00 unsigned char{data}@0x272a [993] 0x06 unsigned char{data}@0x272b [994] 0x20 unsigned char{data}@0x272c [995] 0x06 unsigned char{data}@0x272d [996] 0x20 unsigned char{data}@0x272e [997] 0x00 unsigned char{data}@0x272f [998] 0x06 unsigned char{data}@0x2730 [999] 0x20 unsigned char{data}@0x2731 [1000] 0x06 unsigned char{data}@0x2732 [1001] 0x20 unsigned char{data}@0x2733 [1002] 0x00 unsigned char{data}@0x2734 [1003] 0x00 unsigned char{data}@0x2735 [1004] 0x01 unsigned char{data}@0x2736 [1005] 0x4d unsigned char{data}@0x2737 [1006] 0x00 unsigned char{data}@0x2738 [1007] 0x00 unsigned char{data}@0x2739 [1008] 0x01 unsigned char{data}@0x273a [1009] 0x4d unsigned char{data}@0x273b [1010] 0x00 unsigned char{data}@0x273c [1011] 0x00 unsigned char{data}@0x273d [1012] 0x00 unsigned char{data}@0x273e [1013] 0x1f unsigned char{data}@0x273f [1014] 0xe0 unsigned char{data}@0x2740 [1015] 0x16 unsigned char{data}@0x2741 [1016] 0x00 unsigned char{data}@0x2742 [1017] 0x01 unsigned char{data}@0x2743 [1018] 0xbe unsigned char{data}@0x2744 [1019] 0x02 unsigned char{data}@0x2745 [1020] 0x30 unsigned char{data}@0x2746 [1021] 0x20 unsigned char{data}@0x2747 [1022] 0xdd unsigned char{data}@0x2748 [1023] 0x52 unsigned char{data}@0x2749