PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
nRF5

UART driver for the nRF5 UARTE peripheral. More...

Data Structures

struct  pbl_uart_nrf5
 nRF5 serial port. More...
 

Macros

#define PBL_UART_NRF5_RX_BUF_SIZE   256U
 Size of the receive buffer, in bytes.
 
#define PBL_UART_NRF5_DEFINE(sym, _name, _base, _irq, _baudrate, _tx, _rx, _timer)
 Define a serial port on an nRF5 UARTE instance.
 

Functions

void pbl_uart_nrf5_irq_handler (const struct pbl_uart_nrf5 *uart)
 UARTE interrupt handler, connected by PBL_UART_NRF5_DEFINE().
 

Detailed Description

UART driver for the nRF5 UARTE peripheral.

Bytes are sent one at a time through EasyDMA. Reception runs through EasyDMA into the two halves of a receive buffer, while a TIMER of its own in counter mode counts the received bytes through a PPI channel. Odd parity and flow control are not supported.

TX is an output, idle high. RX is an input with its wiring flags, e.g. a pull, connected when reception first starts. An instance connects its interrupt itself, with priority CONFIG_UART_NRF5_IRQ_PRIO:

PBL_UART_NRF5_DEFINE(s_uart0, "uart0", 0x40002000, PBL_SOC_IRQN_UART0_UARTE0, 1000000,
PBL_GPIO(&dt_gpio0, 27, 0), PBL_GPIO(&dt_gpio0, 5, 0), 0x4000a000);
#define PBL_GPIO(_port, _pin, _flags)
Initializer for a struct pbl_gpio.
Definition gpio.h:158
#define PBL_UART_NRF5_DEFINE(sym, _name, _base, _irq, _baudrate, _tx, _rx, _timer)
Define a serial port on an nRF5 UARTE instance.
Definition nrf5.h:78

Data Structure Documentation

◆ pbl_uart_nrf5

struct pbl_uart_nrf5

nRF5 serial port.

Data Fields
uintptr_t base Registers.
pbl_irq_t irq Interrupt line.
struct pbl_gpio rx RX pin.
struct pbl_uart_nrf5_state * state Driver runtime state.
uintptr_t timer Registers of the TIMER counting received bytes.
struct pbl_gpio tx TX pin.
struct pbl_uart uart Serial port.

Macro Definition Documentation

◆ PBL_UART_NRF5_DEFINE

#define PBL_UART_NRF5_DEFINE (   sym,
  _name,
  _base,
  _irq,
  _baudrate,
  _tx,
  _rx,
  _timer 
)
Value:
static struct pbl_uart_nrf5_state sym##_nrf5_state; \
PBL_DEVICE_INSTANCE(sym, struct pbl_uart_nrf5, struct pbl_uart, uart){ \
.uart = PBL_UART_INIT(sym, _name, nullptr, &pbl_uart_nrf5_ops, _baudrate), \
.state = &sym##_nrf5_state, \
.base = (_base), \
.irq = (_irq), \
.tx = _tx, \
.rx = _rx, \
.timer = (_timer), \
}; \
PBL_IRQ_CONNECT_NUM(_irq, CONFIG_UART_NRF5_IRQ_PRIO, pbl_uart_nrf5_irq_handler, &sym##_inst, 0)
nRF5 serial port.
Definition nrf5.h:45
void pbl_uart_nrf5_irq_handler(const struct pbl_uart_nrf5 *uart)
UARTE interrupt handler, connected by PBL_UART_NRF5_DEFINE().
A serial port.
Definition uart.h:135
#define PBL_UART_STATE_DEFINE(sym)
Define the class state of port sym, for the PBL_UART_*_DEFINE() macro of a driver.
Definition uart.h:151
#define PBL_UART_INIT(sym, _name, _parent, _ops, _baudrate)
Initializer for the struct pbl_uart of port sym.
Definition uart.h:164

Define a serial port on an nRF5 UARTE instance.

Parameters
symSymbol of the port.
_nameName.
_baseRegisters.
_irqInterrupt line.
_baudrateInitial baud rate, in bits per second.
_txTX pin, from PBL_GPIO().
_rxRX pin, from PBL_GPIO().
_timerRegisters of the TIMER counting received bytes.

◆ PBL_UART_NRF5_RX_BUF_SIZE

#define PBL_UART_NRF5_RX_BUF_SIZE   256U

Size of the receive buffer, in bytes.

Function Documentation

◆ pbl_uart_nrf5_irq_handler()

void pbl_uart_nrf5_irq_handler ( const struct pbl_uart_nrf5 *  uart)

UARTE interrupt handler, connected by PBL_UART_NRF5_DEFINE().

Parameters
uartPort.