cancel
Showing results for 
Search instead for 
Did you mean: 

Problem within STM32F0x2_USB-FS-Device_Lib V1.0.0

baoshi
Associate
Posted on March 24, 2015 at 02:58

I'm looking intoSTM32F0x2_USB-FS-Device_Lib V1.0.0 particularly on STM32F072C8T6 with HID_CDC composite example.

The first thing I observed, in usbd_cdc_vcp.c,

void EVAL_COM_IRQHandler(void)
{
if (USART_GetITStatus(EVAL_COM1, USART_IT_RXNE) != RESET)
{
/* Send the received data to the PC Host*/
VCP_DataTx (0,0);
}
/* If overrun condition occurs, clear the ORE flag and recover communication */
if (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_ORE) != RESET)
{
(void)USART_ReceiveData(EVAL_COM1);
}
}

As referenced by F0 reference manual, ORE is not cleared by reading status register and followed by data register as in F1. It should be cleared by writing1 to the ORECF in the USARTx_ICR register. So I wrote

USART_ClearFlag(EVAL_COM1, USART_FLAG_ORE);

Otherwise the program will keep enter into the ISR. Secondly, I keep run into overrun situation if I have UART2 TX and RX shorted. I'm not sure why the interrupt cannot be served on time. On the other hand, the standalone Virtual_COM_Port example does not have this problem if I made the above modification. But it seems to have some buffer correction problem that if I send more than 64 bytes into UART2 RX, I receive the whole 2048 bytes of USB RX buffer from PC side. I'm running these on STM32F072B Discovery board. Any help will be appreciated. Baoshi #stm32f0 #composite #cdc #usb
0 REPLIES 0