PDA

View Full Version : TI CC1101 Radio Project



Zebryk
- 13th October 2014, 22:55
Anyone have experience interfacing to TI's CC1101 series of radios via SPI?

Dick Ivers
- 14th October 2014, 16:56
Hi Zebryk,
I'm working on a project similar to yours so perhaps we can learn something from each other. My radio is a KFR transceiver from D6 Labs, and is based the SX1272 chip from Semtech. It uses SPI communications. I've searched this Forum and found the following thread which discusses SPI issues among other things:

http://www.picbasic.co.uk/forum/showthread.php?t=15661&highlight=rfm22b

Forum member Paul has posted some code at post #5 which I have found useful as a guide. Based on this info I have put together some code to just test the send and receive function of the Pic to the KFR radio via SPI. Unfortunately, it is not working as yet ... I'm still trouble shooting. If you are interested I can post my code ... it is very simple.

andybarrett1
- 19th October 2014, 16:43
I found this whilst looking for someting else.....

Maybe of use ? :

http://www.squirrel-labs-files.co.uk/downloads/drivers/433Mhz-RF1100SE.zip

BR
Andy

Zebryk
- 20th October 2014, 01:59
Thanks Andy,

Quite interesting but vast.
Can you share any background?

andybarrett1
- 20th October 2014, 09:37
Hi

Sorry I haven't used the radio .... I was looking for something else and remembered your post here....So posted link!

BR
Andy

LinkMTech
- 21st October 2014, 15:01
I used the 900MHz Anaren radio module that uses that chip and what a mental workout, but got it working.
I found an article in Nutsvolts that helped me structure the sequence of events in order to get it working right. The code is in C+ but was able to decipher what to do.

Attached is a copy of the article.

Texas Instruments SmartRF Studio (http://www.ti.com/tool/smartrftm-studio) also helped with more insight. It provides all the info on every parameter that sucker uses.

Let me know if this is relevant and need some sample code. I used it with a PIC16F685 and PBP 2.5 or so back then.

ecoli-557
- 30th June 2015, 15:34
LinkMTech-
I was trying to use Microchip's 900MHz radio, but it whipped me - never got it to work (posted elsewhere on this forum) and now am looking for another radio.
Would you post what you did so I can get a head start on this? I just want to xmit 3 byte packet...... The idea is a 1 to many design.
Thanks in advance,
Steve

LinkMTech
- 30th June 2015, 23:33
Sure!
The A1101R09A module (http://www.mouser.com/ProductDetail/Anaren/A1101R09A00GM/?qs=sGAEpiMZZMu1CxYMhM6ijzzE9hicymgI)allows you to TX/RX data straight through using one of the GDO pins or using the SPI buffer depending on configuration. I found that using the SPI mode had better bandwidth efficiency with higher throughput.

I never finished upgrading (http://loscontroles.com/?page_id=19)to its full potential because there's still a lot thats over my head but have plenty of code to get you started.
I'll go through my files and dig up where I left off.

LinkMTech
- 1st July 2015, 01:00
Okay, I found the test code for the demo.
It's old code probably using PBP2.5 so you'll need to adjust to your flavoring.

I used this to just test the transmitter but it can be configured for RX too.



'************************************************* ***************
'* Name : Anaren Air Module.PBP
'* Date : 10/30/2010
'* Version : PIC12F683 on protoPCB, 1.0
'* Notes : This routine uses DEBUGIN from PC to send SPI data to control
'* the Anaren Transceiver Module A1101R09*. The idea is to first load all
'* pertinent information to configure the module then using DEBUGIN to
'* control the transmitter ON/OFF, mod or w/o mod, baud rate and PA level.
'*
'************************************************* ***************
@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
OSCCON = %01110001 ' Osc 8Mhz
ANSEL = %00000000 ' A/D turned OFF
ADCON0 = %10000000 ' Right justified and OFF
CMCON0 = 7 ' Analog comparators off
GPIO = %00001001 '
TRISIO = %00001001 '

DEFINE OSC 8
INCLUDE "modedefs.bas"

' DEBUG Defines for Transmitter
DEFINE DEBUG_REG GPIO
DEFINE DEBUG_BIT 1 ' GPIO 1 Pin#6
DEFINE DEBUG_BAUD 19200
DEFINE DEBUG_MODE 1 ' 1 = inverted, 0 = true

' DEBUG Defines for Receiver
DEFINE DEBUGIN_REG GPIO
DEFINE DEBUGIN_BIT 3 ' GPIO 3 Pin#4
DEFINE DEBUGIN_BAUD 19200
DEFINE DEBUGIN_MODE 1 ' 1 = inverted, 0 = true


' Alias pin assignments
SCLK VAR GPIO.4 ' SPI bus clock on Pin#3
MOSI VAR GPIO.5 ' SPI bus data to device on Pin#2
MISO VAR GPIO.0 ' SPI bus data from module on Pin#7
_CSN VAR GPIO.2 ' SPI bus select on Pin#5

' Alias SPI variables
Address VAR BYTE
Add VAR BYTE
mode var BYTE
register VAR BYTE
cnt VAR BYTE
value VAR BYTE

' Setup outputs
_CSN = 1 ' S_SEL set to idle HIGH
Add = $0
Value = 0
mode = $0

PAUSE 500

'/////////////////////////////////////////////////////////////////////////
' Register setup
' This routine loads all the register values derived from the TI Smart RF
' calculations. Load all mode values here. Takes 19.6ms to load
' Highlights: (08:$32, Async transparent mode), (0A:$48, CH#72, 916.396MHz)
' (15:$43, Dev = 39KHz)
'/////////////////////////////////////////////////////////////////////////
FOR Address = 0 to $2E
SELECT CASE Address
CASE 0: mode = $0B : CASE 1: mode = $2E : CASE 2: mode = $0C

CASE 3: mode = $47 : CASE 4: mode = $D3 : CASE 5: mode = $91

CASE 6: mode = $3D : CASE 7: mode = $04 : CASE 8: mode = $22

CASE 9: mode = $00 : CASE $0A: mode = $48 : CASE $0B: mode = $08

CASE $0C: mode = $00 : CASE $0D: mode = $22 : CASE $0E: mode = $B1

CASE $0F: mode = $3B : CASE $10: mode = $CA : CASE $11: mode = $83

CASE $12: mode = $90 : CASE $13: mode = $22 : CASE $14: mode = $F8

CASE $15: mode = $43 : CASE $16: mode = $07 : CASE $17: mode = $30

CASE $18: mode = $18 : CASE $19: mode = $16 : CASE $1A: mode = $6C

CASE $1B: mode = $43 : CASE $1C: mode = $40 : CASE $1D: mode = $91

CASE $1E: mode = $87 : CASE $1F: mode = $6B : CASE $20: mode = $F8

CASE $21: mode = $56 : CASE $22: mode = $10 : CASE $23: mode = $E9

CASE $24: mode = $2A : CASE $25: mode = $00 : CASE $26: mode = $1F

CASE $27: mode = $41 : CASE $28: mode = $00 : CASE $29: mode = $59

CASE $2A: mode = $7F : CASE $2B: mode = $3F : CASE $2C: mode = $81

CASE $2D: mode = $35 : CASE $2E: mode = $09

END SELECT

_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[Address,mode]
_CSN = 1 ' Disable Select bit
NEXT Address
' Additional setups
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[$7E,$8E] ' Set PA output to 0dBm
SHIFTOUT MOSI,SCLK,1,[$33] ' Calibrate synthesizer then turn OFF
_CSN = 1 ' Disable Select bit

'/////////////////////////////////////////////////////////////////////////
' Main test program loop
' Use DEBUG to monitor on Realterm set to Port 4 and 19200,8,1,N on laptop
' USB port nearest DVD player.
' Command type examples:
' Turn ON TX: 0 53 0
' Turn OFF TX: 0 54 0
' Change CH#: 4 n 0 ' n=CH# 0~130
' Change mod type: 1 16 202 ' 38.4KB 1st entry
' 1 17 131 ' 38.4KB 2nd entry
'
' Change PA level: 1 126 3 ' -30dBm
' 1 126 14 ' -20dBm
' 1 126 30 ' -15dBm
' 1 126 39 ' -10dBm
' 1 126 142 ' 0dBm
' 1 126 205 ' +5dBm
' 1 126 199 ' +7dBm
' 1 126 192 ' +10dBm
'/////////////////////////////////////////////////////////////////////////
Main:
DEBUGIN 10000, Main,[add,Address,mode] ' Loop here until PC data RX'd.
SELECT CASE Add
CASE 0: GOTO single
CASE 1: GOTO burst
CASE 2: GOTO multi
CASE 3: GOTO CH_change
CASE 4: GOTO CH_change_mod
END SELECT

single: ' Sends only the Address value to the module. Takes 173us.
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[Address]
_CSN = 1 ' Disable Select bit
DEBUG "Address value sent to module ",DEC Address,13,10
GOTO Main

burst: ' Sends Address and mode values together to the module. Takes 340us
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[Address,mode]
_CSN = 1 ' Disable Select bit
DEBUG "Address and Mode value sent to module ",DEC Address, " and ", DEC mode,13,10
GOTO Main

multi: ' Sends Address and mode values sequentually to the module
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[Address]
_CSN = 1 ' Disable Select bit
PAUSEUS 50
_CSN = 0 ' Enable Select bit
WHILE MISO : WEND ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[mode]
_CSN = 1 ' Disable Select bit
GOTO Main

CH_change: ' Changes channel based on channel number input. Takes 1.19ms
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[$36] ' Turn OFF TX
SHIFTOUT MOSI,SCLK,1,[$12,$B0] ' Setup for no modulation
SHIFTOUT MOSI,SCLK,1,[$0A,Address] ' Enter CH#
SHIFTOUT MOSI,SCLK,1,[$31] ' SFSTXON, Cal synth and stby
SHIFTOUT MOSI,SCLK,1,[$35] ' STX, turn ON transmitter
_CSN = 1 ' Disable Select bit
GOTO Main

CH_change_mod: ' Changes channel and enables modulation. Takes 1.19ms
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[$36] ' Turn OFF TX
SHIFTOUT MOSI,SCLK,1,[$12,$90] ' Setup for modulation
SHIFTOUT MOSI,SCLK,1,[$0A,Address] ' Enter CH#
SHIFTOUT MOSI,SCLK,1,[$31] ' SFSTXON, Cal synth and stby
SHIFTOUT MOSI,SCLK,1,[$35] ' STX, turn ON transmitter
_CSN = 1 ' Disable Select bit
GOTO Main

chip_status: ' Wait until module ready to accept new data
IF MISO = 1 THEN chip_status
RETURN

END


Here's the schematic to go with that code:

7891



This code was used on the keyfob using the PIC16F685. I was able to send a 22 byte message error free using the TX FIFO register. I think the module configuration is the same as above but don't have my hand written notes handy.



main:
m = m+1
GOSUB TX_FIFO
Grn = 1
GOSUB transmit ' Takes 176us to send command
Grn = 0
WHILE !GDO0: WEND ' Goes High after Preamble and Sync Word sent
WHILE GDO0 = 1 ' and takes 2ms before sending packet.
Grn = 1 ' Wait for TX to complete
WEND ' 1 byte packet takes 233us to TX
Grn = 0
GOSUB Clear_TX_FIFO
PAUSE 100
GOTO main

'========================== Data packet loading ========================
' Burst data into TX FIFO register $3F by adding $40
TX_FIFO:
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[$7F,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,_
$0B,$0C,$0D,$0E,$0F,$10,$11,$12,$13,$14,$15,$16,$1 7,m]
_CSN = 1 ' Disable Select bit
RETURN

'======================== Transmit routine ==============================
transmit:
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[$35] ' STX, turn ON transmitter
_CSN = 1 ' Disable Select bit
RETURN

Clear_TX_FIFO:
_CSN = 0 ' Enable Select bit
GOSUB chip_status ' Allow data transfer when device ready
SHIFTOUT MOSI,SCLK,1,[$3B] ' Flush out TX FIFO buffer
_CSN = 1 ' Disable Select bit
RETURN

ecoli-557
- 1st July 2015, 16:16
Thanks Louie-
I plan on using the A1101R09A00GM module, is that what you used? It should arrive tomorrow.
My idea is more of using these modules as a transmitter and receiver application even though they are transceivers.
How did you use the RSSI or did you? I would like to be able to see which transmitter is closest to which receiver. and then establish a link, send a few bytes and that pretty much it. More of a sensor transmission....
Does this sound reasonable given your experience?
-Steve

Dave
- 1st July 2015, 23:01
I have successfully used the RSSI from a receiver for TPM testing at work while designing an AGC circuit for a TPM Transmitter program. just remember that if using ASK transmissions you will need a fast A/D and you should gather enough data during a xmission to see the PEAK level. I have used this to program an 8 bit attenuator at the frontend of the receiver using successive approximation routine I wrote. That way each of the test Transmitters have the same received signal strength to the receiver for timing verification purposes. It is NOT as critical for the A/D if you are using FSK mode. I wish I could share more but I wrote the software for the company I work for... Good Luck...

LinkMTech
- 2nd July 2015, 01:06
You're welcome Steve,
Yup, that's one of them. I also used the other where you have to connect an external antenna.
The device has a digital RSSI register that can be read continuously. I never got to it in that last product where I was going to use for "clear channel search".
The code provided sets the transmitter modulation to 4 level FSK at +-39KHz deviation if I recall.

It can be configured to be a transmitter only, receiver only or switch between the two modes, it's up to you.
Your application is feasible, keeping air time management in mind to avoid transmission collisions, just like you would anyways with direct data connections.

Here's 1 data sheet on the RSSI you can go through. I couldn't upload the other because of it's size but can get it here (http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CB8QFjAA&url=http%3A%2F%2Fwww.ti.com%2Flit%2Fds%2Fsymlink%2 Fcc1101.pdf&ei=cXmUVZqVJYXxsAXrqKq4CQ&usg=AFQjCNFppR7Ti4p6ElVry8S_yddYO_5ngQ&bvm=bv.96952980,d.b2w).

Dave- What is TPM?

ecoli-557
- 2nd July 2015, 03:05
thanks Guys-
My modules are due in tomorrow, however, I have to go out of town on business so it will have to wait a bit longer darn it.
I really can't wait to see this work!
The MRF module never did work nor could I find ANYONE who saif they got it to work in packets!
Thanks again. Will keep you posted on progress - and code.
Regards to All.

LinkMTech
- 2nd July 2015, 03:39
Yeah, I bought a pair of them MRF's too but only ended up staring at them cuz they look cool. :D

ecoli-557
- 5th July 2015, 21:22
Yup. I should have my radios in waiting for me Monday. Then I can see about playing with them.......

LinkMTech
- 5th July 2015, 22:55
Steve,
I remembered unsuccessfully trying to solder rework wire to the module's pads only to damage it.
Do you make your PCBs?

I have some older revision PCBs with footprints for these module if you're interested. No strings, just willing to help.

ecoli-557
- 6th July 2015, 15:02
I would REALLY appreciate that. I just looked at my radio development 'kits' (2) and all I got was the module with an antenna! It looks as if these plug into something else........
So, it looks like I am going to make a cheap proto pcb....... I use Eagle, what do you use?
Regards,
Steve

LinkMTech
- 6th July 2015, 15:55
I use Express PCB and Pad2Pad for my boards.
Which kits did you order?

PM me your address so I can mail you some PCBs.

ecoli-557
- 6th July 2015, 18:55
I ordered the CC1101EMK868-915 from Mouser. Then just today I ordered the SOC-BB also from Mouser.
The SOC-BB should (?) allow me to plug in the radio modules, power via battery which is kinda weird, but will allow me to SPI-communicate to the radio.
I have been told the TI will work for me to do my coding, then move to the Anaren part which has the TI part and is FCC licensed.

I don't think I could use the Pad2Pad file to create my foot print for the radio, I will double check.

Thanks for the offer on the boards, but as I will need to generate my own with the radio, I think I should just muddle through and do it myself.

I would like to know more about the RSSI and actually how to use the data, were you successful in doing this? The other post made it sound as if going FSK would be easier.

LinkMTech
- 6th July 2015, 21:03
I didn't get to the RSSI function but didn't see it a problem since it means reading a register during the RX mode. The level range is pretty good and linear.

The RSSI value is available to be read from a register when the module is in RX mode. This value varies with the other transmitters signal strength reaching it. The value will of course be digital but have a minimum to maximum value. There will always be some value there due to noise or other transmitters on same channel.

Here's a simplified example of using it in your app, keeping the timing between TX and RX from module to module in mind:

Base changes to TX mode and sends addressed query message to sensor
Base changes back to RX mode and begins reading RSSI register

Addressed sensor receives message and changes to TX and sends an ACK of some sort
Sensor module reverts back to RX mode

Base monitoring the RSSI records the value during valid message from sensor.

Since you want to "talk" to the closest sensor, query the others in the same way then choose the one with the highest RSSI value after comparing all RSSI's.

This is a general description of the signal strength. There are other factors that will cause it to vary like interference, fading, etc. but it's a pretty good indicator to work with.

ecoli-557
- 6th July 2015, 22:08
Thanks Louie. What proc did you use with you radios?

ecoli-557
- 6th July 2015, 23:09
Hmmm, I never used PM so I have no experience with attaching PDFs. Try changing the extension name.
Did you try the other email address I sent?

LinkMTech
- 7th July 2015, 00:11
Used a PIC16F677 or a PIC16F685 in my devices.

PMs and PDF sent...