arpruss / USBComposite_stm32f1

USB Composite library for STM32F1 (HID, Serial, MIDI and XBox360 controller)
Other
381 stars 76 forks source link

USB Host Shield bluetooth lag #101

Closed petanque closed 2 years ago

petanque commented 2 years ago

Hi, great library, thank you for all your work. I have used it before to make a xbox360 wheel for my pc.

Now Im trying to get the library Usb Host Shield 2.0 to work with a PS4 bluetooth controller and a blackpill.

https://github.com/felis/USB_Host_Shield_2.0

STM32F1 is not supported but I have made it work by using this tip from 2019.

https://github.com/felis/USB_Host_Shield_2.0/issues/498

Everything works as expected with the PS4BT sketch and output to serial.

I added your library to make the output a XBOX360 controller and it compiled fine without errors but its lagging. USBXBox360 more than a second lag. USBXBox360W half a second lag. I tried with USBCompositeSerial and the output is perfect like serial. With Mouse, SimpleJoystick or SignedJoystick it lag again.

Just to test I tried without bluetooth and instead with a cable and PS4USB and there was no lag. So the lag is only with bluetooth.

I have tried the library from the 2019 tip and my own updated with the current version and the result was the same.

I looked around the internet for answers and found a user asking if others have experience with the same usb host shield and a pill back in 2018.

https://stm32duinoforum.com/forum/viewtopic_f_9_t_4172.html

The person's username is the same as yours and that's why I're asking here, in the hope that you are the same person and maybe know something.

petanque commented 2 years ago

I've found out more. I think there is a conflict with bInterval, but I have not fully understood why. If I set bInterval to 1ms as usbhost uses, then it works perfectly.