This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using Radio on CC1110/CC1111

Other Parts Discussed in Thread: CC1101

Hi,

in my project i have to use the radio on my uC ( CC1110/CC1111). I use the example code from TI for creat my carrier and sending packets. All the Register- Configuration i done with the SmartRF Stuio 7. Now i want to send data and recieve data.

I have to uC, the first one i use it for sending data. And the other one is connected on my PC and SmartRF Studio is openned to see the data comming. 

But i have problems withe my code. I can not send data. I'm not sure that my code is correct. The RFD-Register is a 8Bit Register which sent the Data ond bit like Uart. The Uart i programmed well. I can not find my mistake in my code.

Here a short view about my code:

Register configuration from SmartRF:

/* RF settings SoC: CC1110 */                   // Packet yollamak icin
PKTCTRL0 = 0x05;                                      // packet automation control
FSCTRL1 = 0x06;                                    // frequency synthesizer control
FREQ2 = 0x10;                                     // frequency control word, high byte
FREQ1 = 0xA7;                                    // frequency control word, middle byte
FREQ0 = 0x62;                                     // frequency control word, low byte
MDMCFG4 = 0xF5;                              // modem configuration
MDMCFG3 = 0x83;                                // modem configuration
MDMCFG2 = 0x13;                                // modem configuration
DEVIATN = 0x15;                                   // modem deviation setting
MCSM0 = 0x18;                                     // main radio control state machine configuration
FOCCFG = 0x17;                                   // frequency offset compensation configuration
FSCAL3 = 0xE9;                                     // frequency synthesizer calibration
FSCAL2 = 0x2A;                                      // frequency synthesizer calibration
FSCAL1 = 0x00;                                     // frequency synthesizer calibration
FSCAL0 = 0x1F;                                    // frequency synthesizer calibration
TEST1 = 0x31;                                       // various test settings
TEST0 = 0x09;                                     // various test settings
PA_TABLE0 = 0x60;                             // pa power setting 0
IOCFG0 = 0x06;                                   // radio test signal configuration (p1_5)
LQI = 0xC5;                                            // demodulator estimate for link quality
PKTSTATUS = 0x80;                                // packet status

SYNC1 = 0xAA; 
SYNC0 = 0xAA;

RFST = 0x03;

while (1)
{

RFD = RadioTxBuffer[zz];

RFTXRXIE = 1;

EA = 1;

}

#pragma vector = RFTXRX_VECTOR
__interrupt void RFTXRX()
{
RFTXRXIF = 0;
RFTXRXIE = 0;
}

  • Hi

    To be able to send data you must put the radio in TX mode by writing a STX strobe to the RFST register.

    You must also make sure the 26 MHz crystal is up and running since this is used by the radio.

    Siri

  • It is not working due to your chosen sync word AA AA . The receiver find the sync word in the sent preamble, and then everything gets wrong. I recommend you trying to swap the sync word, this will also give you a more reliable link as it reduces the chances of false sync detection. 

  • Hi Siri,

    i have it in TX Mode. You can see on my code, i write RFST = 0x03. That is STX Mode.

    Or what you mean?

    Thanks

  • Hi CHS,

    what should i write for the sync words? Give me an example. Or should i uncommend it?

    Thanks

  • We use SYNC1 0xD3 and SYNC0 0x91 as default in all our recommended settings, that worked fine when I tested it on my desk, so I recommend that you use that.  

  • Hi,

    thank you. I will try it. But, is my code correct? Can you send me yore code? Or the important part of youre code.

    I try hole the day to write my code, but it will not function.

    Thanks

  • You must turn on the crystal. I cannot see you do this in your code. Please see the attached code example.

    1638.Example.zip

    SIri 

  • Hi Siri,

    this is my code for the crystal:

    SLEEP &= ~SLEEP_OSC_PD_BM;                        
    while (!(SLEEP & SLEEP_XOSC_STB_BM));         
    CLKCON &= ~CLKCON_OSC_BM;                    
    while (CLKCON & CLKCON_OSC_BM); 
    SLEEP |= SLEEP_OSC_PD_BM; 

    and i want to write my code without DMA. This i can do i think?!

  • I want to ask, the RFTXRXIF Flag will automatically set to 1 if the RFD Register is ready to send or recieve new data ( byte). In my code i have this polling :

    While(!(RFTXRXIF)); after sending from RFD. But the flag will not set to 1. But why?

    Here my changed code:

    char RadioTxBuffer[10] = {83 , 65, 77, 69, 68, 84, 79, 80, 65, 76};               //that is ascii and stay SAMEDTOPAL

    SYNC1 = 0xD3 ; 
    SYNC0 = 0x91 ;

    RFST = 0x03;

    while ((MARCSTATE & MARCSTATE_MARC_STATE) != MARC_STATE_TX);

    while (1)
    {

    while(NN)
    {
    for(short int a=0; a<10; a++)
    {
    RFD = RadioTxBuffer[a];
    while(!(RFTXRXIF));
    RFTXRXIE = 1;
    EA = 1;
    P1_0 = 0;

    }
    NN--;
    }

    #pragma vector = RFTXRX_VECTOR
    __interrupt void RFTXRX()
    {
    RFTXRXIE = 0;
    P1_0 = 1;
    }

    And my config. for the crystal and the registers:

    SLEEP &= ~SLEEP_OSC_PD_BM;                                   // power up both oscillators
    while (!(SLEEP & SLEEP_XOSC_STB_BM));                 // Wait until HS XOSC is stable
    CLKCON &= ~CLKCON_OSC_BM;                                 // change system clock source to HS XOSC
    while (CLKCON & CLKCON_OSC_BM);                         // wait until CLKCON.OSC = 0
                                                                                                   // (system clock running on HS XOSC)
    SLEEP |= SLEEP_OSC_PD_BM;                                 // power down the unused oscillator

    PKTCTRL0 = 0x05; // packet automation control
    FSCTRL1 = 0x06; // frequency synthesizer control
    FREQ2 = 0x10; // frequency control word, high byte
    FREQ1 = 0xA7; // frequency control word, middle byte
    FREQ0 = 0x62; // frequency control word, low byte
    MDMCFG4 = 0x15; // modem configuration
    MDMCFG3 = 0x83; // modem configuration
    MDMCFG2 = 0x13; // modem configuration
    DEVIATN = 0x62; // modem deviation setting
    MCSM0 = 0x18; // main radio control state machine configuration
    FOCCFG = 0x17; // frequency offset compensation configuration
    FSCAL3 = 0xE9; // frequency synthesizer calibration
    FSCAL2 = 0x2A; // frequency synthesizer calibration
    FSCAL1 = 0x00; // frequency synthesizer calibration
    FSCAL0 = 0x1F; // frequency synthesizer calibration
    TEST1 = 0x31; // various test settings
    TEST0 = 0x09; // various test settings
    PA_TABLE0 = 0x60; // pa power setting 0
    IOCFG0 = 0x06; // radio test signal configuration (p1_5)
    LQI = 0x80; // demodulator estimate for link quality
    PKTSTATUS = 0x80; // packet status
    PKTLEN = 255;

  • Please see the code example I posted yesterday in this thread: http://e2e.ti.com/support/wireless_connectivity/f/156/p/16733/1196004.aspx#1196004

    This is a complete CC1110 example for sending and receiving packets without the use of DMA.

    Siri

  • Hi Siri,

    thank you for posting youre code. But are you sure that youre code is ok?

    Becouse i have problem in this part:

    for (uint8 m = 1; m <= N; m++) {
    while (!RFTXRXIF);
    RFTXRXIF = 0;
    RFD = txBuffer[m];

    In the second continuous they stoped by while(!RFTXRXIF), becouse RFTXRXIF will not be 1 if they send about RFD. But why?

    Can you explain youre code?

    Thanks

  • Hi

    I just did a test where I used CC1110 on the minikit to transmit packets to a CC1101 running SmartRF Studio and the packets were received fine. 

    The steps to transmit a packet is:

    1) strobe STX

    2) wait for RFTXRXIF to be asserted indicating that a byte can be written to RFD

    3) Clear RFTXRXIF

    4) write data to RFD

    5) Repeat from 2 until the last byte is written

    6) After the last byte has been written to RFD, wait for IRQ_DONE indicating that the packet has been transmitted.

    Remember that you cannot step through this code using the debugger. If you want to set a breakpoint, you must do this in between each packet.

    When stepping the MCU code, the radio will still run and what happens is that you will not write to RFD when you are supposed to, and the radio will underflow (enter TX_UNDERFLOW state).

    Siri

  • Hi Siri,

    thank you so much for youre help. Now my code is well. But i have a last question. Why i have to send the whole array? Why i can not send only one byte? Or i missanderstand somethink?

    I mean that:

    RFD = RadioTXXBuffer[0];                          thats for the leanght --> leanght of the array

    for (uint8 m = 1; m <= N; m++)
    {
    while (!RFTXRXIF);
    RFTXRXIF = 0;
    RFD = RadioTXXBuffer[m];                         and now i send the whole array
    }

    but why i can not send only one byte? For example:

    uint8 s = 0x11;           example

    RFD = s;

    while (!RFTXRXIF); 
    RFTXRXIF = 0;

    Thanks

  • Hi 

    The register setting I have used (taken from SmartRF Studio) is configuring the radio for variable packet length so
    I wrote the example for this configuration. That means that the first byte you are sending is the length byte.
    If this is for example 5 you need to transmit 5 more bytes after the length byte. If not, the radio will underflow.
    If you only want to send one byte you need to configure the radio for fixed packet length mode
    (PKTCTRL0.LENGTH_COFIG = 0 and PKT_LEN = 1). In this case, the radio only expect one byte to be sent and will
    enter IDLE after sending it. This is all explained in the data sheet.

    Siri

     

  • Hi,

    i want to add Uart to my code. I add it, and i use my PC to see the data coming from radio. But i see only wrong data. But i test my data with studio 7. It's correct. Where should i be careful with my code?

    Boud rate configuration i changed it for my radio, uart and on my pc. ( to 2,4kHz). But i think the uart takes more time to send the data, and if i configurate the time longer for my uart, than the radio doesn't work well. What is wrong?

    Thanks

  •  

    Start by testing the radio and the UART separately to make sure that you have both peripherals up and running.

    If this works well the problem might be related to the MCU being  occupied with UART code and are not handling the incoming packets properly. Remember that the RFD register must be read before the radio receives the next byte or else the radio will overflow.

    To avoid this problem it is recommended to use the DMA. Then the DMA can take care of moving data to and from the RFD register while the MCU can take care of other tasks, like sending/receiving data on the UART.

     Siri

  • Hi Siri,

    thats right. I want to write my radio code with DMA. I try to write the configuration but it failed every time. I use youre DMA Radio code and copy the DMA coniguration. I want to change some parts, but there is a big mistake in the hole DMA config.. They sad :

    dmaConfigRX is undefined. And more.

    What is wrong?

    Can you give me a other example with the DMA config?

    Please help

    Thanks

  • Please see the attached code example.

    1541.CC1110_Radio_DMA.rar

    Siri

  • Hi Siri,

    youre example is without DMA. I need the DMA configuration for the Radio. 

    Thank you

  • I uploaded the wrong file but now it is fixed :-)

    BR

    Siri

     

  • Where is youre new file?

    And some question again. I found some DMA Configuration, but if i want to use it IAR give me a error like this:

    SRCADDR is undefined!

    But i add the DMA.h. I don't know where is my misstake.

    Please help!

  • Hi,

    i just get my code correct. Now everythink is without errors. But how can i test my DMA-Radio code. I try it and it was ok. My Data from the first uC goes to the other uC. But i think that my old code do this, DMA has not a function.

    How can i test my DMA code only. Or the whole code with DMA. I want to see that my DMA is ok. 

    Thanks

    I think i can't tell you my problem right.

    If you have any question about my question/problem ask me.

    Thanks

  • The DMA code is in the post from May 27 2014 00:54 AM.

    If you take a look you will see that I changed the zip file.

    Siri

  • Hi Siri,

    sorry my misstake. Now i have it and try it. But i get so much errors. 

    My DMA-Donfiguration: (its like the same i think, please correct me)

    dmaConfigRX.SRCADDRH = ((uint16)&X_RFD >> 8) & 0x00FF;                   
    dmaConfigRX.SRCADDRL = (uint16)&X_RFD & 0x00FF;
    dmaConfigRX.DESTADDRH = ((uint16)rxBuffer >> 8) & 0x00FF;
    dmaConfigRX.DESTADDRL = (uint16)rxBuffer & 0x00FF;

    dmaConfigRX.VLEN = DMA_VLEN_FIRST_BYTE_P_3; 
    dmaConfigRX.LENH = N+1; // 0 yazıyordu
    dmaConfigRX.LENL = N+1; // 17 yazıyordu
    dmaConfigRX.WORDSIZE = DMA_WORDSIZE_BYTE;
    dmaConfigRX.TMODE = DMA_TMODE_SINGLE;
    dmaConfigRX.TRIG = DMA_TRIG_RADIO;
    dmaConfigRX.SRCINC = DMA_SRCINC_0;
    dmaConfigRX.DESTINC = DMA_DESTINC_1;
    dmaConfigRX.IRQMASK = DMA_IRQMASK_ENABLE;
    dmaConfigRX.M8 = DMA_M8_USE_8_BITS;
    dmaConfigRX.PRIORITY = DMA_PRI_HIGH;

    // Load DMA configuration to channel 0;
    DMA0CFGH = ((uint16)&dmaConfigRX >> 8) & 0x00FF;
    DMA0CFGL = (uint16)&dmaConfigRX & 0x00FF;

    Thanks you

  •  

    Hi

    It would be great if you did not post several post for the same problem. It makes it harder to follow up and we use unnecessary resources.

    This case will be followed up in the following thread:

    http://e2e.ti.com/support/wireless_connectivity/f/156/p/343953/1204008.aspx#1204008

    Siri