cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 usb bug

DAgui.3
Associate

Hello, I am using the STM32L4 Micro-chip on a board I am using, and I can across a weird issue with the usb. When ever I was running iar and trying to open up the com port within another serial program, the serial program was unable to open the com port. Furthermore to fix the issue, the board needed to be reset. However, changing this part of code seemed to fix the issue.

Add to beginning of CDC_Control_FS() function (line 188):

 static uint8_t lineCoding[7] // 19200bps, 1stop, no parity, 8bit

   = { 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x08 };

And change the two LINE_CODING switch statements inside CDC_Control_FS() to be:

   case CDC_SET_LINE_CODING:

     memcpy(lineCoding, pbuf, sizeof(lineCoding));

   break;

   case CDC_GET_LINE_CODING:

     memcpy(pbuf, lineCoding, sizeof(lineCoding));

   break;

0 REPLIES 0