This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB and UART interrupts together, problem!

Hi,

I am trying to setup a system where I use interrupts for the USB communication and UART but I have a problem, I can't use both at the same time ... Both work properly separated, once I try to use both it doesn't work anymore. I think it has to deal with the interrupt priority, because I still have the USB interrupt working once it has a higher priority (0) then the UART (2).
Someone has an idea? Thanks.
This is the initialization of both of them:

UART:

...
SCU_APBPeriphClockConfig(__UART0, ENABLE);
SCU_APBPeriphReset(__UART0,DISABLE);

SetCNTR(0);
SetISTR(0);
SCU_AHBPeriphClockConfig(__USB48M,ENABLE);

// UART Module //
UART_InitStructure.UART_WordLength = UART_WordLength_8D;
UART_InitStructure.UART_StopBits = UART_StopBits_1;
UART_InitStructure.UART_Parity = UART_Parity_No ;
UART_InitStructure.UART_BaudRate = 115200;
UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None;
UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;
UART_InitStructure.UART_FIFO = UART_FIFO_Disable;

UART_DeInit(UART0);
UART_Init(UART0, &UART_InitStructure);

UART_ITConfig(UART0, UART_IT_Receive, ENABLE);
VIC_Config(UART0_ITLine, VIC_IRQ, 2);
VIC_ITCmd(UART0_ITLine, ENABLE);
/* Enable the UART0: start sending the transmit FIFO content to the hyperterminal */
UART_Cmd(UART0, ENABLE);
UART_ITConfig(UART0, UART_IT_Receive, ENABLE);
UART_LoopBackConfig(UART0, DISABLE);


USB:

SCU_USBCLKConfig(SCU_USBCLK_EXT);
// Enable USB clock //
SCU_AHBPeriphClockConfig(__USB, ENABLE);
SCU_AHBPeriphReset(__USB, DISABLE);
// USB Initialization
/* Enable and configure the priority of the USB_LP IRQ Channel*/
VIC_DeInit();
VIC_Config(USBLP_ITLine, VIC_IRQ, 0);
VIC_ITCmd(USBLP_ITLine, ENABLE);

/* USB initialization */
wInterrupt_Mask = IMR_MSK;

SetCNTR(0x0003);
Token_Event = 0; /* Flags of each endpoint interrupt */
pInformation = &Device_Info;
pInformation->ControlState = 2;
pProperty = &Device_Property;
/* Initialize devices one by one */
pProperty->Init();

0