I have the same expreience. The USB flash drive examples do compile after installing the following. But there is no HIDHost.h.
I do not yet have a board :(. The USBHostMbed library is very sparse so I will be looking Teensy 4.1 with USBHost_t36.
Name: "Arduino_USBHostMbed5"
Author: Arduino
Maintainer: Arduino <info@arduino.cc>
Sentence: ARM Mbed5 USBHOST library port for Arduino.
Paragraph: This library contains an Arduino port for the ARM Mbed5 USBHost library for STM32H747 based boards.
Website: https://github.com/arduino-libraries/Arduino_USBHostMbed5
Category: Communication
Architecture: mbed, mbed_portenta, mbed_giga
Types: Contributed
Versions: [0.0.3]
I received my board on Monday and it’s been a frustrating experience. I’ve been spending most of my time reading the hardware core code, because of the broken examples. Lots of warnings during compilations too. I’d swear we’re still in Beta :-). But, the board is impressive and I’m having a lot of fun playing with coding dual-core stuff.
My only answer to the OP, hang in there and keep experimenting, it will get better.
Yes, I've been having a similar experience, also got my board on Monday and was hoping to record a video and write an article about it by this weekend. But with so many non-functional examples, it's proving difficult.
Glad to see I'm not the only one who feels like we are in Beta mode!
In the particular case of the "Keyboard Example", we had missed to link the USBHostGiga library, which is currently in an Alpha stage. We are updating this documentation as we speak. This library can be downloaded from this GitHub repository.
I should also add (and I am updating the documentation to specify this more clearly), that the USB features on the GIGA board are currently split between three separate libraries and therefore I think there may have been some confusion and broken examples.
Hi @bexin , there could be several reasons for the mbed os to crash, but some of the more common are:
The USB drive may not be properly formatted. It should be formatted with the FAT32 file system and an MBR partition scheme. Try reformat the drive and see if it works.
The designation may be wrong. If your USB drive is named e.g. device_1, it needs to be reflected in the code.
Was having more bizarre issues, such as code that compiles on one workstation but not on the other, until I realized that the USBHost library appears to have changed names!
The copy I installed from the Library Manager on Mar 16 was version 0.0.2. It was named "USBHostMbed5" and the file directory example works properly with it. The file write demo also works once you fix the errors in the sketch (should be "msd.connect" and not "msd.connected").
The latest installation of the library installed today (March 19) is 0.0.3. It installs under the name "Arduino_USBHostMbed5", and none of the examples using the USB file system work with it, as they expect to find "USBHostMbed5.h". Changing the reference in the examples to "Arduino_USBHostMbed5.h" compiles.
I've experienced this on both Linux and Windows. Very frustrating to say the least, it's bad enough that there are so many errors in the example code, but to change library names between versions is just silly.
Are you using the examples that come with the version 0.0.3 installation? I ask because all the #include directives were updated to the new header filename before the release:
So the problem should not occur with the library's example sketches, which are updated along with the library. It would occur with any standalone code that was saved separately from the library though.
Even though it would normally be best practices to rename primary header filenames in a backwards compatible manner, in this case where the library is still in the unstable development phase (as indicated by the use of the 0 major version series), I think it is reasonable for the developers to make such changes in a breaking manner rather than building up cruft in the repository. However, I do think it would be a good idea to communicate such breaking changes to the users in the release notes. I submitted a report about that:
@ksoderby I don't have write permissions in the repository so I can't update the release notes (and it can't be done via a pull request). If you have write permissions, please document the header filename change in the 0.0.3 release notes. You can do that by clicking the pencil icon near the top right corner of the release page:
Thanks for addressing this @ptillisch , and for posting the issue in the repository.
@DroneBotWorkshop the documentation including the examples will be updated in short, with the new library name. The name update had an unfortunate timing, apologies for the inconvenience there. Hopefully this will resolve any of the issues you had, otherwise, please let us know if there are any other issues
Through much trial and error, I found one cause for mbed to crash. The USB Host examples, for some reason, are using Serial, which isn't available when working as a Host.
Obviously, this means you need an external USB-to-serial converter.
I don't understand why the USB Host examples use Serial. My understanding was that there is only 1 USB PHY, so the STM32 cannot be both a host and device. Which, these numerous issues would back up.
I do believe that usb OTG configuration should support both device and host, while there are also device only and host only modes. Based on the stm33cube config options, I’ll recheck later today.
I noticed the 3 mass storage examples different in an OTG reference. The list directory example has none. The Read example has mbed::DigitalOut otg(PB_14, 0); and the write example has mbed::DigitalOut otg(PB_8, 1);.
Of course, I see no comment (or readily available documentation) on what either of those calls/pins do.
Of those three examples, none of them worked for me when using Serial. They all caused mbed to crash.
The Write example also has an issue with msd.connect() and msd.connected(). The single call to connect() and then waiting for connected() to become true never happens. I don't know why that example uses a different method than the other two.