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

UARTE Interrupt is not working at all

Hi.

I'm developing application that is needed to include  UARTE Interrupt.

I can drive UART interrupt well(not UARTE), but UARTE is not working.

#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"
#include "nrf_uarte.h"
#include "SEGGER_RTT.h"


void UARTE0_UART0_IRQHandler(){
	SEGGER_RTT_printf(0, "test\n");
    if(NRF_UARTE0->EVENTS_ENDRX){
		SEGGER_RTT_printf(0, "test\n");
    }

}

int main(void)
{

	static uint8_t txBuffer[7] = "TEST\r\n";
	static uint8_t rxBuffer[20] = {0};

    NRF_UARTE0->BAUDRATE = NRF_UARTE_BAUDRATE_9600;
    NRF_UARTE0->PSEL.TXD = 19;
    NRF_UARTE0->PSEL.RXD = 18;
    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 = (1 << 2);

    NVIC_ClearPendingIRQ(UARTE0_UART0_IRQn);
    NVIC_SetPriority(UARTE0_UART0_IRQn, 5);
    NVIC_EnableIRQ(UARTE0_UART0_IRQn);


    SEGGER_RTT_printf(0, "teTN\n");
    while (true)
    {
    	NRF_UARTE0->TASKS_STARTTX;
    }
}

Here is my code. Would guide me please?

Thank you.

Related