spaceteddy / cc1101 Goto Github PK
View Code? Open in Web Editor NEWdriver library for Ti CC1100 / CC1101. For Arduino and Raspberry Pi
License: MIT License
driver library for Ti CC1100 / CC1101. For Arduino and Raspberry Pi
License: MIT License
Hi.
I want to use the CC1101 to sniff for sensors that use 433 signals, they print out an unique ID.
When using the generic RF receiver they are too weak and if it's 50cm away from it they don't receive anything.
I could make it work with an Arduino using this:
Hi;
I do not want to send the lenght of my buffer. I just want to send exactly my buffer but on my code if ı do not send a size of my buffer first and even if I change the inside of my buffer, it continues to send old data. Even PKTCTRL0 (Packet automation control) is "0x05",it is meaning Infinite packet length mode. So ı do not need to send a size of buffer. But my problem is lets say ı am sending a fener[26] buffer and ı delete the send a size of buffer on cc1101_send_packet function and change the sending data lets say ı made packet[26] and reload program again but it still send old(fener[26]) data. but when ı open the sending size function in cc1101_send_packet function
My codes;
void SpiCWriteBurstReg(uint8_t Addr,uint8_t *Buffer,uint8_t Count)
{
uint8_t i=0;
uint8_t temptxburst[Count+2];
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_RESET);
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_6) != GPIO_PIN_RESET);
// temptxburst[0] = SPI_ReadWrite(Addr|WRITE_BURST); // adreside yanlislikla yazdirdigim yer.
temptxburst[0] = Addr|WRITE_BURST;
HAL_SPI_Transmit(&hspi1,&temptxburst[0],1,10);
HAL_SPI_Transmit(&hspi1,Buffer,Count,10); // DATA TOPLU GONDERIM
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_SET);
}
void SPiCWriteReg(uint8_t Addr,uint8_t Value)
{
// SPiCPowerUpReset();
Power_up_reset();
uint8_t Data_Write[2];
Data_Write[0]=Addr;
Data_Write[1]=Value;
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_RESET);
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_6) != GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1,Data_Write,2,10);
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_SET);
}
void SpiCStrobe(uint8_t Strobe)
{
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_RESET); //CS enable
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_6) != GPIO_PIN_RESET);
SPI_ReadWrite(Strobe);
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_SET); //CS disable
}
void cc1101_send_packet(uint8_t* txBuffer, uint8_t size)
{
SpiCStrobe(CCxxx0_SIDLE);
SPiCWriteReg(CCxxx0_TXFIFO, size); //I DO NOT WANT TO SEND SIZE . when i close this program is not working correctly.
SpiCWriteBurstReg(CCxxx0_TXFIFO, txBuffer, size);
SpiCStrobe(CCxxx0_STX);
}
uint8_t DataBufferX1[26]= {0x19, 0x44, 0x55, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x65, 0x20, 0x54, 0x75, 0x72, 0x61, 0x6E, 0x20, 0x20, 0x43, 0x43, 0x31, 0x31, 0x30, 0x31, 0x20};
uint8_t fener[26] = {0x66, 0x65, 0x6e, 0x65, 0x72, 0x62, 0x61, 0x68, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x6b, 0x20, 0x79, 0x61, 0x73, 0x61, 0x20, 0x6f, 0x6f, 0x6f, 0x6c, 0x65, 0x79};
uint8_t packet[26] = {0x43, 0x43, 0x31, 0x31, 0x30, 0x31, 0x20, 0x74, 0x61, 0x6d, 0x61, 0x6d, 0x6c, 0x61, 0x6e, 0x64, 0x69, 0x20, 0x59, 0x45, 0x53, 0x53, 0x53, 0x21, 0x21, 0x21};
while (1)
{
HAL_Delay(500);
SpiCStrobe(CCxxx0_SFTX);
cc1101_send_packet(fener,26 );
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_2) == GPIO_PIN_SET);// while(HAL_GPIO_ReadPin(GDO0_GPIO_Port, GDO0_Pin));
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_2) != GPIO_PIN_SET);// while(!HAL_GPIO_ReadPin(GDO0_GPIO_Port, GDO0_Pin));
}
and ı make also ;
I made the changes
0x04, // PKTCTRL0 Packet automation control.
0x1A // PKTLEN Packet length (in decimal 26)
I delete the sending size of buffer
void cc1101_send_packet(uint8_t* txBuffer, uint8_t size)
{
SpiCStrobe(CCxxx0_SIDLE);
// SPiCWriteReg(CCxxx0_TXFIFO, size); ***************************
SpiCWriteBurstReg(CCxxx0_TXFIFO, txBuffer, size);
SpiCStrobe(CCxxx0_STX);
}
Result;
1.receive data: 1A 43 43 31 31 30 31 20 74 61 6D 61 6D 6C 61 6E 64 69 20 59 45 53 53 53 21 21
NOTE: as you see first byte 1A means in decimal 26 so it still send the old data because i did not send the size. i have no idea about how this happened?
2.sending data: fener[26] = {0x66, 0x65, 0x6e, 0x65, 0x72, 0x62, 0x61, 0x68, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x6b, 0x20, 0x79, 0x61, 0x73, 0x61, 0x20, 0x6f, 0x6f, 0x6f, 0x6c, 0x65, 0x79};
2.receive data: 66 43 43 31 31 30 31 20 74 61 6D 61 6D 6C 61 6E 64 69 20 59 45 53 53 53 21 21
NOTE:As you see just change the first byte. first byte is true but the rest of the buffer are old information.
I am working on porting your arduino version to esp8266
I am having a few questions
https://github.com/SpaceTeddy/CC1101/blob/master/cc1100_arduino.cpp#L1299
Hello
FIrst let me tell you i am a complete noob to raspberry and cc1101 , so i don't know a lot about it.
But i was wondering if it was possible to use your code to receive a signal with the raspberry pi and cc1101 send by smart RF studio and the ccdebugger. Because I have followed your readme file and did everthing like you said , but i don't receive anything , and i am using the same frequentcy , modulation ,...
My problem is similar to the one were you talk about inthe issues: Not Receiving Anything #11
but nothing he did there works for me.
if you know anything about this let me know
Thanks
BoB1237
Sir i ordered a cc1101 to try to transmit 315mhz car key fob signal,i used the rtl_43 library to capture the 315mhz signal now i want to transmit with this library i will be more than happy if someone could help
I have e07-m1101d which only has 8 ports and are not labelled i was able to find some documents on it but i still cannot configure it with this library
Dear.
Somebody knows what the default setting are for cc1100_GFSK_1_2_kb:
Regards,
Jan
Hello,
I'm trying to use your CC1101 library (amazing work also, I don't know how you do such complete things),
but I bought an Arduino Due : no avr library is compatible. It's been 3 months I try everything to fix it, without success. I might go for the raspberry pi part, but my Arduino Due would've been a waste for now (no use planned now for the future). I would ask you if you could give me tips on how to make your library working for ARM Due architecture please.
Keep it up !
Valentin.
Hi,
I was just wondering if it is possible to use your work for CC1101 chips that are mounted on a USB board (UART ) with a silabs cp210x chipset?
I would like to use such a RF transiever on my Raspberry Pi so I don't need to wire all connections.
Looking forward to any response.
Thanks in advance!
Hi,
Thank you again for the code/libraries to get the CC1100/CC1101 module up and running on the Raspberry Pi.
I was testing a modified version of the RX_Demo and whilst it worked, after some period of time the CC1101 would fail to receive any further packets, and the only way to get it to work again was to stop the script and restart the device.
When using a variable length packets (PKTLEN of 0xFF) this issue would happen often. After a bit of analysing the MARCSTATE to see what was going on, I believe it is to do with either the bug in the CC1101 transceiver and/or the fact that the code can't handle RX or TX overflows/underflows, or any other weird MARCSTATE:
https://e2e.ti.com/support/wireless_connectivity/proprietary_sub_1_ghz_simpliciti/f/156/t/372505
https://e2e.ti.com/support/wireless_connectivity/proprietary_sub_1_ghz_simpliciti/f/156/t/17006
For my problem, it was specific to MARCSTATE values of 0x16 and 0x11.
To get around this, I put the following code at the top of packet_available() to flush the CC1101's buffers when MARCSTATE of 0x16 or 0x11 occurs. I suggest you include something similar.
//--------------------------[check if Packet is received]----------------------
uint8_t CC1100::packet_available()
{
//printf("Checking if packet is available: ");
uint8_t marcstate;
marcstate = (spi_read_register(MARCSTATE) & 0x1F);//read out state of
if (cc1100_debug == 1)
{
printf("marcstate_rx (in packet check): 0x%02X\n", marcstate);
}
if (marcstate == 0x16 || marcstate == 0x11)
{
// We have a underflow or overflow condition, need to flush
printf("========================= MARCSTATE ERROR ========================= ");
sidle();
spi_write_strobe(SFTX); delayMicroseconds(100); //flush the TX_fifo content
spi_write_strobe(SFRX); delayMicroseconds(100); //flush the RX_fifo content
receive();
}
I'm trying to read a signal from an 868,3 MHz lightswitch, but the cc1101 doesn't receive anything ._.
When I upload the Rx_demo sketch the console prints:
Init CC1100...
Partnumber:00
Version:14
...done
Mode:1
Frequency:3
Channel:3
My_Addr:3
Cfg_reg:
06 2E 80 07 57 43 3E 0E 45 03
03 08 00 21 65 6A F5 83 13 A0
F8 15 07 0C 18 16 6C 03 40 91
02 26 09 56 04 A9 0A 00 11 60
40 59 7F 3F 81 3F 0B
PaTable:
03 17 1D 26 50 86 CD C0
CC1101 RX Demo
nothing else...
Do you have any suggestions to fix this problem?
Thanks a lot!
Hello, we are trying to connect an Arduino Uno R3 with raspberri PI 3.
We installed in the raspberri the tx_demo and seems to work correctly, since we disconnected some pin on purpose and the example did not charge throwing error of module not found.
Then we load the arduino example, this runs until the line of the setup:
Cc1100.sidle (); // set to ILDE first
Exactly locks in the "while" of the next function
// ------------------------------- [end] -------------- ----------------------------
// | =========================== SPI Transmission ================ ============= |
Uint8_t CC1100 :: spi_putc (uint8_t data)
{
SPDR = date;
While (! (SPSR & (1 << SPIF))); // Warten bis Byte gesendet wurde
Return SPDR;
}
We have checked the connections many times and we do not see any errors.
Any ideas?
Here pictures of connections:
Red - Vcc
Black - GND
Yellow - GD2
Bordeaux - CSN
Green - SI
Blue - SCO
Orange - SCK
Thank you!!!
i wanted to run ur code on an arduino as a sender and a raspberry as a reciever but althought both code seems to be working just fine ,there is no paquet recieved in the raspberry .
Hey,
I want to use this library for transmitting more than thousand bytes as 61 bytes packets. And since I'm just going to decode the signal with RTL-SDR, How can I use CC1101 for just transmitting on the air without any addressing?
Thank you.
Could you clarify the wiring setup you are using? I think I understand it, but since I'm just getting started with the 1101 it is somewhat unclear since there appear to be some options. Just a note in the readme or in a source comment would be very helpful. Maybe I just missed it, but....
Also, a transmit example for the pi to go with the receive example would be helpful too.
Thanks!
Hi,
I have ported your library for use in STM32F4. I have changed the library from C++ to C.
I am facing a very peculiar problem. I can receive everything. (Broadcast as well as Address specific transmissions), but I am unable to send an ack or send any kind of data to any device.
The module is stuck in MARCSTATE 0x13 (Tx) and never comes out of Tx.
Things I have checked:
Any help you can give will be much appreciated.
Thanks,
Jaydip
While I try to use this lib to get my Arduinos communicate together, I follow the steps in the Readme.md, however,the RX_Demo shows following below
Partnumber:F1
Version:F1
...done
Mode:4
Frequency:2
Channel:1
My_Addr:3
Cfg_reg:
06 2E 80 07 57 43 3E 0E 45 03
01 0B 00 10 B0 71 2D 3B 73 A0
F8 00 07 0C 18 1D 1C C7 00 B2
02 26 09 B6 04 EA 0A 00 11 41
00 59 7F 3A 81 3F 0B
PaTable:
6C 1C 06 3A 51 85 C8 C0
and nothing more. The TX_Demo shows like this
Init CC1100...
Partnumber:00
Version:14
...done
Mode:4
Frequency:2
Channel:1
My_Addr:1
Cfg_reg:
06 2E 80 07 57 43 3E 0E 45 01
01 0B 00 10 B0 71 2D 3B 73 A0
F8 00 07 0C 18 1D 1C C7 00 B2
02 26 09 B6 04 EA 0A 00 11 49
00 59 7F 3C 81 3F 0B
PaTable:
6C 1C 06 3A 51 85 C8 C0
CC1101 TX Demo
TX_FIFO:060301000003E8
#:00
TX_FIFO:060301000003E8
#:01
tx_time: 511ms
TX_FIFO:060301000009CF
#:00
TX_FIFO:060301000009CF
So is it all right?
Not really a good issue, but I'm not sure how to use this library to accomplish the following setup I'm using with RfCat:
d.setFreq(868000000)
d.setMdmModulation(MOD_2FSK)
d.setMdmChanSpc(40000)
d.setMdmDeviatn(20000)
d.setMdmNumPreamble(32)
d.setMdmDRate(38391)
d.setMdmSyncWord(0xD201)
d.setMdmSyncMode(1)
d.makePktFLEN(20)
I've tried extending the RxDemo with:
cc1100_mode_select = 2;
cc1100_freq_select = 3;
before begin(..)
w and:
cc1100.set_sync_mode(1)
cc1100.spi_write_register(SYNC1, 0xD2);
cc1100.spi_write_register(SYNC0, 0x01);
If I configure PKTCTRL0 with the flag that doesn't gate the incoming the data, I'll get data in the buffer, so I'm fairly sure I've connected it correctly.
From the above settings, I think the mode and freq selects are correct, as are the other sync_mode/sync_word, but the datarate, channel spacing and deviation, I'm not sure how to set. I see this API, but it's not clear what I should feed it:
void CC1100::set_datarate(uint8_t mdmcfg4, uint8_t mdmcfg3, uint8_t deviant)
Is it an oversight that setting sync_word is not in the API?
hi
just tried to run the tx_demo and it says that there is no eeprom setting...
(i've run the eeprom wirte sketch before)
hope you can help me.. (arduino rookie).
Chris
Hi.
I've got some problem with TX_Demo and Arduino Nano. Used python, flashed eeprom, etc.
And now I have:
Init CC1100...
Partnumber:00
Version:14
...done
And nothing happens.
AFAIK, program hangs in sidle() cycle after receive() call in CC1100::begin() method. Have you ever met such a behavior? Could you, please, provide some explanations about methods chain or pin requirements to break this sidle() cycle?
When Tx is transmitting successfully, we ran Rx and this is what it displays in serial monitor:
12:59:12.482 -> Frequency:4
12:59:12.482 -> Channel:1
12:59:12.482 -> My_Addr:3
12:59:12.482 -> Cfg_reg:
12:59:12.482 -> 06 2E 24 47 57 43 FF 04 05 03
12:59:12.482 -> 01 06 00 23 31 3B 87 83 3B 22
12:59:12.482 -> F8 15 07 30 18 14 6C 07 00 92
12:59:12.482 -> 87 6B FB 56 07 E9 2A 00 1F 41
12:59:12.482 -> 00 59 7F 3F 81 35 09
12:59:12.482 -> PaTable:
12:59:12.482 -> 0B 1B 6D 67 50 85 C9 C1
12:59:12.482 -> CC1101 RX Demo
12:59:12.482 -> TX_Timecode: 0ms
12:59:12.482 ->
12:59:37.452 -> ...sleep MCU
Can't get any received data from Tx. Please comment if you have the solution.
Hi SpaceTeddy,
I realize that you are not supporting this anymore but i can't stop thinking what could be wrong.
I am trying to establish a connection between RPI and Arduino using CC1101. I have successfully converted the source code written in Energia to Arduino.For me the SRAM issue does not comes first since i am attempting to learn this wireless module.
Now, all i am doing now is sending sudo ./TX_Demo -v -a1 -r3 -i1000 -t5 -c1 -f434 -m100
to Arduino Rx_Demo.ino. I have played with different modulation and tx/rx addresses but all i see from arduino is ...sleep MCU
Any hint on this.Thank you in advance!
I ran into a strange problem when I was sending messages over the raspberry PI broatcast to multiple cc1101s broadcast, and one of the arduino went into a state of sleep or downtime (connected to an LED light strip, which went out).What's even more surprising is that when the raspberry PI is not broadcast but sends a single CC1101 (such as no.5), the arduino connected to another CC1101 (such as no.7) also enters the above state.If you encounter a similar situation, please advise the target of the problem location. thx
While I am struggling to get a signal I was asking myself if its even possible to use both commands, the TX_Demo and RX_Demo at the same time on a single raspberry pi (v1 Mod B+)
The only thing I am sometimes receiving on RX_Demo side is:
no bytes in RX buffer or RX Overflow!: 0x00
Thank you in advanced for any response
Hello there,
Amazing work with this project.
I was trying to use your library with SPI1 instead of SPI0
I made the next changes in the files:
$ sudo ./TX_Demo -v -a1 -r0 -i1000 -t5 -c1 -f315 -m100
CC1100 SW: Verbose option is set `'
Raspberry CC1101 SPI Library test
Init CC1100...
Version: 0x00
no CC11xx found!
any ideas?
Hi, I'm interested in using this code for a project.
I don't fully understand the hardware and code, so some example code would be helpful.
Thanks
Hi, could you please commit cc1101.h such that this can be compiled?
Hi!
I have some problems getting started with a newly arrived CS1100 Board.
Here is what i did:
g++ cc1100.cpp RX_Demo.cpp -lwiringPi -o rx
When calling the rx-program like: ./rx -f 434
I get the following error: no CC11xx found!
Debugged some around the code - also played with lower SPI-Speed and longer delays between reset-procedure - nothing. The Product and Version num remains on 0x00.
Hardware connections:
VCC --> RPi Header Pin 1
GND --> RPi Header Pin 25
SI --> RPi Header Pin 19
SO --> RPi Header Pin 21
SCK --> RPi Header Pin 23
GDO2 --> RPi Header Pin 24
Hello,
I did clone the project to my rpi and read your readme file. But now, I'm just blocked. I understood your code could help me for my project in node red. But i just don't know how to start the code know that I have the file on my pi.
Thanks for those who could help me or link me a tutorial, I searched for hours and didn't find anything.
Hi SpaceTeddy, thank you for your awesome library for interfacing CC1101 with AVR (Arduino) and Raspberry Pi.
However, I have recently added support for Texas Instrument's MSP430 MCUs. It's tested and works properly. My library is also completely compatible with yours and for that reason, communication between MSP430 and AVR is possible (Tested).
If you add my library with your repository, that will be helpful to many others, or you can just mention it in your readme - whatever you think is the best.
Best regards,
Avra
great job
i tried your work with different arduino boards and everything works great.
now I would like to send simple sensordata as text, string or char but i am not able to realize this.
is there a simple method to do this?
thank you in advance
I'd like to be able to use some of the source code, but the lack of a license provides no direction for attribution.
What changes are required to support 345 MHz? If 434 and 315 MHz work on a given CC1101 board and antenna, should 345 MHz also be supported? Should SMARTRFTM-STUDIO be used to find the configuration for 345 MHz, and then add it to the CC1101 library?
Hi,
I'm not very experienced with Arduino code and so this took me a little longer than normal. I've just managed to get your example code working and thought I'd give you feedback on the extra steps I had to perform to make it work.
My environment was Arduino 1.6.9 on a Windows platform, and a Rasberry Pi Zero W.
Therefore the RX needs to run as:
sudo ./RX_Demo -v -a3 -c1 -f434 -m250
After fixing the above issues the code worked a treat, many thanks,
Phil
Hello
First I will thank you for your awesome code. I really appreciate it!
My problem is that I'm trying to receive a packet that is send on 433,950MHz with OOK. If I send a packet with OOK, it works as I can review it with a RTL-SDR Dongle. I know that OOK is not available in the command line options but I enabled it in extending you switch-case statement with a additional case and sets the cc1100_mod_select value to 6. With my dongle I was able to determine the channel for 433,950 to channel 0.
For my testcase I use my car-key that sends out OOK packets at 433,950. But I'm not able to determine the correct address for my program. I don't know if an address is needed in this case? Can I set my CC1101 to some sort of promiscuous mode to receive all signals that will be sent on this frequency?
My command looks like(m1000 is the new switch-case value for OOK mode):
sudo ./RX_Demo -v -a3 -c0 -f434 -m1000 CC1100 SW: Verbose option is set
'
Raspberry CC1101 SPI Library test
Init CC1100...
Partnumber: 0x00
Version : 0x14
...done!
Mode: 6
Frequency: 2
Channel: 0
My_Addr: 3
Config Register:
0x06 0x2E 0x06 0x47 0x57 0x43 0xFF 0x04 0x05 0x03
0x00 0x06 0x00 0x10 0xB0 0x71 0x87 0x83 0x3B 0x22
0xF8 0x15 0x07 0x30 0x18 0x14 0x6C 0x07 0x00 0x92
0x87 0x6B 0xFB 0x56 0x04 0xEF 0x2B 0x14 0x1F 0x41
0x00 0x59 0x7F 0x3F 0x81 0x35 0x09
PaTable:
0x6C 0x1C 0x06 0x3A 0x51 0x85 0xC8 0xC0`
Thank you very much!
Hello,
I was trying your RX_Demo on Raspberry Pi 3, but I got stuck at the beginning.
I've tried running sudo ./RX_Demo -v -a3 -c1 -f868 -m100
, but the only output I got was this:
CC1100 SW: Verbose option is set `'
Raspberry CC1101 SPI Library test
Init CC1100...
Partnumber: 0x00
Version : 0x14
...done!
and the program stayed in infinite loop.
The problem is that when spi_write_strobe(SRX);
is performed, the program is waiting for RX state (0x0D
in MARCSTATE
register). But it will never reach this value.
Line 547 in 6f34280
I've tried to find out, what's happening during first iterations of while loop:
00: marcstate_rx: 0x0F
01: marcstate_rx: 0x0F
02: marcstate_rx: 0x0F
03: marcstate_rx: 0x0F
04: marcstate_rx: 0x0F
05: marcstate_rx: 0x0F
06: marcstate_rx: 0x0F
07: marcstate_rx: 0x0F
08: marcstate_rx: 0x0F
09: marcstate_rx: 0x0F
10: marcstate_rx: 0x0F
11: marcstate_rx: 0x0F
12: marcstate_rx: 0x0F
13: marcstate_rx: 0x0F
14: marcstate_rx: 0x0F
15: marcstate_rx: 0x0F
16: marcstate_rx: 0x0F
17: marcstate_rx: 0x0F
18: marcstate_rx: 0x0F
19: marcstate_rx: 0x0F
20: marcstate_rx: 0x1F
21: marcstate_rx: 0x00
22: marcstate_rx: 0x00
... (continuing with 0x00) ...
Am I doing something wrong? SPI is connected correctly, WiringPi is up to date... I am using this CC1101 module. Maybe it can be a hardware problem... maybe wrong piece.
Thank You for any help! 🙏 😄
Mirec
I have installed the package and library, followed the instructions to install the script onto an arduino but it only prints "Init CC1100..." and nothing else. I've already jumped into the code at it must be going wrong somewhere between line 374 and 405 because after that there should be an output. Any tips on how to debug this further?
I am using an arduino mega 2560 together with an E07-M1101D-SMA chip.
Hi ! I want to use a function that you have develop in https://github.com/SpaceTeddy/CC1101/blob/master/cc1100_arduino.cpp
to switch the signal modulation ("void CC1100::set_modulation_type"), but I don't now how to invoke in my arduino sketch. Can you help me?
Thank you!
To compile, changed includes in cc1100_raspi.cpp, RX_Demo.cpp, and TX_Demo.cpp to cc1100_raspi.h.
TX_Demo seems to crash and don't see message in SDR#.
pi@raspberrypi:~/dev/CC1101 $ sudo ./TX_Demo -a1 -c1 -f868 -m250
Raspberry CC1101 SPI Library test
Init CC1100...
Partnumber: 0x00
Version : 0x14
...done!
Mode: 4
Frequency: 3
Channel: 1
My_Addr: 1
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE9
#:0x01
The sensor uses 345Mhz, OOK modulation.
Looks like CC1100::set_ISM(uint8_t ism_freq) sets the frequency. How are frequency's set?
freq2=0x0C;
freq1=0x1D;
freq0=0x89;
spi_write_burst(PATABLE_BURST,patable_power_315,8);
Not receiving with the lib on Raspberry Pi.
Since two RPis are one foot apart, only left antenna on receiver. I verified using correct GDO2 pin with an LED, G25.
sudo ./RX_Demo -v -a3 -c1 -f434 -m100
CC1100 SW: Verbose option is set `'
Raspberry CC1101 SPI Library test
Init CC1100...
Partnumber: 0x00
Version : 0x14
...done!
Mode: 3
Frequency: 2
Channel: 1
My_Addr: 1
Config Register:
0x07 0x2E 0x80 0x07 0x57 0x43 0x3E 0x0E 0x45 0x01
0x01 0x08 0x00 0x10 0xB0 0x71 0x5B 0xF8 0x13 0xA0
0xF8 0x47 0x07 0x0C 0x18 0x1D 0x1C 0xC7 0x00 0xB2
0x02 0x26 0x09 0xB6 0x04 0xEC 0x2B 0x18 0x11 0x4D
0x00 0x59 0x7F 0x3C 0x81 0x3F 0x0B
PaTable:
0x6C 0x1C 0x06 0x3A 0x51 0x85 0xC8 0xC0
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE8
#:0x01
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE8
#:0x02
AND KEEPS echo out stuff
sudo ./RX_Demo -v -a3 -c1 -f434 -m100
CC1100 SW: Verbose option is set `'
Raspberry CC1101 SPI Library test
Init CC1100...
Partnumber: 0x00
Version : 0x14
...done!
Mode: 3
Frequency: 2
Channel: 1
My_Addr: 3
Config Register:
0x07 0x2E 0x80 0x07 0x57 0x43 0x3E 0x0E 0x45 0x03
0x01 0x08 0x00 0x10 0xB0 0x71 0x5B 0xF8 0x13 0xA0
0xF8 0x47 0x07 0x0C 0x18 0x1D 0x1C 0xC7 0x00 0xB2
0x02 0x26 0x09 0xB6 0x04 0xEC 0x2B 0x18 0x11 0x4E
0x40 0x59 0x7F 0x3C 0x81 0x3F 0x0B
PaTable:
0x6C 0x1C 0x06 0x3A 0x51 0x85 0xC8 0xC0
Can see signal at 434Mhz with SDR#, so something is being transmitted. RPi being used to receive can also transmit a signal visible on 434Mhz with SDR#.
Are there some checks that can be run to verify CC1101 is setup right?
How should this be debugged?
Hi !
I am trying to build the example for the Raspberry but I'm a complete C++ noob. I copied all .cpp and .h in the raspi example, and called g++ *.cpp but I get this error :
cc1100_raspi.cpp:12:20: fatal error: cc1100.h: No such file or directory
#include <cc1100.h>
I naively believed the cc1100_raspi.h file was the one I was looking for, so I renamed it, but the build still fails.
Could you provide instructions to build the library please ?
Thank you very much.
Can I connect more than 1 CC1101 with this code? Since my Raspberry Pi 3 b has 2 SPI busses ist should be possible to connect lets say one for RX and the other for X right? How can i do that?
I am Using CP06017 CC1101
Thank you
First thanks for this "first steps" to use the CC1100.
Using Arduino Rx_demo example (had cloned your repo into my libraries one, and moved examples in their own directories).
But I now have this error:
.../libraries/CC1101/cc1100_arduino.cpp:11:20: fatal error: cc1100.h: No such file or directory
#include <cc1100.h>
Tried to rename include inside cc1100_arduino.cpp file:
-#include <cc1100.h>
+#include <cc1100_arduino.h>
But got some other errors:
/Users/kenji/Documents/Arduino/libraries/CC1101/cc1100_arduino.cpp:356:60: error: no 'uint8_t CC1100::set_debug_level(uint8_t)' member function declared in class 'CC1100'
uint8_t CC1100::set_debug_level(uint8_t set_debug_level = 1) //default ON
^
/Users/kenji/Documents/Arduino/libraries/CC1101/cc1100_arduino.cpp:365:37: error: no 'uint8_t CC1100::get_debug_level()' member function declared in class 'CC1100'
uint8_t CC1100::get_debug_level(void)
^
What am I missing ?
Hi,
I have compiled the TX demo as is, and attempted to run it. I get the following output.
pi@raspberrypi:~/CC1101/examples/raspi $ sudo ./TX_Demo -v -a1 -r3 -i1000 -t5 -c1 -f434 -m100
CC1100 SW: Verbose option is set `'
Raspberry CC1101 SPI Library test
Init CC1100...
Partnumber: 0x00
Version : 0x14
...done!
Mode: 3
Frequency: 2
Channel: 1
My_Addr: 1
Config Register:
0x07 0x2E 0x80 0x07 0x57 0x43 0x3E 0x0E 0x45 0x01
0x01 0x08 0x00 0x10 0xB0 0x71 0x5B 0xF8 0x13 0xA0
0xF8 0x47 0x07 0x0C 0x18 0x1D 0x1C 0xC7 0x00 0xB2
0x02 0x26 0x09 0xB6 0x04 0xEC 0x0B 0x3D 0x11 0x4A
0x40 0x59 0x7F 0x3C 0x81 0x3F 0x0B
PaTable:
0x6C 0x1C 0x06 0x3A 0x51 0x85 0xC8 0xC0
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE9
#:0x01
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE9
#:0x02
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE9
#:0x03
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE9
#:0x04
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE9
#:0x05
TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE9
#:0x06
....
It seems like everything is setting up correctly, but the transmit packets keep failing the 6 retries
Is there anything obvious I should check?
Device is TI-CC1101 connected to Raspberry PI 2B via SPI pins.
Thanks!
Hi,
Is there anyway I can receive just the raw data and replay it later? This means I don't care for being able to understand the data format, modulation, or anything of the sort in my use case. I purely wish to be able to detect that some sort of RF is occurring, and replay it later.
I'm not too familiar with RF overall, but I tried to read the CC1101 documentation by Texas instruments, and disable all the filtering accordingly.
I ended up writing something like the following:
My_addr = 0;
wiringPiSetup(); //setup wiringPi library
cc1100.begin(My_addr); //setup cc1000 RF IC
cc1100.set_ISM(0x01);
cc1100.receive();
cc1100.set_channel(0x00);
cc1100.wor_disable();//No wor mode
cc1100.set_sync_mode(0x00);//No sync word
cc1100.set_myaddr(0x00);//No address checking
cc1100.set_data_whitening(0x00);//No data whitening
cc1100.set_fec(0x00);//No FEC
cc1100.set_preamble_len(0x00);//0 preamble length
cc1100.spi_write_register(PKTCTRL1, 0x00);//Disable addr check
cc1100.show_register_settings();
for (;;) {
delay(1);
uint8_t bytes_in_RXFIFO = cc1100.spi_read_register(RXBYTES);
if((bytes_in_RXFIFO & 0x7F)){
std::cout << "\nBytes to read!";
}
std::cout << "\n" << +bytes_in_RXFIFO;
}
Despite this, it always logs out 0's despite using an RF device near it (and seeing it show on something such as RTL-SDR).
Any idea how I can accomplish this?
Thank you in advance.
Did you use SmartRF Studio or some other reference?
I try to compile your examples under Raspbian Bullseye, but there are two Issues.
My solution:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
That seems to do the job.
git clone https://github.com/SpaceTeddy/CC1101
cd CC1101
cp ~/CC1101/examples/raspi/*.cpp ~/CC1101
sudo g++ -lwiringPi RX_Demo.cpp cc1100_raspi.cpp -o RX_Demo
This will lead to linking errors:
/usr/bin/ld: /tmp/ccFh2Z7u.o: in function `main':
RX_Demo.cpp:(.text+0x4e8): undefined reference to `wiringPiSetup'
/usr/bin/ld: RX_Demo.cpp:(.text+0x528): undefined reference to `delay'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::reset()':
cc1100_raspi.cpp:(.text+0x18): undefined reference to `digitalWrite'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0x20): undefined reference to `delayMicroseconds'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0x2c): undefined reference to `digitalWrite'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0x34): undefined reference to `delayMicroseconds'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0x48): undefined reference to `delay'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::wakeup()':
cc1100_raspi.cpp:(.text+0xa0): undefined reference to `digitalWrite'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0xa8): undefined reference to `delayMicroseconds'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0xb4): undefined reference to `digitalWrite'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0xbc): undefined reference to `delayMicroseconds'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::begin(unsigned char volatile&)':
cc1100_raspi.cpp:(.text+0x154): undefined reference to `pinMode'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0x160): undefined reference to `pinMode'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0x1b8): undefined reference to `delayMicroseconds'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0x1cc): undefined reference to `delayMicroseconds'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::sidle()':
cc1100_raspi.cpp:(.text+0x55c): undefined reference to `delayMicroseconds'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::transmit()':
cc1100_raspi.cpp:(.text+0x5c8): undefined reference to `delayMicroseconds'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::receive()':
cc1100_raspi.cpp:(.text+0x634): undefined reference to `delayMicroseconds'
/usr/bin/ld: /tmp/ccK6h5Rx.o:cc1100_raspi.cpp:(.text+0x6d8): more undefined references to `delayMicroseconds' follow
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::sent_packet(unsigned char, unsigned char, unsigned char*, unsigned char, unsigned char)':
cc1100_raspi.cpp:(.text+0xa80): undefined reference to `delay'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::packet_available()':
cc1100_raspi.cpp:(.text+0xba0): undefined reference to `digitalRead'
/usr/bin/ld: cc1100_raspi.cpp:(.text+0xbec): undefined reference to `digitalRead'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::wait_for_packet(unsigned short)':
cc1100_raspi.cpp:(.text+0x1128): undefined reference to `delay'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::spi_begin()':
cc1100_raspi.cpp:(.text+0x1a78): undefined reference to `wiringPiSPISetup'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::spi_write_register(unsigned char, unsigned char)':
cc1100_raspi.cpp:(.text+0x1b14): undefined reference to `wiringPiSPIDataRW'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::spi_read_register(unsigned char)':
cc1100_raspi.cpp:(.text+0x1b70): undefined reference to `wiringPiSPIDataRW'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::spi_write_strobe(unsigned char)':
cc1100_raspi.cpp:(.text+0x1bc4): undefined reference to `wiringPiSPIDataRW'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::spi_read_burst(unsigned char, unsigned char*, unsigned char)':
cc1100_raspi.cpp:(.text+0x1cac): undefined reference to `wiringPiSPIDataRW'
/usr/bin/ld: /tmp/ccK6h5Rx.o: in function `CC1100::spi_write_burst(unsigned char, unsigned char*, unsigned char)':
cc1100_raspi.cpp:(.text+0x1e24): undefined reference to `wiringPiSPIDataRW'
collect2: error: ld returned 1 exit status
Can you pleas help me?
I am trying to modify the RX_Demo to trigger a script based on the received data, but I am unable to compare the received data to anything.
I don't know how to compare the Rx_fifo buffer to a pre-set value.
I want to make a simple if comparison, e.g.
if (Rx_fifo == 0x06 0x02 0x01 0x01 0x01 0x01 0x01)
But that is clearly not the solution.
Can someone help me?
Hi,
im running your RX_Demo on a Raspberry as following:
sudo ./RX_Demo -f 868 -v
Some Stuff is Running on that Frequency but nothing will be received. The last Output is "PaTable: 0x03 0x17...". Whats wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.