Showing results for 
Search instead for 
Did you mean: 

STM32L433 USB VCP Problem

Gianluca Dal Pont
Posted on April 05, 2017 at 20:36

Good evening everyone,

I'm trying to use the L433 USB as VCP using HAL Drivers, to receive data from PC and transmit the response to the PC.

I'm following the STM32L452RE example 'Standalone CDC' from the CubeMX examples, but i'm having some troubles.

If I set the Rx buffer only in the Init, after the first reception the buffer where the data are stored (in the function called ReadPMA) isn't the one i've set previously.

This is the current flow of the program:

1. USB Init

2. USB Start, Set Rx Buffer and Set Tx Buffer, then i call the ReceivePacket function

3. Reception Callback (the buffer is filled with the data i'm expecting)

4.Data processing. After that i call the Tx function

5. In the Tx function i Set the Tx Buffer and then call the TransmitPacket function 

6. I call the ReceivePacket function to put the USB in reception

The next data i receive are not stored in the buffer i set previously, and the ReadPMA function cause an HardFault.

What and where could be the problem?

Thanks in advance and sorry for my poor english!

#usb-vcp #usb #hal #stm32l433