Hello all,
I saw this problem happen for people in this forum but I couldn't find a satisfactory answer.
I tried configuring the UART0 and UART1 on the ARM9 so I can use it with other modules.
UART2 is working perfectly through the USB connector but the other 2 UARTs connected to the expansion connector pins (J15: UART1 - 17,19 \ UART0 - 31,29) doesn't seem to work.
The registers state:
PINMUX3 = 0x00220000
PINMUX4 = 0x22220000
As they should be according to the pinmux utility.
I don't have any other peripheral connected.
Here is my code (only echoing between the UARTs):
int main(void)
{
unsigned int intFlags = 0;
unsigned int config = 0;
/* Enabling the PSC for UART2.*/
PSCModuleControl(SOC_PSC_0_REGS, HW_PSC_UART0, PSC_POWERDOMAIN_ALWAYS_ON,
PSC_MDCTL_NEXT_ENABLE);
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_UART1, PSC_POWERDOMAIN_ALWAYS_ON,
PSC_MDCTL_NEXT_ENABLE);
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_UART2, PSC_POWERDOMAIN_ALWAYS_ON,
PSC_MDCTL_NEXT_ENABLE);
/* Setup PINMUX */
UARTPinMuxSetup(0, FALSE);
UARTPinMuxSetup(1, FALSE);
UARTPinMuxSetup(2, FALSE);
/* Enabling the transmitter and receiver*/
UARTEnable(SOC_UART_0_REGS);
UARTEnable(SOC_UART_1_REGS);
UARTEnable(SOC_UART_2_REGS);
/* 1 stopbit, 8-bit character, no parity */
config = UART_WORDL_8BITS;
/* Configuring the UART parameters*/
UARTConfigSetExpClk(SOC_UART_0_REGS, SOC_UART_0_MODULE_FREQ,
460800, config,
UART_OVER_SAMP_RATE);
UARTConfigSetExpClk(SOC_UART_1_REGS, SOC_UART_1_MODULE_FREQ,
460800, config,
UART_OVER_SAMP_RATE);
UARTConfigSetExpClk(SOC_UART_2_REGS, SOC_UART_2_MODULE_FREQ,
460800, config,
UART_OVER_SAMP_RATE);
/* Enabling the FIFO and flushing the Tx and Rx FIFOs.*/
UARTFIFOEnable(SOC_UART_0_REGS);
UARTFIFOEnable(SOC_UART_1_REGS);
UARTFIFOEnable(SOC_UART_2_REGS);
/* Setting the UART Receiver Trigger Level*/
UARTFIFOLevelSet(SOC_UART_0_REGS, UART_RX_TRIG_LEVEL_1);
UARTFIFOLevelSet(SOC_UART_1_REGS, UART_RX_TRIG_LEVEL_1);
UARTFIFOLevelSet(SOC_UART_2_REGS, UART_RX_TRIG_LEVEL_1);
/*
** Enable AINTC to handle interrupts. Also enable IRQ interrupt in ARM
** processor.
*/
SetupInt();
/* Configure AINTC to receive and handle UART interrupts. */
ConfigureIntUART();
/* Preparing the 'intFlags' variable to be passed as an argument.*/
intFlags |= (UART_INT_LINE_STAT | \
UART_INT_RXDATA_CTI);
/* Enable the Interrupts in UART.*/
UARTIntEnable(SOC_UART_0_REGS, intFlags);
UARTIntEnable(SOC_UART_1_REGS, intFlags);
UARTIntEnable(SOC_UART_2_REGS, intFlags);
while(1);
}
static void UARTIsr()
{
unsigned char rxData = 0;
unsigned int int_id = 0;
/* This determines the cause of UART2 interrupt.*/
int_id = UARTIntStatus(SOC_UART_0_REGS);
/* Clears the system interupt status of UART2 in AINTC. */
IntSystemStatusClear(SYS_INT_UARTINT0);
/* Check if the cause is receiver data condition.*/
if(UART_INTID_RX_DATA == int_id)
{
rxData = UARTCharGetNonBlocking(SOC_UART_0_REGS);
UARTCharPutNonBlocking(SOC_UART_2_REGS, rxData);
}
/* Check if the cause is receiver line error condition.*/
if(UART_INTID_RX_LINE_STAT == int_id)
{
while(UARTRxErrorGet(SOC_UART_0_REGS))
{
/* Read a byte from the RBR if RBR has data.*/
UARTCharGetNonBlocking(SOC_UART_0_REGS);
}
}
return;
}
static void UART1Isr()
{
unsigned char rxData = 0;
unsigned int int_id = 0;
/* This determines the cause of UART2 interrupt.*/
int_id = UARTIntStatus(SOC_UART_1_REGS);
/* Clears the system interupt status of UART2 in AINTC. */
IntSystemStatusClear(SYS_INT_UARTINT1);
/* Check if the cause is receiver data condition.*/
if(UART_INTID_RX_DATA == int_id)
{
rxData = UARTCharGetNonBlocking(SOC_UART_1_REGS);
UARTCharPutNonBlocking(SOC_UART_2_REGS, rxData);
}
/* Check if the cause is receiver line error condition.*/
if(UART_INTID_RX_LINE_STAT == int_id)
{
while(UARTRxErrorGet(SOC_UART_1_REGS))
{
/* Read a byte from the RBR if RBR has data.*/
UARTCharGetNonBlocking(SOC_UART_1_REGS);
}
}
return;
}
static void UART2Isr()
{
unsigned char rxData = 0;
unsigned int int_id = 0;
/* This determines the cause of UART2 interrupt.*/
int_id = UARTIntStatus(SOC_UART_2_REGS);
/* Clears the system interupt status of UART2 in AINTC. */
IntSystemStatusClear(SYS_INT_UARTINT2);
/* Check if the cause is receiver data condition.*/
if(UART_INTID_RX_DATA == int_id)
{
rxData = UARTCharGetNonBlocking(SOC_UART_2_REGS);
UARTCharPutNonBlocking(SOC_UART_2_REGS, rxData);
UARTCharPutNonBlocking(SOC_UART_1_REGS, rxData);
UARTCharPutNonBlocking(SOC_UART_0_REGS, rxData);
}
/* Check if the cause is receiver line error condition.*/
if(UART_INTID_RX_LINE_STAT == int_id)
{
while(UARTRxErrorGet(SOC_UART_2_REGS))
{
/* Read a byte from the RBR if RBR has data.*/
UARTCharGetNonBlocking(SOC_UART_2_REGS);
}
}
return;
}
/*
** \brief This function invokes necessary functions to configure the ARM
** processor and ARM Interrupt Controller(AINTC) to receive and
** handle interrupts.
*/
static void SetupInt(void)
{
/* Initialize the ARM Interrupt Controller(AINTC). */
IntAINTCInit();
/* Enable IRQ in CPSR.*/
IntMasterIRQEnable();
/* Enable the interrupts in GER of AINTC.*/
IntGlobalEnable();
/* Enable the interrupts in HIER of AINTC.*/
IntIRQEnable();
}
/*
** \brief This function confiugres the AINTC to receive UART interrupts.
*/
static void ConfigureIntUART(void)
{
/* Registers the UARTIsr in the Interrupt Vector Table of AINTC. */
IntRegister(SYS_INT_UARTINT0, UARTIsr);
IntRegister(SYS_INT_UARTINT1, UART1Isr);
IntRegister(SYS_INT_UARTINT2, UART2Isr);
/* Map the channel number 2 of AINTC to UART2 system interrupt. */
IntChannelSet(SYS_INT_UARTINT0, 2);
IntChannelSet(SYS_INT_UARTINT1, 4);
IntChannelSet(SYS_INT_UARTINT2, 3);
IntSystemEnable(SYS_INT_UARTINT0);
IntSystemEnable(SYS_INT_UARTINT1);
IntSystemEnable(SYS_INT_UARTINT2);
}
I believe that the connections are correct.
Anyone knows how to solve this problem?
Thanks,
Yoel