rt28
Junior Member level 1
hi
I'm trying to send and receive data with cc1101 (rxq4) but there is a problem, here is my code:
register settings
TX code:
RX code:
for test i'm sending 1 in each ten bytes, but I'm receiving this:
0x(31,06,db,40,ff,82,f3,0e,3e, ... )
does anybody know what's wrong with my code?
I've checked anything I could think of.
thanks in advance for your help
I'm trying to send and receive data with cc1101 (rxq4) but there is a problem, here is my code:
register settings
Code:
Unsigned char RF_setting[48]=
{0x29, // CCxxx0_IOCFG2
0x2e, //CCxxx0_IOCFG1
0x06, //CCxxx0_IOCFG0
0x07, //CCxxx0_FIFOTHR
0xd3, //CCxxx0_SYNC1
0x91, //CCxxx0_SYNC0
0xff, //CCxxx0_PKTLEN
0x04, //CCxxx0_PKTCTRL1
0x05, //CCxxx0_PKTCTRL0
0x05, //CCxxx0_ADDR
0x00, //CCxxx0_CHANNR
0x0c, //CCxxx0_FSCTRL1
0x00, //CCxxx0_FSCTRL0
0x10, //CCxxx0_FREQ2
0xb1, //CCxxx0_FREQ1
0x3b, //CCxxx0_FREQ0
0x2d, //CCxxx0_MDMCFG4
0x3b, //CCxxx0_MDMCFG3
0x13, //CCxxx0_MDMCFG2
0x22, //CCxxx0_MDMCFG1
0xf8, //CCxxx0_MDMCFG0
0x62, //CCxxx0_DEVIATN
0x07, //CCxxx0_MCSM2
0x3f, //CCxxx0_MCSM1
0x18, // CCxxx0_MCSM0
0x1d, // CCxxx0_FOCCFG
0x1c, // CCxxx0_BSCFG
0xc7, // CCxxx0_AGCCTRL2
0x00, // CCxxx0_AGCCTRL1
0xb0, // CCxxx0_AGCCTRL0
0x87, // CCxxx0_WOREVT1
0x6b, // CCxxx0_WOREVT0
0xfb, // CCxxx0_WORCTRL
0xb6, // CCxxx0_FREND1
0x10, // CCxxx0_FREND0
0xea, // CCxxx0_FSCAL3
0x2a, // CCxxx0_FSCAL2
0x00, // CCxxx0_FSCAL1
0x1f, // CCxxx0_FSCAL0
0x41, // CCxxx0_RCCTRL1
0x00, // CCxxx0_RCCTRL0
0x59, // CCxxx0_FSTEST
0x7f, // CCxxx0_PTEST
0x3f, // CCxxx0_AGCTEST
0x88, // CCxxx0_TEST2
0x31, // CCxxx0_TEST1
0x09, // CCxxx0_TEST0
0xC0}; // CCxxx0_PATABLE
TX code:
Code:
for(i=0;i<5;i++)
{
CC_Idle();
delay_ms(20);
CC_WrReg(CCxxx0_TXFIFO,1); //writing in 10 bytes of TXFIFO
CC_WrReg(CCxxx0_TXFIFO,1);
CC_WrReg(CCxxx0_TXFIFO,1);
CC_WrReg(CCxxx0_TXFIFO,1);
CC_WrReg(CCxxx0_TXFIFO,1);
CC_WrReg(CCxxx0_TXFIFO,1);
CC_WrReg(CCxxx0_TXFIFO,1);
CC_WrReg(CCxxx0_TXFIFO,1);
CC_WrReg(CCxxx0_TXFIFO,1);
CC_Cmd(CCxxx0_STX);
while (!PINB.3); // Wait for GDO0 to be set -> sync transmitted
while (PINB.3);
CC_ClrTx();
delay_ms(500);
}
RX code:
Code:
CC_Idle();
CC_RxOn();
delay_ms(10);
CC_RdRegs(CCxxx0_RXFIFO,RFData,10); //reading 10 bytes of rxfifo and store it in RFData
CC_ClrRx();
delay_ms(1);
CC_RxOn();
delay_ms(5);
lcd_clear(); // displaying on LCD
i=0;
lcd_puts("recieved");
delay_ms(1000);
while(i<10)
{
lcd_clear();
sprintf(buffer_lcd,"%d=",i);
lcd_puts(buffer_lcd);
sprintf(buffer_lcd,"%x ",RFData[i]);
lcd_puts(buffer_lcd);
i=i+1;
delay_ms(1000);
}
for test i'm sending 1 in each ten bytes, but I'm receiving this:
0x(31,06,db,40,ff,82,f3,0e,3e, ... )
does anybody know what's wrong with my code?
I've checked anything I could think of.
thanks in advance for your help
Last edited: