Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

SPI communication between STM32F7ZI and NRF52833DK

I need to set up communication between STM32FZI (Acting as Master) and NRF52833DK (Acting as Slave). But when I use the spis slave example in the NRF5 SDK, the communication is established but the data received is not the correct size. I am sending the message "SPI" from the STM32 but on the receiving end sometimes "SPIS", "PIS", and "P" is seen. I have checked using the oscilloscope and the data sent on the MOSI line is correct and the bytes represent "SPI". When and how does the spis_event_handler get called exactly? Since there is only one function (namely nrf_drv_spis_buffers_set) to execute the transfer while multiple are present in STM32F7 API, how does the DMA function?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "main.h"
enum {
TRANSFER_WAIT,
TRANSFER_COMPLETE,
TRANSFER_ERROR
};
UART_HandleTypeDef UartHandle;
#ifdef __GNUC__
/* With GCC, small printf (option LD Linker->Libraries->Small printf
set to 'Yes') calls __io_putchar() */
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */
/* SPI handler declaration */
SPI_HandleTypeDef SpiHandle;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "sdk_config.h"
#include "nrf_drv_spis.h"
#include "nrf_gpio.h"
#include "boards.h"
#include "app_error.h"
#include <string.h>
#include "nrf_delay.h"
#include "nrf_uart.h"
#include "app_uart.h"
#include <stdio.h>
#define SPIS_INSTANCE 1
static const nrf_drv_spis_t spis = NRF_DRV_SPIS_INSTANCE(SPIS_INSTANCE);
#define BUFSIZE 7
static uint8_t m_tx_buf[BUFSIZE] = "NORDIC";
static uint8_t m_rx_buf[BUFSIZE];
static volatile bool spis_xfer_done;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

COM3 - NRF52833 , COM5 - STM32f7