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

nRF52840 UART queries

Hello,

 

I am using nRF52840, SDK_16.0.0, S140 SoftDevice and Segger 4.16 for flashing the image. I am using ‘ble_app_blinky’.

 

1) In Product specification, it says 2 UARTE supported. Whereas in section 6.33.10 I am seeing only one instance of UART0, but in section 6.34.9 there are two instance of UARTE0 and UARTE1.

a) Without EasyDMA, is it only one UART supported ?

 

2) I need uart in my ble_app_blinky application. I have gone through ble_app_uart. For this I enabled NRF_LOG_BACKEND_RTT_ENABLED and disabled NRF_LOG_BACKEND_UART_ENABLED. Is this fine ?

 

3) For UART rx, ble_app_uart has uart_event_handle() to receive data. For UART Tx whether can I use app_uart_put() ?

     a) To cross check I want to type on Terminal. Once received on uart, I want to transmit the same data back to terminal. But when I call app_uart_put(), I am not seeing any print on Terminal.

     b) Even I am getting event APP_UART_TX_EMPTY (3) in default case, indicating "UART has completed transmission of all available data in the TX FIFO". But not output on Terminal. (I configured Terminal properly).

      

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**@snippet [Handling the data received over UART] */
void uart_event_handle(app_uart_evt_t * p_event)
{
static uint8_t data_array[UART_MAX_DATA_LEN];
static uint8_t index = 0;
uint32_t err_code;
switch (p_event->evt_type)
{
case APP_UART_DATA_READY:
{
UNUSED_VARIABLE(app_uart_get(&data_array[index]));
index++;
NRF_LOG_DEBUG("D ");
//NRF_LOG_HEXDUMP_DEBUG(data_array, index);
app_uart_put(data_array[index]);
if ((data_array[index - 1] == '\n') ||
(data_array[index - 1] == '\r') ||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

4) I am bit confused, whether can I use app_uart.c / app_uart_fifo.c or “Serial Port Library”. My requirements are:

a) I need both UART Tx & Rx

b) BLE should work simultaneously.

c) Device should go into low power mode.

 

 Thanks & Regards

Vishnu Beema