Hi all,
I'm trying to use the nRF52840-DK board to interface with the MAX31865 RTD-to-Digital Converter. I've adapted the MAX31865 C++ library to C and replaced the Arduino SPI functions with the Nordic functions. Currently I am unable to receive back any value from the sensor even though the SPI transfer is completed.
The initialisation of SPI and pins is as follow:
/* Defines - SPI -----------------------------------------------------------*/ #define SPI_INSTANCE 0 /**< SPI instance index. */ static const nrf_drv_spi_t spi_temp1 = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */ static volatile bool spi_xfer_done; /**< Flag used to indicate that SPI instance completed the transfer. */ void max31865_init(void) { nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG; spi_config.ss_pin = SPI_SS_PIN; spi_config.miso_pin = SPI_MISO_PIN; spi_config.mosi_pin = SPI_MOSI_PIN; spi_config.sck_pin = SPI_SCK_PIN; spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST; spi_config.frequency = NRF_DRV_SPI_FREQ_2M; spi_config.mode = NRF_DRV_SPI_MODE_3; APP_ERROR_CHECK(nrf_drv_spi_init(&spi_temp1, &spi_config, spi_event_handler, NULL)); NRF_LOG_INFO("SPI example started."); }
SPI Transfer:
nrf_drv_spi_xfer_desc_t xfer_desc; xfer_desc.p_tx_buffer = &address; xfer_desc.tx_length = sizeof(address); xfer_desc.p_rx_buffer = rxBuffer; xfer_desc.rx_length = n; APP_ERROR_CHECK(nrf_drv_spi_xfer(&spi_temp1, &xfer_desc, 0));
Is there anything significant missing in the initialisation step or something to look as to why nRF doesn't receive anything back?
Thanks