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

How to Receive data with SPI from sensor and output with UART

Hi!!

I would like to receive data from the sensor via SPI using nrf 52832 DK and output data with UART.

It is now possible to add the function of uart to the spi sample code of SDK 14.0.0 and run it only with uart.

However, it is not possible to receive data from the sensor and output it with uart

I think that it is outputting the contents of an empty array.

How can I receive data from an external sensor via spi and output data with uart?

I mainly send and receive SPI and send uart data with the following code

best regards!!!



void SPITxDummy(unsigned char Data)
{
nrf_gpio_pin_clear(22); //CS pin low
nrf_drv_spi_transfer(&spi, &Data, 1, m_rx_buf, 1);
nrf_delay_us(50);
}

while (1)
{
SPITxDummy(0x00); //Dummy Data
app_uart_put(m_rx_buf[0]);
nrf_delay_ms(200);

}

Related