Hello,
I am using UART to receive data on a nRF52840 DK.
I have written some code using the Serial Port Library.
I have attached snippets of the code dealing with the Serial Port.
This is the header file
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void init_rs485();
void serial_event_handler(struct nrf_serial_s const * p_serial,
nrf_serial_event_t event);
void send_rs485_message(char *buffer, size_t length);
// Setup UART0 for IPN
#define IPN_BAUDRATE 0x83F8
#define UNUSED_PIN 0xFFFFFFFF
#define RS485_TX_PIN NRF_GPIO_PIN_MAP(0, 6)
#define RS485_RX_PIN NRF_GPIO_PIN_MAP(0, 5)
NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uart1_drv_config,
RS485_RX_PIN, RS485_TX_PIN,
UNUSED_PIN, UNUSED_PIN,
NRF_UART_HWFC_DISABLED, NRF_UART_PARITY_EXCLUDED,
IPN_BAUDRATE,
UART_DEFAULT_CONFIG_IRQ_PRIORITY);
#define SERIAL_FIFO_TX_SIZE 64
#define SERIAL_FIFO_RX_SIZE 64
This is the .C file
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "rs485.h"
void init_rs485()
{
NRF_LOG_DEBUG("init_rs485");
// Init the Serial UART0 for IPN
ret_code_t ret;
ret = nrf_serial_init(&serial1_uart, &m_uart1_drv_config, &serial1_config);
APP_ERROR_CHECK(ret);
}
void serial_event_handler(struct nrf_serial_s const * p_serial,
nrf_serial_event_t event)
{
ret_code_t ret;
char c;
switch (event)
{
case NRF_SERIAL_EVENT_TX_DONE:
break;
case NRF_SERIAL_EVENT_RX_DATA:
I want to see the data being received on the UART RX buffer. How can I see that on the Debug window?
If I add the buffer variable to the watch window, I get 'symbol not found'.
I have verified that I am receiving data on the Serial Bus using Realterm on the PC.
Please help,
Thanks