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

UART ISR and loopback

Hello all,
Ok, I guess I'm doing something wrong but I just don't see what it is!
I configure my UART like this:

/* UART1 configured as follow:
        - Word Length = 8 Bits
        - One Stop Bit
        - No parity
        - BaudRate = 115200 baud
        - no Hardware flow control enabled (RTS and CTS signals)
        - Receive and transmit enabled
        - Receive and transmit FIFOs are enabled
        - Transmit and Receive FIFOs levels have 8 bytes depth
  */
   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_FIFO_Enable;
   UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2; /* FIFO size 16 bytes, FIFO level 8 bytes */
   UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2; /* FIFO size 16 bytes, FIFO level 8 bytes */

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

   UART_LoopBackConfig(UART1, ENABLE) ;

   /* Enable the UART1 */
   UART_Cmd(UART1, ENABLE);
   /* Enable UART1 Rx Interrupt */
   UART_ITConfig(UART1, UART_IT_Receive, ENABLE);
   /* Clear IRQ MAsk */
   UART_ClearITPendingBit(UART1, UART_IT_Receive);

nice and easy. Now, note that the loopback is enabled.
I transmit a single character and indeed, the ISR is invoke not once - but as long as the simulator runs), delivering the exact same character!
This is the ISR:

unsigned x = UART1->DR ;

VIC0->VAR = 0 ;
VIC1->VAR = 0 ;
UART_ClearITPendingBit(UART1, UART_IT_Receive) ;

do you a clue what's wrong?

0