Tool/software: Linux
Hi,
I have develop cc1101 driver in linux. When I will try to receive data from configuration register then get the 0x7h value in all the time.
Below are snap of my code.
Reference: github.com/.../CC1101SocketDriver
uint8_t Spi::readSingleByte(const uint8_t address, uint8_t& value) {
static const int LEN = 2;
uint8_t tx[LEN] = {0x80 | address, 0x00};
uint8_t rx[LEN];
struct spi_ioc_transfer tr;
memset(&tr, 0, sizeof tr);
tr.tx_buf = (unsigned long)tx;
tr.rx_buf = (unsigned long)rx;
tr.len = LEN;
tr.speed_hz = this->speed;
tr.bits_per_word = this->bits;
int rc = ioctl(this->fd_spi, SPI_IOC_MESSAGE(1), &tr);
if (rc < 0) {
perror("SPI single byte read failed");
abort();
}
value = rx[1];
DateTime::print();
printf("read single byte address=0x%.2X status=0x%.2X value=0x%.2X\n", address, rx[0], value);
// CHIP_RDYn (Bit 7)
// Stays high until power and crystal have stabilized.
// Should always be low when using the SPI interface.
assert((rx[0] & 0x80) == 0);
return rx[0];
}