Skip to content
This repository has been archived by the owner on Dec 20, 2020. It is now read-only.

Setting CC1101's configuration (no longer) works #1

Closed
wklenk opened this issue Oct 25, 2015 · 1 comment
Closed

Setting CC1101's configuration (no longer) works #1

wklenk opened this issue Oct 25, 2015 · 1 comment

Comments

@wklenk
Copy link
Owner

wklenk commented Oct 25, 2015

After an update of my Rasperry Pi to "Jessie", I found out that setting the configuration of the CC1101 no longer works. Unfortunately, there is no output of an error message, so it just doesn't work and you don't notice why.

Reason seems to be changes in the IOCTL structure for doing SPI communication. In particular, the SPI write burst no longer works. This write burst is used to the the CC1101's configuration.

@wklenk
Copy link
Owner Author

wklenk commented Oct 25, 2015

The problem is analyzed here:

https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=97978

As Rasbian "Jessie" is using a newer kernel, an additional attribute "pad" was added to the struct spi_ioc_transfer. Not setting this new attribute to a defined value caused the problems.

The file /usr/include/linux/spi/spidev.h says:
Zero-initialize the structure, including currently unused fields, to accommodate potential future updates.

The solution to the issue is exactly to do so: Initialize the structure with zeros
struct spi_ioc_transfer tr;
memset(&tr, 0, sizeof tr);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant