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

UART Connection NRF52832 with Raspberry Pi

I am trying to transferAdvertisement data from NRF52832 to Raspberry PI using BLE_app_UART example. I have updated the config as below,

app_uart_comm_params_t const comm_params =
{
.rx_pin_no = 3,
.tx_pin_no = 2,
.rts_pin_no = 17,
.cts_pin_no = 18,
.flow_control = APP_UART_FLOW_CONTROL_DISABLED,
.use_parity = false,
.baud_rate = UART_BAUDRATE_BAUDRATE_Baud115200
};

I have wired as below

NRF52832  ------   Raspberry Pi

rx_pin_no 3 ----- GPIO14(UART_TXD0)

tx_pin_no 2 ----- GPIO15(UART_RXD0)

rts_pin_no 17 ------- GPIO 16
cts_pin_no 18 ------  GPIO 17

GND  ----- GND

After this connection if I run the below Python code in Raspberry PI, I am getting invalid characters printed and reading after 1 byte getting error as 'Serial port is not ready'.

import serial
from time import sleep

ser = serial.Serial ("/dev/ttyS0", 115200)    #Open port with baud rate
while True:
    received_data = ser.read()              #read serial port
    sleep(0.03)
    data_left = ser.inWaiting()             #check for remaining byte
    received_data += ser.read(data_left)
    print (received_data)                   #print received data
    

Please help if have missed any thing in the connection between Raspberry and NRF52832 or config.

Related