I'm using the arduino_spi device at 1MHz. Writes seem to work fine (the target device is responding as expected) but reads only change the first byte of the rx buffer to 0x80. The LA shows what appears to be correct data coming back from the target. Any ideas? Thanks!
static int32_t nrf7002_spi_read(void* rx_buff, size_t length) { int32_t result = length; uint8_t tx_buff[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // Perform SPI write operation struct spi_buf tx_buf = { .buf = &tx_buff, .len = length, }; struct spi_buf_set tx = { .buffers = &tx_buf, .count = 1, }; // Perform SPI read operation struct spi_buf rx_buf = { .buf = rx_buff, .len = length, }; struct spi_buf_set rx = { .buffers = &rx_buf, .count = 1, }; // Start read transaction gpio_pin_set_dt(&GPO_SPI_CS_N, 1); int error; #ifdef CONFIG_SPI_ASYNC error = spi_transceive_signal(spi_dev, spi_cfg(), &tx, &rx, &spi_done_sig); // error = spi_read_signal(spi_dev, spi_cfg(), &rx, &spi_done_sig); if (error != 0){ printk("SPI read error: %i\n", error); result = error; } else { // Wait for transaction to end. int spi_signaled, spi_result; do { k_usleep(10); k_poll_signal_check(&spi_done_sig, &spi_signaled, &spi_result); } while(spi_signaled == 0); result = spi_result ? spi_result : length; } #else error = spi_read(spi_dev, spi_cfg(), &rx); if (error != 0){ printk("SPI read error: %i\n", error); result = error; } #endif /* CONFIG_SPI_ASYNC */ gpio_pin_set_dt(&GPO_SPI_CS_N, 0); return result; }