This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI inconsistent read

Hello ! When I make a read with the SPI from a sensor's register the data sometimes comes correct and most of the time wrong. I tested the read operation with an Arduino and it always comes correct. Why is that problem ? I am using NRF51822 with s130, softdevice enabled.

Parents
  • May be problem with the clock speed. If the sensor can't operate at high speed and the clock in the mater is high then you get the problem in reading. try to check with the low frequency as possible.

  • Hello ! I am using nrd_drv_spi. In the spi function I believe I made the right configuration. This is my configuration:

    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG(SPI_INSTANCE);
    spi_config.sck_pin = SPI_SCK_PIN;
    spi_config.mosi_pin = SPI_MOSI_PIN;
    spi_config.miso_pin = SPI_MISO_PIN;
    spi_config.ss_pin = SPI_CS_PIN;
    spi_config.irq_priority = APP_IRQ_PRIORITY_HIGHEST;
    spi_config.frequency = NRF_DRV_SPI_FREQ_250K;
    error1 = nrf_drv_spi_init(&spi, &spi_config, spi_update_imu_data);
    

    Where error1 is NRF_SUCCESS, and all the macros for the pins have been checked and are the correct ones.

Reply
  • Hello ! I am using nrd_drv_spi. In the spi function I believe I made the right configuration. This is my configuration:

    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG(SPI_INSTANCE);
    spi_config.sck_pin = SPI_SCK_PIN;
    spi_config.mosi_pin = SPI_MOSI_PIN;
    spi_config.miso_pin = SPI_MISO_PIN;
    spi_config.ss_pin = SPI_CS_PIN;
    spi_config.irq_priority = APP_IRQ_PRIORITY_HIGHEST;
    spi_config.frequency = NRF_DRV_SPI_FREQ_250K;
    error1 = nrf_drv_spi_init(&spi, &spi_config, spi_update_imu_data);
    

    Where error1 is NRF_SUCCESS, and all the macros for the pins have been checked and are the correct ones.

Children
No Data
Related