cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F070F6 USB CDC incorrect data received at Linux Virtual Com Port

EOCon.1
Associate II

Hi all,

I have an application that needs to receive some UART bytes and transmit those to a Linux processor over a Virtual USB Com port.

The USB is enumerated fine in Linux and the device appears in /dev/ttyACM0, I can receive perfectly from Linux to the STM32.

My application used CubeMX as a base and I have built it up from there.The issue is that the transmit from the STM32 to Linux is very strange. I have a timer interrupt that fires as soon as a timeout occurs are the last UART byte is received, at this point inside in the IRQ for the timer I attempt to transmit the packet over USB, below is a code snippet, uart_rx_buff and uart_bytes are global variables.

/* This interrupt fires when the UART string is finished from Quectel module*/
void TIM1_BRK_UP_TRG_COM_IRQHandler(void)
{
	GPIOB->BSRR = (uint32_t)2;
	htim14.Instance->SR = ~ TIM_IT_UPDATE;
	__HAL_TIM_DISABLE(&htim1);
	NVIC_DisableIRQ(TIM1_BRK_UP_TRG_COM_IRQn);
	htim1.Instance->DIER &= ~TIM_DIER_UIE;
	GPIOB->BRR = (uint32_t)2;
	CDC_Transmit_FS(uart_rx_buff, (uint16_t)uart_bytes);
	uart_bytes=0; // consider the usb message sent
}

For some reason instead of receiving the 5 bytes that I should I receive 3 and the 3 that are received are also not correct. If I transmit like this CDC_Transmit_FS("12345", (uint16_t)5); then I get absolutely nothing on the Linux side.

Any tips on what I am doing wrong?

1 REPLY 1

Hello @Community member​ ,

Try to port the following example provided in the F0 firmware package (path: Projects\STM32072B_EVAL\Applications\USB_Device\CDC_Standalone )

Otherwise, Could you please share your example for further check?

BeST Regards,

Walid