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

using UART without bsp file problem

Hi!

I want to use UART function in my own project, base on ble_app_template. but when I remove bsp module & board.h, add my custom pin config file, I can't see any UART output and BLE advertising, the chip seem restart all the time.

SDK:10

Softdevice:S110 V8.0.0

Chip:nrf51422QFAC

There is my code(reference examples\peripheral\uart & examples\ble_peripheral\ble_app_uart)

1.remove:

bsp.c

bsp_btn_ble.c

app_uart.c

2.add:

app_uart_fifo.c

app_fifo.c

add code:

include:

#include "app_uart.h"

UART INIT:

   const app_uart_comm_params_t comm_params =
{
    RX_PIN_NUMBER,
    TX_PIN_NUMBER,
    RTS_PIN_NUMBER,
    CTS_PIN_NUMBER,
    APP_UART_FLOW_CONTROL_DISABLED,
    false,
    UART_BAUDRATE_BAUDRATE_Baud38400
};

APP_UART_FIFO_INIT( &comm_params,
                   UART_RX_BUF_SIZE,
                   UART_TX_BUF_SIZE,
                   uart_error_handle,
                   APP_IRQ_PRIORITY_LOW,
                   err_code);
APP_ERROR_CHECK(err_code);

uart_error_handle

void uart_error_handle(app_uart_evt_t * p_event){
if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR)
{
    APP_ERROR_HANDLER(p_event->data.error_communication);
}
else if (p_event->evt_type == APP_UART_FIFO_ERROR)
{
    APP_ERROR_HANDLER(p_event->data.error_code);
}}

my custom pin config file (.h)

#define TX_PIN_NUMBER		17
#define RX_PIN_NUMBER		18
#define CTS_PIN_NUMBER		10
#define RTS_PIN_NUMBER		8

did I miss anything?

Related