STM32F103 USB KO after being suspended

If you made your own board, post here, unless you built a Maple or Maple mini clone etc
Post Reply
AurelGTS
Posts: 3
Joined: Sat Jan 02, 2021 2:10 pm

STM32F103 USB KO after being suspended

Post by AurelGTS »

Hello,

First of all, many thanks to Roger for the job done. I found many many things on this forum.
I finished creating a MIDI footswitch. I only have one problem :
When USB is suspended, I could not received any more data on it, even if state is back to connected. But I can still send data.
I debugged libmaple/usb.c and saw that function usb_resume_init is well called.
My board is a cutom one but is a clone of any bluepill board with a STM32F103RCT6.
As a workaround, I programmatically restart the board when USB state go to suspended state.
If you 've got an idea of the problem, I would appreciate your help.
Many thanks.

regards,
Aurélien
Last edited by AurelGTS on Sat Jan 02, 2021 5:19 pm, edited 1 time in total.

ag123
Posts: 517
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: STM32F103 USB KO after being suspended

Post by ag123 »

in linux, there is this usbreset utility which sends a 'single ended zero', i.e. drive d+/d- low for > 10us
https://github.com/jkulesza/usbreset
i'm not too sure what is the same in windows, but accordingly it may be something like disabling and enabling the device in device manager
it helps in a particular case where after programming the stm32 in dfu mode, after switching back the usb device didn't seem initialized normally (even if reset is pressed).
you may like to try that usbreset out

AurelGTS
Posts: 3
Joined: Sat Jan 02, 2021 2:10 pm

Re: STM32F103 USB KO after being suspended

Post by AurelGTS »

Hello,
I'm using a stlink to program the board. There is no problem at boot, but only when a suspended mode is detected. I don't use any custom bootloader.

ag123
Posts: 517
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: STM32F103 USB KO after being suspended

Post by ag123 »

well, i guess i'm off tracked. I'd guess what you have done 'programmatically restart the board' is probably one of a simplest way to work around it.
fixing usb is hard and you'd need to debug how it runs to figure out what went wrong.

mrburnette
Posts: 311
Joined: Thu Dec 19, 2019 1:23 am
Answers: 1

Re: STM32F103 USB KO after being suspended

Post by mrburnette »

The issue is documented to a degree, from the PC prospective:

https://answers.microsoft.com/en-us/win ... e181f588c1

Just out of curiosity, have you considered testing with a hub between the sleeping uC and the PC?

AurelGTS
Posts: 3
Joined: Sat Jan 02, 2021 2:10 pm

Re: STM32F103 USB KO after being suspended

Post by AurelGTS »

Hello,

Thanks for the link. The problem appears with and without hub.
Seems function usb_midi_DataRxCb in usb_midi_device.c is not called after a wakeup. But If I send a second midi data, it works.
Dont' really understand why for the moment... I go on.

regards,

Aurélien

Post Reply

Return to “Custom design boards”