nrf52- SPI read/MISO with bit offset

Hi

I am using nRF52832 , SDK17, S132, reading a device ID which should be 0x67, I am reading 0x33, than 0x80 ,so it seems to be that the MISO window is getting offseted *

* as 0x67 is 1100111 and 0x33,0x80 is 110011,1000000

There is another device on the bus which I can read (its device ID) correctly, so its very weird.

what can cause this? and how can it be fixed?

Here is the SPI configuration

#define NRF_DRV_SPI_DEFAULT_CONFIG                           \
{                                                            \
    .sck_pin      = NRF_DRV_SPI_PIN_NOT_USED,                \
    .mosi_pin     = NRF_DRV_SPI_PIN_NOT_USED,                \
    .miso_pin     = NRF_DRV_SPI_PIN_NOT_USED,                \
    .ss_pin       = NRF_DRV_SPI_PIN_NOT_USED,                \
    .irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY,         \
    .orc          = 0xFF,                                    \
    .frequency    = NRF_DRV_SPI_FREQ_500K,                     \
    .mode         = NRF_DRV_SPI_MODE_0,                      \
    .bit_order    = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST,         \
}

nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
err_code = nrf_drv_spi_init(&spi, &spi_config, NULL, NULL);

Thanks

Ron

Related