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.

CC1101: Setting asynchronous mode serial baud rate

Part Number: CC1101

Hello,

how can I set the baud rate of the serial asynchronous tx/rx mode on the CC1101?

What registers do I have to set to put it into async tx/rx mode and set the baud rate?

Thanks

  • From 27.1 in  the datasheet:

    "The CC1101 modulator samples the level of the asynchronous input 8 times faster than the programmed data rate. The timing requirement for the asynchronous stream is that the error in the bit period must be less than one eighth of the programmed data rate."

    How you set the datarate is covered in chapter 12 in the datasheet. 

  • Thank you very much, TER!

    I am quite new to utilizing such data protocols on the bit level.

    So you say if I configure it to 4.8kb/s in OOK mode, the serial baud rate of the RX output pin is at 38.4kb/s?

    My question is, can I just initialize the serial line of my ESP32 at 38.4kb/s and receive all the data that way or do I have to implement a custom function that captures the data on the line?

  • I use the CC1101 radio with an Infiduino (a 3.3v version of the Arduino). The radio connection replaced a wired RS-232 connection.

    My application is remote control of model trains. A complete description and all of my Arduino source code is available on my web page listed at the bottom of this post. The Arduino code is in a ZIP file named Arduino.zip - look for the sketch named RTCModemE.cpp and RTCModemE.h. For the CC1101 register settings, look at CC1101E_OOK.h and CC1101E_OOK.h in the same ZIP file.

    Here are the CC1101 register settings that I used


     
    static const registerSetting_t C905_8[]= 
    {
      {CC1101_IOCFG2,      0x2E},	// High-Impedence
      {CC1101_IOCFG1,      0x2E},	// High-Impedence
    				// GDO1 is selected as Serial data output from CC1101
    				// GDO1 is also used as the SPI output from the CC1101 to Arduino
    
      {CC1101_IOCFG0,      0x0D}, // GDO0 is hardwired as Serial Data input to CC1101 in asynchronous TX mode
    			      // and this setting selects it as Serial data output from the CC1101 in asynchronous RX mode
      {CC1101_FIFOTHR,     0x47}, 	// OK per DN022, when RX filter bandwidth <= 325 kHz
      {CC1101_PKTCTRL0,    0x32}, 	// OOK
      //{CC1101_CHANNR,      0x00}, // 100KHz channels - #0 gives 905.799438 MHz  -  Remote RX
      {CC1101_CHANNR,      0x6B}, 	// 100KHz channels - #107 gives 916.496826 MHz  -  Remote TX
      {CC1101_FSCTRL1,     0x06}, 	// IF Frequency   152 KHz
    
      {CC1101_FREQ2,       0x22}, 	// 905.8 MHz - base frequency, use channel 107 for transmit
      {CC1101_FREQ1,       0xD6},
      {CC1101_FREQ0,       0xA5},  
    
      {CC1101_MDMCFG4,     BW162}, // Bandwidth  3:32 PM 6/13/2016
    				// 0xF8 = 58 kHz - would not work with with RTCEngineE (too narrow)
    				// 0xE8 = 68kHz - Worked with RTCEngineE.
    				// 0xD8 = 81 kHz - Worked with RTCEngineE.
    				// 0xC8 = 101 kHz - Worked with RTCEngineE, would not work with my Rev I3A TIU.
    				// 0xB8	= 116.07kHz - Worked with RTCEngineE, would not work with my Rev I3A TIU.	
    				// 0xA8	= 135.4kHz - Worked with RTCEngineE. Borderline operation with my Rev I3A TIU.
    			        // 0x98 = 162.5 kHz - one TIU would not work at 101Khz, it worked at 203 kHz and at 162.5 kHz
    				//		Worked with RTCEngineE. Worked with Rev I3A and Rev L TIU. Would not work with Mike's Rev I TIU
    				// 0x88 = 203.125 kHz  Worked with RTCEngineE. Worked with Rev I3A TIU. Seems like solid operation
    				//		without any noise issues.
    				// 0x78 = 232.14 kHz
    				// 0x68 = 270.83 kHz
    				// 0x48 = 406.2 KHz - would not work with Mike's Rev I TIU
    				// 0x28 = 541 kHz - worked with Mike's Rev I TIU - but furthur testing showed the RX was much
    				//		more suseptable to noise (seen with testing using RTCEngineE)
      {CC1101_MDMCFG3,     0x83}, // Data Rate  9.596 baud
      {CC1101_MDMCFG2,     0x30}, // Modulation format ASK/OOK
      {CC1101_MDMCFG1,     0x21}, // Channel Spacing w/MDMCFG0
    				// 0x21 = 100 Khz
    				// 0x20 = 50 kHz
      {CC1101_MDMCFG0,     0xF8}, // Channel Spacing w/MDMCFG1
    
      {CC1101_DEVIATN,     0x14}, // Deviation - not used in ASK/OOK
    
      //{CC1101_MCSM2,       0x10}, // Set RX_TIME_RSSI - interface stops working
      {CC1101_MCSM1,       0x00}, // Always select clear channel, was 0x30 unless currently receiving a packet
      {CC1101_MCSM0,       0x18}, // FS_AUTOCAL  when going from IDLE to RX or TX
      {CC1101_FOCCFG,      0x16}, // Per CC1101 doc, FOC_LIMIT[1:0] s/b 0 for OOK. That means this should be 0x14
      {CC1101_AGCCTRL2,    0x07}, // SmartRF gives 0x43  - per DN022 it should be between 0x03 and 0x07, 0x06 and 0x07 seem to work well
    				// 0x92 with 0x03, 0x04, 0x05, 0x06 generates spurious bits
    				// 0x91 with 0x03, 0x04, 0x05 generates spurious bits, 0x06 and 0x07 seem to work
      //{CC1101_AGCCTRL1,    0x00}, // per DN022 0x00, Relative Threshold disabled, Absolute Threshold @ MAGN_TARGET setting
    	//		      0x30 CS relative threshold = 14 db increase in RSSI value
    	//			Generally this did not do what I expected
    	//			     0x08 CS absolute threshold disabled  
      {CC1101_AGCCTRL1,    0x00 | 0x30 | 0x08}, // setup for CS detection relative, Absolute disabled.
      {CC1101_AGCCTRL0,    0x91}, // per DN022 between 0x91 and 0x92, overall, 0x91 seems to work well
    				// 0x93 produces a lot of junk
    				// 0x90 works ok and reduces the amount of junk but not much better than 0x91
      {CC1101_WORCTRL,     0xFB},
      {CC1101_FREND1,      0x56}, // OK per DN022, when RX filter bandwidth <= 101 kHz
    				// NOTE: I have since widened the bandwidth
    				// to 162.5 kHz but I didn't change this value. Seems to work fine.
      {CC1101_FREND0,      0x11}, // PA Power Setting index 1 - select PATABLE[1] when transmitting a one
      {CC1101_FSCAL3,      0xE9},
      {CC1101_FSCAL2,      0x2A},
      {CC1101_FSCAL1,      0x00},
      {CC1101_FSCAL0,      0x1F},
      {CC1101_TEST2,       0x81}, // OK per DN022, when RX filter bandwidth <= 325 kHz
      {CC1101_TEST1,       0x35}, // OK per DN022, when RX filter bandwidth <= 325 kHz
      {CC1101_TEST0,       0x09},
    };
    




  • Oh my gosh, that looks like so much work put into such a great project! I am flashed.

    Thank you so much, this helps me soo good! I will have a look at it! Thank you!!!!!

  • The baud rate is not set in the CC1101. It just takes the 1's and 0's coming into it and then either turns the carrier either on or off. (In my case, I inverted the serial port output so that a '1' (marking) turned the carrier off and a '0' (spacing) turned the carrier on.) It was the Arduino that set the baud rate by how fast I ran the serial port. I don't know if there is a maximum baud rate. All I needed was 9600 baud and that rate worked fine.

  • Okay, but the baud rate of the RX output (CC1101) is also 9600 (according to your code), but this is just a result of the register configurations, right?

  • No.  The CC1101 in this configuration does not care about the baud rate.

    The RX of the CC1101 just listens to the channel. If a carrier is there, the RX will output a '1'. If the carrier is not there, it will output a '0'.

    In effect, the baud rate is whatever the other end of the transmission is sending.

    The RX output of the CC1101 has to go to a UART which decodes the bit stream just like if it were a wired connection. In my application, I do that in software, using the Arduino SoftwareSerial library but it can also be done in hardware.

  • Oh, now I get it! In order to straight up copy my garage door code I should save the raising and falling edges of the RX output pin of the CC1101, right?

    Sorry, I am such a noob, thank you so much for helping me out :P

    So, in order to send the code back again I need to replay the same sequence of rising and falling edges with the same time intervals to the TX input pin? Or did I miss something?

    Thanks!

  • Yes, the CC1101 just turns its transmitter on when the TX input pin is high. You have control the timing of the signal that you apply to the TX input pin.

  • Hi, thank you so much, I managed to receive my garage door signal at 868MHz! However, your registers do not work, I had to set IOCFG2 to 0x0D instead of 0x2E.

    But there is a problem, the Carrier Sense settings do not work for 443MHz, it is receiving noise. How can I fix that?

    And also transmitting does not seem to work. IOCFG0 is set to 0x0D, but after I put the module into TX mode (STX SPI cmd) and try to replay the data, nothing appears on my RTL-SDR. Do you know what's going on?

  • If I put it into transmit mode (on 868.3MHz) I only see a very narrow continuous line on the frequency 868.43, but the TX GDO is set to low.

    No matter what I input into the TX input, it only shows me the narrow line. My PKTCTRL0 is at 0x32.

    Even though it "transmits" on the wrong frequency, it still reads on the right one

  • UPDATE

    I think my board is just heavily wrong, look at this. I replaced it and voila, better looking. The thing is, there is a continuous red line (not the one on the picture) that only gets yellow when transmitting. Is the red line normal or does my board not turn modulate well?

  • What is the current status on this issue?