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?

Parents
  • Hi,

    If you have a custom board, you should instead create your own board file. Don’t remove the bsp module.

    You can find the board files under:

    \SDK_INSTALL_FOLDER\examples\bsp
    

    When creating a new board file, simply copy the e.g. the pca10028.h file, rename it, and modify it after your requirements (change pin configuration). Then you have to modify boards.h to support your new file, and add a new define that you specify in the Keil options to include your modified file(Options for Target -> C/C++ tab-> Define-> remove BOARD_PCA10028 and add your BOARD_CUSTOM). The bsp module is very dynamic, and will configure according to your board file.

Reply
  • Hi,

    If you have a custom board, you should instead create your own board file. Don’t remove the bsp module.

    You can find the board files under:

    \SDK_INSTALL_FOLDER\examples\bsp
    

    When creating a new board file, simply copy the e.g. the pca10028.h file, rename it, and modify it after your requirements (change pin configuration). Then you have to modify boards.h to support your new file, and add a new define that you specify in the Keil options to include your modified file(Options for Target -> C/C++ tab-> Define-> remove BOARD_PCA10028 and add your BOARD_CUSTOM). The bsp module is very dynamic, and will configure according to your board file.

Children
Related