cancel
Showing results for 
Search instead for 
Did you mean: 

How to debug USB related issues?

abaldur
Associate III

Hi

I use the STM32L452 which is configured as a USB CDC device using CubeMX. The device is used as a "gateway" that connects a linux host to a CAN bus system (essentially a USB-to-CAN adapter). The linux host configures the USB device as an SLCAN based interface so that it appears a a CAN socket.

The USB communication typically works stable for a couple of weeks, but then suddenly the host is unable to send data to the device. It can, however, still receive packets from the device. It seems like the OUT direction gets broken in some way?

On the linux side, writing the socket gives me: "errno=105, error=No buffer space available".

I'm not asking for a concrete solution to this problem, but rather some good advice on how to debug a problem like this?

Do you have some hints on where to look? Maybe tools that could help me investigate the problem?

What makes it difficult is that the problem seems hard to reproduce and it only appears every few weeks. So I want to be prepared for the next time it happens and extract as much information as possible.

Thanks

/ abaldur

1 REPLY 1
abaldur
Associate III

Could it be that the OUT endpoint gets STALL'ed for some reason? And that it has to be cleared by the user?

There is a define in "usbd_conf.h" named USBD_DEBUG_LEVEL controls defines the USBD_UsrLog, USBD_ErrLog and USBD_DbgLog macros. But from what I can see by looking into the source code, they are not really used anywhere?

/ abaldur