Hi!
I have problem trying to use UART0 and UART1 together on DM6437. First UART0 is intended to use on RS-232 app and UART1 for a RS-485 app (trhough SAE-J1708 implementation).
I used UART0 alone and is working well. Then I used UART1 alone and works fine. But when both Uart's intances are togeher and run my code on chip, UART0 Reception doesn't work it seems to be disabled. I have UART0 Tx as task, same for UART0 Rx with same (and the highest) priority. UART1 Tx and UART1 Rx are separeted tasks (with same pririty).
I am doing the next things:
-First UART0 and UART1 devices are created
/* Uart0 Driver*/
bios.UDEV.create("UART0");
bios.UDEV.instance("UART0").fxnTableType = "IOM_Fxns";
bios.UDEV.instance("UART0").initFxn = prog.extern("UART0_INIT");
bios.UDEV.instance("UART0").fxnTable = prog.extern("UARTMD_FXNS");
bios.UDEV.instance("UART0").params = prog.extern("Uart0_DevParams");
bios.UDEV.instance("UART0").deviceId = 0;
/* Uart1 Driver*/
bios.UDEV.create("UART1");
bios.UDEV.instance("UART1").fxnTableType = "IOM_Fxns";
bios.UDEV.instance("UART1").initFxn = prog.extern("UART1_INIT");
bios.UDEV.instance("UART1").fxnTable = prog.extern("UARTMD_FXNS");
bios.UDEV.instance("UART1").params = prog.extern("Uart1_DevParams");
bios.UDEV.instance("UART1").deviceId = 1;
With Dev params as:
/**< Default UART0 Device Parameters, using PSP Drivers */
UARTMD_DevParams Uart0_DevParams =
{
PSP_OPMODE_INTERRUPT, ///< Driver operation mode
TRUE, ///< Sync mode enabled
PSP_UART_MODULE_CLOCK, ///< Default input module clock
NULL ///< Edma handle
};
/**< Default UART1 Device Parameters, using PSP Drivers */
UARTMD_DevParams Uart1_DevParams =
{
PSP_OPMODE_INTERRUPT, ///< Driver operation mode
TRUE, ///< Sync mode enabled
PSP_UART_MODULE_CLOCK, ///< Default input module clock
NULL ///< Edma handle
};
- Next EDMA3 is initialized:
extern EDMA3_DRV_Handle hEdma;
extern EDMA3_DRV_Result edma3init();
EDMA3_DRV_Result edmaResult = 0;
Int16 EDMA3_init(void)
{
/* Initialize EDMA3 */
if(NULL == hEdma) //hEdma defined in edma library
{
edmaResult = edma3init();
if (edmaResult != EDMA3_DRV_SOK)
{
// EDMA Error
return FALSE;
}
else
{
return TRUE;
}
}
return FALSE;
}
- Then UART0 and UART1 instances are created:
// GIO_Handle objects for Input and Output on UART0
GIO_Handle hUart0_OUT, hUart0_IN;
void UART0_INIT()
{
if(NULL != hEdma) //hEdma defined in edma library
{
Uart0_DevParams.hEdma = hEdma;
}
}
void UART1_INIT()
{
if(NULL != hEdma) //hEdma defined in edma library
{
Uart1_DevParams.hEdma = hEdma;
}
}
Int16 UART_InitUart0Module(void)
{
Int32 echoTskStatus = 0;
GIO_Attrs gioAttrs = GIO_ATTRS;
...
// CREATE UART 0 OBJECT
hUart0_OUT = GIO_create("/UART0", IOM_OUTPUT, NULL, NULL, &gioAttrs);
hUart0_IN = GIO_create("/UART0", IOM_INPUT, &echoTskStatus, NULL, &gioAttrs);
if( (NULL == hUart0_IN)||(NULL == hUart0_OUT) )
{
return FALSE;
}
// In case of UART0: HW flow control is activated
//ACTIVATE HARDWARE FLOW CONTROL FOR UART0
Uart0_FlowControl.fcType = PSP_UART_FC_TYPE_HW;
Uart0_FlowControl.fcParam = PSP_UART_SWFC_NONE;
if ( GIO_control (hUart0_OUT, PSP_UART_IOCTL_SET_FLOWCONTROL, &Uart0_FlowControl) != IOM_COMPLETED )
return FALSE;
if ( GIO_control (hUart0_IN, PSP_UART_IOCTL_SET_FLOWCONTROL, &Uart0_FlowControl) != IOM_COMPLETED )
return FALSE;
....
}
Int16 UART_InitUart1Module(void)
{
Int32 echoTskStatus = 0;
GIO_Attrs gioAttrs = GIO_ATTRS;
// CREATE UART 1 OBJECT
hUart1_OUT = GIO_create("/UART1", IOM_OUTPUT, NULL, NULL, &gioAttrs);
hUart1_IN = GIO_create("/UART1", IOM_INPUT, &echoTskStatus, NULL, &gioAttrs);
if( (NULL == hUart1_IN)||(NULL == hUart1_OUT) )
{
return FALSE;
}
// In case of UART1: Baud rate is set to 9600
...
}
The PLL settings for both UARTs are OK. I don't know what's happening or what is wrong.
Code Composer Studio V. 3.3.82.13
Code Generation Tools V. 6.1.20
BIOS V. 5.31.09
dvsdk 1_01_00_15 and psp drivers 1_00_02_00