Hi all
I'm struggling with the easyDMA UART of nrf52. I've got a preview nrf52-DK here where I wanted to make a simple example with the following code but I never reach the ENDRX event even if I send 20 or more bytes to the DK (pin 8). Also in debug mode I can't see that any byte reaches the rxbuffer.
Do you guys see why is that? What did I make wrong in the initiation?
Thank you all in advance for your support!
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"
#include "boards.h"
#include "nrf_uarte.h"
const uint8_t leds_list[LEDS_NUMBER] = LEDS_LIST;
void UARTE0_UART0_IRQHandler(){
if(NRF_UARTE0->EVENTS_ENDRX){
LEDS_INVERT(1 << leds_list[3]);
}
}
int main(void)
{
uint8_t txBuffer[20] = {0};
uint8_t rxBuffer[20] = {0};
NRF_UARTE0->BAUDRATE = NRF_UARTE_BAUDRATE_9600;
NRF_UARTE0->PSEL.TXD = TX_PIN_NUMBER;
NRF_UARTE0->PSEL.RXD = RX_PIN_NUMBER;
NRF_UARTE0->CONFIG = NRF_UARTE_HWFC_DISABLED;
NRF_UARTE0->ENABLE = (UARTE_ENABLE_ENABLE_Enabled << UARTE_ENABLE_ENABLE_Pos);
NRF_UARTE0->TXD.PTR = (uint32_t)((uint8_t *) txBuffer);
NRF_UARTE0->TXD.MAXCNT = sizeof(txBuffer);
NRF_UARTE0->TASKS_STARTTX = 0;
NRF_UARTE0->RXD.PTR = (uint32_t)((uint8_t *) rxBuffer);
NRF_UARTE0->RXD.MAXCNT = sizeof(rxBuffer);
NRF_UARTE0->TASKS_STARTRX = 1;
NRF_UARTE0->INTENCLR = 0xFFFFFFFF;
NRF_UARTE0->INTENSET = NRF_UARTE_INT_ENDRX_MASK;
NVIC_ClearPendingIRQ(UARTE0_UART0_IRQn);
NVIC_SetPriority(UARTE0_UART0_IRQn, 1);
NVIC_EnableIRQ(UARTE0_UART0_IRQn);
// Configure LED-pins as outputs.
LEDS_CONFIGURE(LEDS_MASK);
if(NRF_UARTE0->EVENTS_RXSTARTED){
LEDS_INVERT(1 << leds_list[1]);
}
while (true)
{
}
}