28757b2 / cc1101-driver Goto Github PK
View Code? Open in Web Editor NEWLinux device driver for the Texas Instruments CC1101 radio
License: GNU General Public License v2.0
Linux device driver for the Texas Instruments CC1101 radio
License: GNU General Public License v2.0
Hi,
I'm having some problems installing the cc1101-driver, I've followed the procedure but can't get the overlay loaded.
FIrst: When trying to insert the module I get the below message:
pi@raspberrypi:~/cc1101-driver $ sudo insmod cc1101.ko
insmod: ERROR: could not insert module cc1101.ko: Device or resource busy
The insmod command is working after a reboot and can see it loaded with lsmod.
Second:
The cc1101 overlay is not loading. I can't see the expected /dev/cc1101.x.x.
Also the /dev/spidev0.x is also gone.
After removing the /boot/overlays/cc1101.dtbo the spidev0.x appears again and is working fine.
When I try to add the overlay I get the below message:
pi@raspberrypi:~/cc1101-driver $ sudo dtoverlay -v /boot/overlays/cc1101.dtbo
DTOVERLAY[debug]: using platform 'bcm2835'
DTOVERLAY[debug]: overlay map loaded
run_cmd: which dtoverlay-pre >/dev/null 2>&1 && dtoverlay-pre
DTOVERLAY[debug]: loading file '/boot/overlays/cc1101.dtbo'
DTOVERLAY[debug]: wrote 2026 bytes to '/tmp/.dtoverlays/0_cc1101.dtbo'
DTOVERLAY[debug]: wrote 2026 bytes to '/sys/kernel/config/device-tree/overlays/0_cc1101/dtbo'
dmesg:
[ 238.440197] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/spidev@0/status
[ 238.440233] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/spidev@1/status
[ 238.440266] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/pinctrl-names
[ 238.440290] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/pinctrl-0
[ 238.440314] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/cs-gpios
Any tips? Am I missing some dependencies or wrong version?
When sudo dkms build -m cc1101 -v 1.4.0 that give's me error.
Hello there!
I am trying to use this driver to implement a small proof of concept I wrote to send a captured RF signal. I am using an arduino to send the signal by turning the transmission on and off at specific intervals using asynchronous mode (e.g: '1' for 4000us, '0' for 100us, etc etc).
I am not sure how to translate that functionality here, my best guess is that I have to generate a bytestream that represents the same signal by calculating the bytes depending on the selected baud rate, so for instance if I have to send '1' during 600us and I have a baud rate of 100kbps, In theory I would need to send 10 bits, so that needs to be converted into 2 bytes with padding, correct?
The problem I'm running into is that my captured signal is rather long: it was around 18678 bytes @ 100kbps and it would appear the maximum packet size is 1024. I have some intervals that are 60us so I could reduce the baudrate to about 16kbps but I'm wondering if either my assumptions are wrong or perhaps there is a cleaner way to "stream" data to the radio?
I could fragment the packet into several 1K packets, but I'm afraid the additional processing might introduce delays and botch the signal.
Any ideas?
Thanks!
Long packets are not sent completely, "tail" is trimmed.
How to reproduce:
Observed:
Probable root cause:
It seems that packet remainder in tx_multi() is written to TX FIFO too early without making sure that there is a place for it. This causes TX FIFO corruption and transmission cancelation.
DKMS error:
root@raspberrypi:/usr/src/cc1101-1.3.2# sudo dkms build -m cc1101 -v 1.3.2
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
KDIR=/lib/modules/5.15.32-v8+/build MDIR=/lib/modules/5.15.32-v8+ make......(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.15.32-v8+ (aarch64)
Consult /var/lib/dkms/cc1101/1.3.2/build/make.log for more information.
DKMS make.log for cc1101-1.3.2 for kernel 5.15.32-v8+ (aarch64)
Wed 13 Jul 22:11:38 CEST 2022
make -C /lib/modules/5.15.32-v8+/build M=/var/lib/dkms/cc1101/1.3.2/build modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.32-v8+'
CC [M] /var/lib/dkms/cc1101/1.3.2/build/cc1101_main.o
CC [M] /var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.o
In file included from ./include/linux/device.h:15,
from ./include/linux/cdev.h:8,
from /var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:5:
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c: In function ‘chrdev_ioctl’:
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:253:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
253 | CC1101_ERROR(cc1101, "Unknown Command %d, %d, %d\n", cmd, sizeof(cc1101_rx_config_t), sizeof(cc1101_tx_config_t));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:110:16: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
./include/linux/dev_printk.h:144:49: note: in expansion of macro ‘dev_fmt’
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
/var/lib/dkms/cc1101/1.3.2/build/cc1101_internal.h:124:46: note: in expansion of macro ‘dev_err’
124 | #define CC1101_ERROR(cc1101, format, ...) dev_err(&cc1101->spi->dev, format "\n", ##__VA_ARGS__)
| ^~~~~~~
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:253:13: note: in expansion of macro ‘CC1101_ERROR’
253 | CC1101_ERROR(cc1101, "Unknown Command %d, %d, %d\n", cmd, sizeof(cc1101_rx_config_t), sizeof(cc1101_tx_config_t));
| ^~~~~~~~~~~~
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:253:56: note: format string is defined here
253 | CC1101_ERROR(cc1101, "Unknown Command %d, %d, %d\n", cmd, sizeof(cc1101_rx_config_t), sizeof(cc1101_tx_config_t));
| ~^
| |
| int
| %ld
In file included from ./include/linux/device.h:15,
from ./include/linux/cdev.h:8,
from /var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:5:
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:253:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long unsigned int’ [-Wformat=]
253 | CC1101_ERROR(cc1101, "Unknown Command %d, %d, %d\n", cmd, sizeof(cc1101_rx_config_t), sizeof(cc1101_tx_config_t));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:110:16: note: in definition of macro ‘dev_printk_index_wrap’
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
./include/linux/dev_printk.h:144:49: note: in expansion of macro ‘dev_fmt’
144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
/var/lib/dkms/cc1101/1.3.2/build/cc1101_internal.h:124:46: note: in expansion of macro ‘dev_err’
124 | #define CC1101_ERROR(cc1101, format, ...) dev_err(&cc1101->spi->dev, format "\n", ##__VA_ARGS__)
| ^~~~~~~
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:253:13: note: in expansion of macro ‘CC1101_ERROR’
253 | CC1101_ERROR(cc1101, "Unknown Command %d, %d, %d\n", cmd, sizeof(cc1101_rx_config_t), sizeof(cc1101_tx_config_t));
| ^~~~~~~~~~~~
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:253:60: note: format string is defined here
253 | CC1101_ERROR(cc1101, "Unknown Command %d, %d, %d\n", cmd, sizeof(cc1101_rx_config_t), sizeof(cc1101_tx_config_t));
| ~^
| |
| int
| %ld
In file included from /var/lib/dkms/cc1101/1.3.2/build/cc1101_internal.h:9,
from /var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:8:
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c: In function ‘chrdev_read’:
./include/linux/kfifo.h:696:27: error: initialization of ‘unsigned int *’ from incompatible pointer type ‘size_t *’ {aka ‘long unsigned int *’} [-Werror=incompatible-pointer-types]
696 | unsigned int *__copied = (copied); \
| ^
/var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.c:289:9: note: in expansion of macro ‘kfifo_to_user’
289 | if (kfifo_to_user(&cc1101->rx_fifo, buf, len, &out_bytes) != 0) {
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/cc1101/1.3.2/build/cc1101_chrdev.o] Error 1
make[1]: *** [Makefile:1868: /var/lib/dkms/cc1101/1.3.2/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.32-v8+'
make: *** [Makefile:5: all] Error 2
This is on the latest raspberry pi OS
Hello, I am having an issue that it seems another person has had. However, I utilized the latest download and checked the file to make sure it matched. Do you have any idea of what would be causing this or where to look/troubleshoot?
11.390317] cc1101 spi0.1: Device not found (Partnum: 0x00, Version: 0x00)
11.440640] cc1101 spi0.0: Device not found (Partnum: 0x00, Version: 0x00)
I am using this on a Pi Zero W and using DietPi. I tried Bullseye and Buster previously.
This seems to be the same issue that danucu was having
Neither:
sudo dkms build -m cc1101 -v 1.4.0
nor:
sudo dkms build -m cc1101 -v 1.3.3
work - the make.log that I get for them are:
DKMS make.log for cc1101-1.4.0 for kernel 6.1.0-rpi7-rpi-v8 (aarch64)
Mon 15 Jan 20:39:20 CST 2024
make -C /lib/modules/6.1.0-rpi7-rpi-v8/build M=/var/lib/dkms/cc1101/1.4.0/build modules
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
CC [M] /var/lib/dkms/cc1101/1.4.0/build/cc1101_main.o
/var/lib/dkms/cc1101/1.4.0/build/cc1101_main.c:161:15: error: initialization of ‘void (*)(struct spi_device *)’ from incompatible pointer type ‘int (*)(struct spi_device *)’ [-Werror=incompatible-pointer-types]
161 | .remove = cc1101_spi_remove,
| ^~~~~~~~~~~~~~~~~
/var/lib/dkms/cc1101/1.4.0/build/cc1101_main.c:161:15: note: (near initialization for ‘cc1101_driver.remove’)
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/scripts/Makefile.build:255: /var/lib/dkms/cc1101/1.4.0/build/cc1101_main.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/Makefile:2039: /var/lib/dkms/cc1101/1.4.0/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
make: *** [Makefile:5: all] Error 2
and:
DKMS make.log for cc1101-1.3.3 for kernel 6.1.0-rpi7-rpi-v8 (aarch64)
Mon 15 Jan 20:45:48 CST 2024
make -C /lib/modules/6.1.0-rpi7-rpi-v8/build M=/var/lib/dkms/cc1101/1.3.3/build modules
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
CC [M] /var/lib/dkms/cc1101/1.3.3/build/cc1101_main.o
/var/lib/dkms/cc1101/1.3.3/build/cc1101_main.c:161:15: error: initialization of ‘void (*)(struct spi_device *)’ from incompatible pointer type ‘int (*)(struct spi_device *)’ [-Werror=incompatible-pointer-types]
161 | .remove = cc1101_spi_remove,
| ^~~~~~~~~~~~~~~~~
/var/lib/dkms/cc1101/1.3.3/build/cc1101_main.c:161:15: note: (near initialization for ‘cc1101_driver.remove’)
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/scripts/Makefile.build:255: /var/lib/dkms/cc1101/1.3.3/build/cc1101_main.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/Makefile:2039: /var/lib/dkms/cc1101/1.3.3/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
make: *** [Makefile:5: all] Error 2
Hi,
I'm having some problems installing the cc1101-driver, I've followed the procedure but can't get the overlay loaded.
FIrst: When trying to insert the module I get the below message:
pi@raspberrypi:~/cc1101-driver $ sudo insmod cc1101.ko
insmod: ERROR: could not insert module cc1101.ko: Device or resource busy
The insmod command is working after a reboot and can see it loaded with lsmod.
Second:
The cc1101 overlay is not loading. I can't see the expected /dev/cc1101.x.x.
Also the /dev/spidev0.x is also gone.
After removing the /boot/overlays/cc1101.dtbo the spidev0.x appears again and is working fine.
When I try to add the overlay I get the below message:
pi@raspberrypi:~/cc1101-driver $ sudo dtoverlay -v /boot/overlays/cc1101.dtbo
DTOVERLAY[debug]: using platform 'bcm2835'
DTOVERLAY[debug]: overlay map loaded
run_cmd: which dtoverlay-pre >/dev/null 2>&1 && dtoverlay-pre
DTOVERLAY[debug]: loading file '/boot/overlays/cc1101.dtbo'
DTOVERLAY[debug]: wrote 2026 bytes to '/tmp/.dtoverlays/0_cc1101.dtbo'
DTOVERLAY[debug]: wrote 2026 bytes to '/sys/kernel/config/device-tree/overlays/0_cc1101/dtbo'
dmesg:
[ 238.440197] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/spidev@0/status
[ 238.440233] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/spidev@1/status
[ 238.440266] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/pinctrl-names
[ 238.440290] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/pinctrl-0
[ 238.440314] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/spi@7e204000/cs-gpios
Any tips? Am I missing some dependencies or wrong version?
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.