Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

RTOS/PROCESSOR-SDK-AM335X: UART interrupt

$
0
0

Part Number: PROCESSOR-SDK-AM335X

Tool/software: TI-RTOS

hi.,

i am trying to generate UART receive  interrupt like below

main function

main()

{
MMUConfigAndEnable();

/* Enable cache */
CacheEnable(CACHE_ALL);

// PeripheralsSetUp();
BoardInfoInit();

/* Configuring the system clocks for UART0 instance. */
UART0ModuleClkConfig();

/* Performing the Pin Multiplexing for UART0 instance. */
UARTPinMuxSetup(0);

/* Performing a module reset. */
UARTModuleReset(SOC_UART_0_REGS);


/* Performing FIFO configurations. */
UartFIFOConfigure();

UartConfigure(BAUD_RATE_115200, (UART_FRAME_WORD_LENGTH_8 |
UART_FRAME_NUM_STB_1 |
UART_PARITY_NONE));

/* Select the console type based on compile time check */
ConsoleUtilsSetType(CONSOLE_UART);

/* Enabling IRQ in CPSR of ARM processor. */
IntMasterIRQEnable();

/* Configuring AINTC to receive UART0 interrupts. */
UARTINTCConfigure();

/*Enabling required UART Interrupts. */
// UARTIntEnable(SOC_UART_0_REGS,(UART_INT_LINE_STAT | UART_INT_THR | UART_INT_RHR_CTI));
UARTIntEnable(SOC_UART_0_REGS,UART_INT_RHR_CTI);

while(1)
{

}

// interrupt function

static void UARTINTCConfigure(void)
{
/* Initializing the ARM Interrupt Controller. */
  IntAINTCInit();

/* Registering the Interrupt Service Routine(ISR). */
IntRegister(UART_INSTANCE_INT_NUM, UARTIsr);

/* Setting the priority for the system interrupt in AINTC. */
IntPrioritySet(UART_INSTANCE_INT_NUM, 0, AINTC_HOSTINT_ROUTE_IRQ);

/* Enabling the system interrupt in AINTC. */
IntSystemEnable(UART_INSTANCE_INT_NUM);
}

 Initializing the ARM Interrupt Controller.

void IntAINTCInit(void)
{
unsigned int intrNum;

HWREG(SOC_AINTC_REGS + INTC_SYSCONFIG) = INTC_SYSCONFIG_AUTOIDLE;
/* Reset the ARM interrupt controller */
HWREG(SOC_AINTC_REGS + INTC_SYSCONFIG) = INTC_SYSCONFIG_SOFTRESET;

/* Wait for the reset to complete */
while((HWREG(SOC_AINTC_REGS + INTC_SYSSTATUS)
& INTC_SYSSTATUS_RESETDONE) != INTC_SYSSTATUS_RESETDONE);

/* Enable any interrupt generation by setting priority threshold */
HWREG(SOC_AINTC_REGS + INTC_THRESHOLD) =
INTC_THRESHOLD_PRIORITYTHRESHOLD;

/* Register the default handler for all interrupts */
for(intrNum = 0; intrNum < NUM_INTERRUPTS; intrNum++)
{
fnRAMVectors[intrNum] = IntDefaultHandler;
}
}

static void UARTIsr(void)
{
volatile unsigned char rxByte;
; Perform nothing
rxByte = UARTCharGetNonBlocking(SOC_UART_0_REGS);
UARTCharPutNonBlocking(SOC_UART_0_REGS, rxByte);

}

i did like this.. , but interrupt is not generating..

please any one help me

Regards 

chandana


Viewing all articles
Browse latest Browse all 262198

Trending Articles