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

How to define and use UART & TWIS without DMA transmission on nrf52810?

I would like to use my nrf51 applications working without DMA on nrf52810.

In nrf52810_peripherals.h there is no such settings.

When defined "manually", the project does not compile.  Error: "NRF_UART_Type" is undefined

My main file functions  (from example  given by Petter Myhre):

#include "nrf.h"
#include "nrf52.h"
#include "app_uart.h"
#include "nrf_uart.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "boards.h"
#include "app_error.h"


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);
    }
}



void uart_init()    
{
    uint32_t err_code;
  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, // no parity
        //UART_BAUDRATE_BAUDRATE_Baud9600
        UART_BAUDRATE_BAUDRATE_Baud115200
    };
    APP_UART_FIFO_INIT(&comm_params, // UART unique initialisation macro
        32, //UART_RX_BUF_SIZE in bytes
        512, //UART_TX_BUF_SIZE  in bytes
        uart_error_handle, // callback function address
        APP_IRQ_PRIORITY_LOW,
        err_code); // error code output is put in error_code variable by macro      
    if (err_code!=NRF_SUCCESS)
        ;
        //quick_blink(); // optical error alert
}    
   

Parents Reply
  • Hi,

    Some example how TWIS peripheral can be used you can find here:

    sdk\nrf5\examples\peripheral\twi_master_with_twis_slave

    Basically peripherals with EasyDMA are using memory buffer for Tx and Rx data. If you will set size of these buffers to 1 byte you will be more less using UARTE/TWIS like UART/TWI peripherals.

    There are some other event flags you need to look for, but this can be found in the documentation.

Children
No Data
Related