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

Program stops when UART and SPI are used at the same time.

Hello, I am a student studying firmware

I want to use SPI and UART in one project at the same time.

The soft program uses KEIL and is the latest version.

Code generation(Arm compiler) is V5.06 update 6. Computer's platform is Windows.

I added the contents of the uart example to the spi example to use spi and uart at the same time.

I set the link to include app_uart.h and added the necessary part in sdk_config.h.

Compilation does not generate an error, but the spi function is not executed in the hardware and the spi function stops working.

APP_ERROR_CHECK (nrf_drv_spi_transfer (& spi, m_tx_buf, m_length, m_rx_buf, m_length) of the spi function is not executed
at the moment of appending APP_UART_FIFO_INIT (& comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_error_handle, APPTERa_IRQ_PRIORITY_LOWEST, err_code).

The pin numbers of spi and uart were confirmed.

How can I use uart and spi in one project?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// spi header file
#include "nrf_drv_spi.h"
#include "app_util_platform.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#include "boards.h"
#include "app_error.h"
#include <string.h>
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
// uart header file
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "app_uart.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "nrf.h"
#include "bsp.h"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX