Hi. I'm writing my own libraries for nRF52832 and I can't get UARTE to work.
Here is my code.
I'm using pins 6 and 8 as the UART example.
I wrote same code for UART (without DMA) and it works fine!
uart.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 <string.h>
#include <stdbool.h>
#include "nrf52.h"
#include "uart.h"
static volatile uint8_t tx_buffer[128];
void uart_set_baudrate(uint32_t val)
{
NRF_UARTE0->BAUDRATE = val;
}
void uart_configure(uint32_t parity, uint32_t hwfc)
{
NRF_UARTE0->CONFIG = (parity << UART_CONFIG_PARITY_Pos) | (hwfc << UART_CONFIG_HWFC_Pos);
}
void uart_set_pins(uint32_t txpin, uint32_t rxpin)
{
NRF_UARTE0->PSEL.RXD = rxpin;
NRF_UARTE0->PSEL.TXD = txpin;
main.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int main(void)
{
clock_init();
rtc_init();
gpio_out_set(6);
gpio_config_output(6);
gpio_config_input(8, GPIO_PIN_CNF_PULL_Disabled);
uart_init();
uart_write_string("Hello world\r\n", 14);
radio_init();
__enable_irq();
while (true)
{
}
}
I don't get anything on the terminal.