stm32duino / Arduino_Core_STM32

STM32 core support for Arduino
https://github.com/stm32duino/Arduino_Core_STM32/wiki
Other
2.76k stars 962 forks source link

[USB] Features request list #687

Open fpistm opened 4 years ago

fpistm commented 4 years ago

This issue aims to list all USB requests:

senceryazici commented 4 years ago

Like i've mentioned in #817 i'm looking foward for USB Host implementation, spesifically ACM VCP implementation. I basically need to create virtual serial port and talk to device through that.

Also, when the library is implemented I'll be happy to share my project as an example for the library maybe ? Thank you

oofus commented 4 years ago

Is there any progress on implementing PlugableUSB ? Is it even going to happen ?

fpistm commented 4 years ago

Hi @oofus , Time is always the missing ingredients. So, currently, there is no progress on this. Any contribution are welcome 😉

oofus commented 4 years ago

Hi @fpistm Thanks for the answer, at least I know the current status now.

Using and implementing are two quite different things. Just being willing to "give it a go" shouldn't be the criteria by which you pass an interview. You don't want any of my code near the core libraries !!!

Cheers

HamidSaffari commented 4 years ago

Hi there. Would you tell us where we can find some examples of that USB Middleware library. Or write us one example code like read/write from a mass strong host device by using the MSC lib. even for STM32CubeIDE so we can start porting it for Arduino. Also is there any way that we use the Arm Mbed APIs with Arduino_Core_STM32 core? Here is USBMSD API and functions for the mbed.

HelloDB commented 4 years ago

Thank you for your work. Can you provide an example of keyboard that can be used in BIOS environment

fpistm commented 4 years ago

Thank you for your work. Can you provide an example of keyboard that can be used in BIOS environment

Hi and welcome. There is already a HID Kbd example. Don't know if it can work in BIOS environment.

HelloDB commented 4 years ago

Hi, I tested the keyboard in BIOS environment. It works well, but I can't find an example of AbsoluteMouse. I'm trying to modify the Mouse library

fpistm commented 4 years ago

Fine. For absolute mouse, I never tried. I guess you will have to modify the library.

fpistm commented 4 years ago

In fact it seems it will requires more dev as currently the mouse only send the relative move. There is no get report. What is your goal? get the absolute position or send it ?

HelloDB commented 4 years ago

I want to make a remote mouse, sending absolute coordinate data is easier to control it than using relative coordinate data

HelloDB commented 4 years ago

In fact it seems it will requires more dev as currently the mouse only send the relative move. There is no get report. What is your goal? get the absolute position or send it ?

I generate the mouse position in the webpage, send it to ESP32 through the server and then send it to STM32, and then STM32 controls the mouse movement of another computer

HelloDB commented 4 years ago

I added moveTo(uint16_t x, uint16_t y, uint8_t wheel) and modified HID_MOUSE_ReportDesc HID_MOUSE_REPORT_DESC_SIZE and still cannot control the mouse

MS1987 commented 3 years ago

@fpistm , time flies. How about the function of USB Host now?

fpistm commented 3 years ago

@MS1987

@fpistm , time flies. How about the function of USB Host now?

and it will continue. Time is always the missing ingredient.

rhapsodyv commented 3 years ago

Hi, @fpistm

I'm an active marlin contributor.

And I just got usb host with mass storage working on marlin, using your middleware + conf generated in cube mx for otg on gpio.

I would to like to know what is the api/interface that I should follow to send a PR to you. Or general guidelines for the integration of the usb host. Any info will help me to send a good PR for you. :-)

senceryazici commented 3 years ago

That’s great! I’ll be looking up to it @rhapsodyv

HamidSaffari commented 3 years ago

@rhapsodyv Here is the USB Middleware library and here is the USB API documents for ARM mbed OS which would be nice if we can port and use it inside Arduino core.

rhapsodyv commented 3 years ago

I just pushed a working version, #1196. Right now, it just expose the default USBH_MSC_ interface from STM32_USB_Host_Library. There're some work to do, and it isn't a standard interface yet, but I think it's good for a first version. And it's working! I'm using it in Marlin.

I commented with a sample usage too.

Hyratel commented 2 years ago

still no examples for Joystick via USB HID Middleware, and MHeironymous's Joystick library relies on HID.h (arduino core) -> PluggableUSB.h (arduino core) -> USBAPI.h (arduino core)

shreeshan97 commented 2 years ago

Is USB MSC + CDC ready?? Any example available??

Levi--G commented 2 years ago

@Hyratel I don't know if its still relevant to you but i just "completed" a basic library to add the traditional HID/PluggableUSB support. It is in nowhere ready for merging in the core, but if MHeironymous's joystick emulation is all you need you can use it right now. ;)

If anyone else comes across this and is knowledgeable in usb feel free to contact me to make the library more compatible. :)

Hyratel commented 2 years ago

@Levi--G I'd definitely be interested in what you have thusfar and yes - MHJoy is about all I'm after for this. it's about the only thing blocking the 32F401 from being a viable competitor to the 32F103 or Pro Micro in the Simpit and Custom Joystick scene (MHJoy is kinda Hammery (very few iterative loops, everything is done in a very sequential way; it makes a good primer to HID descriptor construction) but also very understandable to an amateur like myself, it has a very clean structure)

Levi--G commented 2 years ago

@Hyratel Well i noticed a while ago that my library actually works "by accident" if you just use the HID class it will work, but while working on receiving code i noticed i would have to redo a lot of code already in the framework... So now im running into the issue my library would need to replace framework files to work, which would either be manually or via some scripting in platformio, not compatible with arduino ide. So atm im still figuring things out :/ if you use platformio and only are interested in basic HID with SEND only and no USBSerial you can use my lib here: https://registry.platformio.org/libraries/levi--g/USBLibrarySTM32 But a proper redo with receiving and proper endpoint handling will take some time sadly :(

Hyratel commented 2 years ago

@Levi--G I got it working on F401 with your LibHack, so it's rough-and-ready for that. I look forward to it being given bidirectional, but even this much is a watershed moment for the chip's usability

(this is long overdue, considering that the chip has been around for almost 10 years now)

SunboX commented 1 year ago

I'm looking for a USB MIDI Device or Host example for the F103C6 or F103C8. Is there already one available?

I've currently this one working (USB MIDI Device): https://github.com/arpruss/USBComposite_stm32f1/blob/master/examples/midiout/midiout.ino

But it uses the Maple core and is incompatible with other libraries that are using the STM32Duino core.

Edit: Seems my question is related to https://github.com/stm32duino/Arduino_Core_STM32/issues/1533

fpistm commented 1 year ago

Hi @SunboX,

unfortunately not. IIRW, On the forum some ones talk about this but I guess there is no progress.

Levi--G commented 1 year ago

@SunboX Well... i wrote a library to support all the original arduino usb libraries (i linked it a bit up) but i did not test MIDI yet, and installation is kindof hard atm since there is a bug in platformio, ill see if i can get it working yet and maybe you can test it then? It might work or not, but might be worth trying?

Levi--G commented 1 year ago

@SunboX Hi, sorry to ping you twice, but i just tested my library with the default arduino MIDIUSB and it works, I included a sample in the repository, it might not be ideal (especially with the extended installation procedure) but it might at least work with the new core :)

fpistm commented 1 year ago

@SunboX Hi, sorry to ping you twice, but i just tested my library with the default arduino MIDIUSB and it works, I included a sample in the repository, it might not be ideal (especially with the extended installation procedure) but it might at least work with the new core :)

Nice @Levi--G Thanks for sharing.

sstaub commented 1 year ago

Are there any news? I see there is no real progress since some years.

Levi--G commented 1 year ago

Well I would be prepared to do the work to integrating my "library" as an alternative USB implementation to provide compatibility with the traditional arduino libraries and check at least a few boxes. But i need someone from the team (maybe @fpistm ?) to guide me towards how to implement it in a way where it would not interfere with the original implmentation. Like what boards need to be supported (i ran into issues with DMA on some boards), what defines to use, make sure it doesn't interfere with the other implementation and set up testing and documentation and such... Not to mention code review and writing style i didn't even check for. 😓

fpistm commented 1 year ago

USB_CON is used to enabled USB. So You can simply try to use new define and add menu option to the boards.txt

Levi--G commented 11 months ago

Yea the problem is I tried some different devices like stm32F401 or stm32F411 but there it does not seem to work, I don't know what goes wrong. I tried debugging with bmp and capturing packets, but the communication does not seem to work. The setup goes correctly so the hid devices are made and registered fine, but after that none of the endpoints are transmitting data. I have seen these devices don't use DMA for their communication, maybe that is the difference, but I cannot seem to find the issue as the calls made are identical to the usbcomposite library. So I am stuck not knowing if it has any use if only one device is confirmed working and at least 2 are not...

Hyratel commented 11 months ago

F401

I had good results using the Arduino IDE, not VSCode @Levi--G (do not like VScode for Assorted Personal Reasons). the only change I had to make was https://github.com/Levi--G/USBLibrarySTM32/issues/1