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

SPI connection between nrf52832 and Raspberry 3 Pi

Hello guys,

I'm having problems with communication between a dwm1001 module (from Decawave) which is a nrf52832 board, and my Raspberry 3 Pi model B.

I have connected the nrf52832 board to the Raspberry using the 26-pins header

My goal is to send/write a message from Raspberry to dwm1001 module. Inside the Raspberry I wrote a simple python script in order to write to the SPI port:

Fullscreen
1
2
3
4
5
6
7
8
9
10
import spidev
import time
spi = spidev.SpiDev()
spi.open(0,0)
spi.mode = 0b00
while True:
data = [ 0xcc ]
resp = spi.xfer(data)
print resp
time.sleep(1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

So, now I don't know if this *is* the correct way, but I have found this in internet.

In the other side, that is the nrf52832 board, I currently implemented the C code firmware so read from SPI.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#define SPI_INSTANCE 0 /**< SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */
static volatile bool spi_xfer_done; /**< Flag used to indicate that SPI instance completed the transfer. */
#define TEST_STRING "Nordic"
static uint8_t m_tx_buf[] = TEST_STRING; /**< TX buffer. */
static uint8_t m_rx_buf[sizeof(TEST_STRING) + 1]; /**< RX buffer. */
static const uint8_t m_length = sizeof(m_tx_buf); /**< Transfer length. */
/**
* @brief SPI user event handler.
* @param event
*/
void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
void * p_context)
{
spi_xfer_done = true;
NRF_LOG_INFO("Transfer completed.");
if (m_rx_buf[0] != 0)
{
NRF_LOG_INFO(" Received:");
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

But I cannot read anything. In practice I checked that the flow passes through the spi_event_handler function, but my goal is not reached.

Finally, my very final goal is the following:

Thanks in advance.