cancel
Showing results for 
Search instead for 
Did you mean: 

USB Data Transfer with STM32L552E-EV

Nirene
Associate II

Greetings,

Kindly, I would like to know which USB interface I can use to transfer data between the STM32L552E-EV and the reComputer J4012.

I am working with TEE, and my goal is to send plaintext from the reComputer to the STM32L5 so that it can be encrypted on the device. However, when I send data, I do not receive any response.

I have tried using both the USB port and ST-Link, but the result is the same. I can see the ST-Link device on the reComputer, but when I use USB CDC, it is not recognized.

Could you explain the proper USB connection and how to set up the communication?

 

8 REPLIES 8
mƎALLEm
ST Employee

Hello,

The connection (CN22) of STLINK over a virtual comport (windows)  offers a kind of "UART protocol over USB".

If you need to use the USB you need to use CN1 connector (USB FS).

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Andrew Neil
Super User

Some more detail would help:

How to write your question to maximize your chances to find a solution

 


@Nirene wrote:

the reComputer J4012.


You mean this: https://files.seeedstudio.com/wiki/reComputer/reComputer-J40.pdf ?

 


@Nirene wrote:

I am working with TEE,


What do you mean by that?

 


@Nirene wrote:

However, when I send data, I do not receive any response.


So what, exactly, did you try?

As @mƎALLEm said, the ST-Link provides a Virtual COM Port (VCP); for native USB, you would use CN1.

 

For the VCP, you just need to use the STM32L5 UART on whichever of the STM32L5's pins is connected to the VCP - see the board's User Manual for details.

 

For native USB, you would have to make a complete USB device implementation.

 

CubeMX will give you access to examples...

 

PS:

The STM32L552E-EV also has an RS232 port, so you could use a USB-to-RS232 adaptor;

There are also logic-level UART signals available on the PMOD and STMOD+ connectors, so you could use a UART-to-USB adaptor (of the appropriate voltage) there.

These will also give you a VCP.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

From the User Manual:

AndrewNeil_0-1768994297502.png

AndrewNeil_2-1768994340285.png

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Hello
Thank you for your explanation.

Currently, I am using the CN1 port for USB FS, but I am still facing an issue. When I connect the board to the reComputer J4012, the USB cable is detected physically, but no USB device (CDC) appears on the reComputer side. So when I try to write commands, I cannot see any USB interface to communicate with.

Could you please advise what additional configuration is required on the STM32L552 (CubeMX / firmware side) so that the CN1 USB FS is enumerated correctly as a CDC device on the host?

Thank you for your support.

Hello,

Thank you for the explanation and help.

Yes, I am using the reComputer-J4012 board as shown in your reference:
https://files.seeedstudio.com/wiki/reComputer/reComputer-J40.pdf

Here is what I have tried so far:

  • I connected the CN1 USB FS port from the STM32L552E-EV to the reComputer J4012 USB host.

  • I also tried using the ST-Link VCP (CN22) connection.

With ST-Link, the reComputer can detect it correctly, but I cannot send any data to stm32l5 and receive a response. However, when I use the CN1 USB FS port, although the cable is connected, the reComputer does not enumerate any USB CDC device from the STM32L5, so I cannot send commands or data.

My goal is to work with TEE (Trusted Execution Environment): I have created an encryption key inside the TEE on the STM32L5, and I want to send data from the reComputer so that the STM32L5 can encrypt it inside the TEE.

You mentioned:

“For native USB, you would have to make a complete USB device implementation.”

Could you please point me to a guide, reference manual, or example project that shows how to properly implement a USB CDC device on the STM32L552 (for example using Cube MX), so that it is recognized by the host?

Thank you very much for your support.

Nirene_0-1769050707557.png

 

 

mƎALLEm
ST Employee

So that's a USB stack related question. It was moved to STM32 MCUs Embedded software forum board.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
FBL
ST Employee

Hi @Nirene 

To proceed you need to narrow down the issue, and test simple communication with your laptop. Here is an example using STM32CubeL5/Projects/STM32L552E-EV/Applications/USB_Device/CDC_Standalone

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL
Andrew Neil
Super User

Getting a native USB connection working is significantly more complex that a simple UART connection.

It should be easier to pursue getting the ST-Link (or other VCP) connection working ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.