Coder Social home page Coder Social logo

arduino_usbhostmbed5's People

Contributors

aentinger avatar aliphys avatar alrvid avatar andrewcapon avatar cristidragomir97 avatar dependabot[bot] avatar facchinm avatar kurte avatar manchoz avatar mirkopac avatar rocketct avatar sebromero avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

arduino_usbhostmbed5's Issues

Update of MBED core from 4.0.8 to 4.0.10 breaks library

After update from 4.0.8 to 4.0.10 it has broken the USB library for the Giga. The following error dump during compilation is generated:

In file included from c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.cpp:33:0: c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:137:2: error: #error "USB power pin is not configured !" #error "USB power pin is not configured !" ^~~~~ In file included from c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.cpp:33:0: c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:336:2: error: #error "USB pins are not configured !" #error "USB pins are not configured !" ^~~~~ In file included from c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.cpp:33:0: c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h: In function 'void usb_vbus(uint8_t)': c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:145:40: error: 'USB_POWER_OFF' was not declared in this scope gpio_write(&gpio_powerpin, USB_POWER_OFF); ^~~~~~~~~~~~~ c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:145:40: note: suggested alternative: 'USB_TYPE_OK' gpio_write(&gpio_powerpin, USB_POWER_OFF); ^~~~~~~~~~~~~ USB_TYPE_OK c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:147:40: error: 'USB_POWER_ON' was not declared in this scope gpio_write(&gpio_powerpin, USB_POWER_ON); ^~~~~~~~~~~~ c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:147:40: note: suggested alternative: 'USB_TYPE_OK' gpio_write(&gpio_powerpin, USB_POWER_ON); ^~~~~~~~~~~~ USB_TYPE_OK In file included from c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.cpp:33:0: c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h: In constructor 'USBHALHost::USBHALHost()': c:\Users\chris\OneDrive\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:342:5: error: 'USB_POWERPIN_CONFIG' was not declared in this scope USB_POWERPIN_CONFIG;

Portenta Machine Control USB drive - Error mounting USB device -22

Hello, I am trying to store and read files from a USB drive. I tested the example DirList.ino and uncomment the line mbed::DigitalOut otg(PB_14, 0); as specified.

Here is my full code that I tested on Portenta Machine Control (PMC) with USB drive connected to it (just a regular USB stick, formatted to FAT32)

/*
  Portenta - DirList

  The sketch shows how to mount an usb storage device and how to
  get a list of the existing folders and files.

  The circuit:
   - Portenta H7

  This example code is in the public domain.
*/

#include <Arduino_MachineControl.h>
#include <DigitalOut.h>
#include <FATFileSystem.h>
#include <Arduino_USBHostMbed5.h>

using namespace machinecontrol;

USBHostMSD msd;
mbed::FATFileSystem usb("usb");

// If you are using a Portenta Machine Control uncomment the following line
 mbed::DigitalOut otg(PB_14, 0);

void setup()
{
    Serial.begin(115200);
    while (!Serial)
        ;

    Serial.println("Starting USB Dir List example...");

    // if you are using a Max Carrier uncomment the following line
    // start_hub();

    while (!msd.connect()) {
        //while (!port.connected()) {
        delay(1000);
    }

    Serial.print("Mounting USB device... ");
    int err = usb.mount(&msd);
    if (err) {
        Serial.print("Error mounting USB device ");
        Serial.println(err);
        while (1);
    }
    Serial.println("done.");

    char buf[256];

    // Display the root directory
    Serial.print("Opening the root directory... ");
    DIR* d = opendir("/usb/");
    Serial.println(!d ? "Fail :(" : "Done");
    if (!d) {
        snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno);
        Serial.print(buf);
    }
    Serial.println("done.");

    Serial.println("Root directory:");
    unsigned int count { 0 };
    while (true) {
        struct dirent* e = readdir(d);
        if (!e) {
            break;
        }
        count++;
        snprintf(buf, sizeof(buf), "    %s\r\n", e->d_name);
        Serial.print(buf);
    }
    Serial.print(count);
    Serial.println(" files found!");

    snprintf(buf, sizeof(buf), "Closing the root directory... ");
    Serial.print(buf);
    fflush(stdout);
    err = closedir(d);
    snprintf(buf, sizeof(buf), "%s\r\n", (err < 0 ? "Fail :(" : "OK"));
    Serial.print(buf);
    if (err < 0) {
        snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno);
        Serial.print(buf);
    }
}

void loop()
{
}

However there is an error in the Serial Monitor. Any ideas?

Starting USB Dir List example...
Mounting USB device... Error mounting USB device -22

GIGA R1: PL2303 USB Serial Adapter - faulting in USBDeviceConnected::getEndpoint

Like #32. There is a lot more information in the forum posts:
https://forum.arduino.cc/t/can-not-find-examples-for-usbhostserial/1182486/18?u=kurte

I am trying to get some USB to Serial adapters to work, that are not the CDC ACM devices (would like to get those to work as well).

So I started hacking up my own object. Currently doing it all within an Arduino sketch, where I have the .cpp and .h for the new object contained within the sketch.

In this case the device is a GPS unit has an PL2303 chipset in it:

My connect code:

bool USBHostFTDI::connect() {
  USB_INFO(" USBHostFTDI::connect() called\r\n");
  if (dev) {
    for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++) {
      USBDeviceConnected* d = host->getDevice(i);
      if (dev == d)
        return true;
    }
    disconnect();
  }
  host = USBHost::getHostInst();
  for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++) {
    USBDeviceConnected* d = host->getDevice(i);
    USB_DBG("\tDev: %p\r\n", d);
    if (d != NULL) {
      USB_INFO("Device:%p\r\n", d);
      if (host->enumerate(d, this) != USB_TYPE_OK) {
        USB_INFO("Enumerate returned status not OK");
        continue;  //break;  what if multiple devices?
      }

      printf("\tconnect hser_device_found\n\r");

      bulk_in = d->getEndpoint(intf_SerialDevice, BULK_ENDPOINT, IN);
      USB_INFO("bulk in:%p", bulk_in);

      bulk_out = d->getEndpoint(intf_SerialDevice, BULK_ENDPOINT, OUT);
      USB_INFO(" out:%p\r\n", bulk_out);

      printf("\tAfter get end points\n\r");
      if (bulk_in && bulk_out) {
        dev = d;
        dev_connected = true;
        //        USB_INFO("New hser device: VID:%04x PID:%04x [dev: %p - intf: %d]", dev->getVid(), dev->getPid(), dev, intf_SerialDevice);
        printf("New hser device: VID:%04x PID:%04x [dev: %p - intf: %d]", dev->getVid(), dev->getPid(), dev, intf_SerialDevice);
        dev->setName("Serial", intf_SerialDevice);
        host->registerDriver(dev, intf_SerialDevice, this, &USBHostFTDI::init);
        size_bulk_in = bulk_in->getSize();
        size_bulk_out = bulk_out->getSize();

        bulk_in->attach(this, &USBHostFTDI::rxHandler);
        bulk_out->attach(this, &USBHostFTDI::txHandler);
        host->bulkRead(dev, bulk_in, buf, size_bulk_in, false);
        printf("\n\r>>>>>>>>>>>>>> connected returning true <<<<<<<<<<<<<<<<<<<<\n\r");
        return true;
      }
    }
  }
  init();
  return false;
}

It is faulting on the call:
bulk_in = d->getEndpoint(intf_SerialDevice, BULK_ENDPOINT, IN);
Note: the useEndpoints code could be simplified:

/*virtual*/ bool USBHostFTDI::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir)  //Must return true if the endpoint will be used
{
  USB_INFO("USBHostFTDI::useEndpoint(%u, %u, %u\n\r", intf_nb, type, dir);
  printf("USBHostFTDI::useEndpoint(%u, %u, %u\n\r", intf_nb, type, dir);
  if (intf_nb == intf_SerialDevice) {
    //if (type == INTERRUPT_ENDPOINT && dir == IN) return true; // see if we can ignore it later

    if (type == BULK_ENDPOINT && dir == IN) {
      hser_device_found = true;
      return true;
    }
    if (type == BULK_ENDPOINT && dir == OUT) {
      hser_device_found = true;
      return true;
    }
  }
  return false;
}

Note: these devices as well as some other USB to Serial adapters, the interface has 3 endpoints,
The first one typically being an Interrupt IN, which, I am saying NO to use. the second and third endpoints are BULK OUT and BULK IN which I am trying to use. This should work as it is how the devices are handled in some other code bases.

Here is debug output for a run I just did, which is now in the blinking red lights cycle...

Starting hser test...
[USB_INFO: C:\Users\kurte\Documents\Arduino\Arduino_GIGA\USBHost_FTDI_plus\USBHostFTDI.cpp:70] USBHostFTDI::connect() called

[USB_DBG: C:\Users\kurte\Documents\Arduino\Arduino_GIGA\USBHost_FTDI_plus\USBHostFTDI.cpp:82]	Dev: 0x2400c77c

[USB_INFO: C:\Users\kurte\Documents\Arduino\Arduino_GIGA\USBHost_FTDI_plus\USBHostFTDI.cpp:84]Device:0x2400c77c

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:932]Enumerate dev: 0x2400c77c index: 0
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:938]dev: 0x2400c77c nb_intf: 0
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:939]dev: 0x2400c77c nb_intf_attached: 0
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:945]Enumerate dev: 0x2400c77c
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:957]DEVICE DESCRIPTOR(18):

12 01 10 01 00 00 00 40 7B 06 03 23 00 04 01 02 00 01 

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:969]CLASS: 00 	 VID: 067B 	 PID: 2303
[USB_INFO: C:\Users\kurte\Documents\Arduino\Arduino_GIGA\USBHost_FTDI_plus\USBHostFTDI.cpp:142]VID: 67B, PID: 2303


VID: 67B, PID: 2303 PL2303

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:876]TOTAL_LENGTH: 39 	 NUM_INTERF: 1
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:979]CONFIGURATION DESCRIPTOR:

09 02 27 00 01 01 00 80 32 09 04 00 00 03 FF 00 00 00 07 05 81 03 0A 00 01 07 05 02 02 40 00 00 07 05 83 02 40 00 00 

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1031]dev: 0x2400c77c has 1 intf
[USB_INFO: C:\Users\kurte\Documents\Arduino\Arduino_GIGA\USBHost_FTDI_plus\USBHostFTDI.cpp:165]USBHostFTDI::parseInterface nb:0, cl:255 isub:0 iprot:0


USBHostFTDI::parseInterface nb:0, cl:255 isub:0 iprot:0

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1040]ADD INTF 0 on device 0x2400c77c: class: 255, subclass: 0, proto: 0
[USB_INFO: C:\Users\kurte\Documents\Arduino\Arduino_GIGA\USBHost_FTDI_plus\USBHostFTDI.cpp:176]USBHostFTDI::useEndpoint(0, 3, 2


USBHostFTDI::useEndpoint(0, 3, 2

[USB_INFO: C:\Users\kurte\Documents\Arduino\Arduino_GIGA\USBHost_FTDI_plus\USBHostFTDI.cpp:176]USBHostFTDI::useEndpoint(0, 2, 1


USBHostFTDI::useEndpoint(0, 2, 1

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:610]USBEndpoint created (0x2400c16c): type: 2, dir: 1, size: 64, addr: 2, state: USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1059]ADD USBEndpoint 0x2400c16c, on interf 0 on device 0x2400c77c
[USB_INFO: C:\Users\kurte\Documents\Arduino\Arduino_GIGA\USBHost_FTDI_plus\USBHostFTDI.cpp:176]USBHostFTDI::useEndpoint(0, 2, 2


USBHostFTDI::useEndpoint(0, 2, 2

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:610]USBEndpoint created (0x2400c204): type: 2, dir: 2, size: 64, addr: 3, state: USB_TYPE_IDLE
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1059]ADD USBEndpoint 0x2400c204, on interf 0 on device 0x2400c77c
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:992]Set configuration 1 on dev: 0x2400c77c
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1005]dev 0x2400c77c is enumerated

	connect hser_device_found

[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBDeviceConnected.cpp:104]getEndpoint(0 2 2 0 0x2
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBDeviceConnected.cpp:109]index: 0 0xffff

Note the last two debug lines are from some debug information I added to the library code:

USBEndpoint * USBDeviceConnected::getEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint8_t index) {
    USB_DBG("getEndpoint(%u %u %u %u %p", intf_nb, type, dir, index);
    if (intf_nb >= MAX_INTF) {
        return NULL;
    }
    for (int i = 0; i < MAX_ENDPOINT_PER_INTERFACE; i++) {
        USB_DBG("index: %d %p", i, intf[intf_nb].ep[i]);
        if ( intf[intf_nb].ep[i] == nullptr) continue; // don't walk through NULL
        if ((intf[intf_nb].ep[i]->getType() == type) && (intf[intf_nb].ep[i]->getDir() == dir)) {
            if(index) {
                index--;
            } else {
                return intf[intf_nb].ep[i];
            }
        }
    }
    return NULL;
}

My first guess was the: intf[intf_nb].ep[i]
value was probably going to be NULL, so I added test for it, which did not help.
Looks like the value is: 0xffff
Which then trying to use that as an object pointer faulted. Not sure if that has special meaning here? Or
the code is not handling the case where there are more end points than the library is configured to allow per interface?
or?

GIGA R1 - USBHost issues

Hi Guys,

I have managed to get a hacked version running a Midi Host:

[USB_TRANSFER: .pio/libdeps/giga_m7/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:1100]----- BULK READ [dev: 0x24010554 - MIDI - hub: 0 - port: 1 - addr: 1 - ep: 81]------
[USB_EVENT: .pio/libdeps/giga_m7/Arduino_USBHostMbed5/src/USBHost/USBHost.cpp:274]call callback on td 0x2400161f [ep: 0x2400ffdc state: USB_TYPE_IDLE - dev: 0x24010554 - MIDI]
READ SUCCESS [64 bytes transferred - td: 0x2400161F] on ep: [0x2400ffdc - addr: 81]: 0B B0 4F 5B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

[USB_INFO: .pio/libdeps/giga_m7/Arduino_USBHostMbed5/src/USBHostMIDI/USBHostMIDI.cpp:102] MIDI MESSAGE b, b0, 4f, 5b

Along the way I have found the following:

First issue: Getting the configuration descriptor was not working, this was due to only a maximum of 64 bytes being returned, so any data after this was being lost.

In USBEndpoint_STM.cpp :

  1. queueTransfer() will only call HAL_HCD_HC_SubmitRequest with a maximum size of 64.
  2. HAL_HCD_HC_NotifyURBChange_Callback() has code on URB_DONE to call HAL_HCD_HC_SubmitRequest() to get the next packet of data, the call works but something is going wrong. We do not get another URB_DONE, so the maximum data returned is 64 bytes.

HAL_HCD_HC_SubmitRequest() can internally handle this packet splitting, you can just request all the data needed and it will work it out. I changed the code to do this and now the data is returned correctly. There is still an issue with control->ep_queue.get(TD_TIMEOUT_CTRL); timing out that I need to look into, the data is there but we get the timeout.

Second issue: The dreaded MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL=0 causing the callbacks to fail. See #29 (comment)

This was fixed by forcing MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL=1 in callback.h

So I guess the question is if the maximum size of 64 bytes is a known issue?

Support Low Speed device? like many boot level keyboards?

There are several devices like keyboards, which run in USB Low Speed (1.5MBps) and are not properly being handled.
For example, I have a Dell keyboard plugged in. I believe this one came with my newer computer I purchased in the last couple of years.

If I run the KeyboardGiga example sketch from the USBHostGiga library it receives, the keystrokes and prints them out in the Serial monitor.

If I instead run a similar test using this library it does not.

/*
  USBHost Keyboard test


  The circuit:
   - Arduino GIGA

  This example code is in the public domain.
*/

#include <Arduino_USBHostMbed5.h>
#include <USBHostHID/USBHostKeyboard.h>
REDIRECT_STDOUT_TO(Serial)

USBHostKeyboard kbd;

// If you are using a Portenta Machine Control uncomment the following line
// mbed::DigitalOut otg(PB_14, 0);

void setup()
{
    Serial.begin(115200);
    while (!Serial) {}

    Serial.println("Starting Keyboard test...");

    // Enable the USBHost 
    pinMode(PA_15, OUTPUT);
    digitalWrite(PA_15, HIGH);

    // if you are using a Max Carrier uncomment the following line
    // start_hub();
    kbd.attach(&kbd_key_cb);
    kbd.attach(&kbd_keycode_cb);

    while (!kbd.connect()) {
      Serial.println("No keyboard connected");        
        delay(5000);
    }
}

void loop()
{
    delay(1000);
}

void kbd_key_cb(uint8_t key) {
  Serial.print("Key pressed: ");
  Serial.print(key, HEX);
  Serial.print("(");
  if ((key >= ' ') && (key <= '~')) Serial.write(key);
  Serial.println(")");
}

void kbd_keycode_cb(uint8_t keycode, uint8_t mod) {
  Serial.print("Keycode: ");
  Serial.print(keycode, HEX);
  Serial.print(" mod: ");
  Serial.println(mod, HEX);
}

I added debug output to the keyboard class... So I know it is being called. Debug shows:

Starting Keyboard test...
No keyboard connected
got device
intf_class: 3
intf_subclass: 1
intf_protocol: 1
intf_nb: 0
intf_class: 3
intf_subclass: 0
intf_protocol: 0
ret: 0
after enumerate

The input code for the Serial class is not receiving any data.
I have a Logic Analyzer attached and it is showing the device is sending data:
image

And using my USB Analyzers for the Saleae, we see the following messages:

xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">

<style> </style>
0.832053362 SETUP 0x0 0x0 [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0  
0.832366214 IN 0x0 0x0   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8  
0.832567682 SETUP 0x0 0x0 SET_ADDRESS I:0x0 L:0x0] 0x0 0x5 0x1 0x0 0x0 0x0 0x0 0x0  
0.83507364 SETUP 0x0 0x1 [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] 0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0  
0.835433222 IN 0x0 0x1   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8  
5.247817658 SETUP 0x0 0x1 [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] 0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0  
5.248132034 IN 0x0 0x1   0x12 0x1 0x10 0x1 0x0 0x0 0x0 0x8  
5.248332872 IN 0x0 0x1   0xca 0x4 0x27 0x0 0x18 0x1 0x1 0x2  
5.24848434 IN 0x0 0x1   0x0 0x1  
5.248818002 SETUP 0x0 0x1 [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] 0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0  
5.249177614 IN 0x0 0x1   0x9 0x2 0x3b 0x0 0x2 0x1 0x0 0xa0  
5.249328152 IN 0x0 0x1   0x32  
5.24949202 SETUP 0x0 0x1 [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x3b] 0x80 0x6 0x0 0x2 0x0 0x0 0x3b 0x0  
5.249817728 IN 0x0 0x1   0x9 0x2 0x3b 0x0 0x2 0x1 0x0 0xa0  
5.250017522 IN 0x0 0x1   0x32 0x9 0x4 0x0 0x0 0x1 0x3 0x1  
5.250218148 IN 0x0 0x1   0x1 0x0 0x9 0x21 0x10 0x1 0x0 0x1  
5.250416976 IN 0x0 0x1   0x22 0x41 0x0 0x7 0x5 0x81 0x3 0x8  
5.25081862 IN 0x0 0x1   0x0 0x18 0x9 0x4 0x1 0x0 0x1 0x3  
5.251016772 IN 0x0 0x1   0x0 0x0 0x0 0x9 0x21 0x10 0x1 0x0  
5.251216778 IN 0x0 0x1   0x1 0x22 0x9f 0x0 0x7 0x5 0x82 0x3  
5.25141592 IN 0x0 0x1   0x8 0x0 0xa  
5.257467042 SETUP 0x0 0x1 [SET_CONFIGURATION I:0x0 L:0x0] 0x0 0x9 0x1 0x0 0x0 0x0 0x0 0x0  
5.762888028 IN 0x1 0x1   0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0  
5.85990304 IN 0x1 0x1   0x0 0x0 0x38 0x0 0x0 0x0 0x0 0x0  
5.952923144 IN 0x1 0x1   0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0  
6.079945542 IN 0x1 0x1   0x0 0x0 0x38 0x0 0x0 0x0 0x0 0x0  
6.228969228 IN 0x1 0x1   0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0  
6.351984988 IN 0x1 0x1   0x0 0x0 0x38 0x0 0x0 0x0 0x0 0x0  
6.476997196 IN 0x1 0x1   0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0  
6.59402179 IN 0x1 0x1   0x0 0x0 0x38 0x0 0x0 0x0 0x0 0x0  
6.71103967 IN 0x1 0x1   0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0  
6.816071866 IN 0x1 0x1   0x0 0x0 0x10 0x0 0x0 0x0 0x0 0x0  
7.007111472 IN 0x1 0x1   0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0  
For more information about this device, I ran my sketch which tries to print out information about the device, Currently up at: https://github.com/KurtE/GIGA_USBHostMBed5_devices/tree/main/examples/GIGA_USBHost_DeviceInfo


*** starting Device information sketch ***
Device:0x2400c714
VID: 4CA, PID: 27
Manufacturer: Lite-On Technology Corp.
Product: USB Multimedia Keyboard
Speed: 0
Size of configuration Descriptor: 59
Configuration Descriptor
2400E8D0 - 09 02 3B 00 02 01 00 A0  32 09 04 00 00 01 03 01  : ..;..... 2.......
2400E8E0 - 01 00 09 21 10 01 00 01  22 41 00 07 05 81 03 08  : ...!.... "A......
2400E8F0 - 00 18 09 04 01 00 01 03  00 00 00 09 21 10 01 00  : ........ ....!...
2400E900 - 01 22 9F 00 07 05 82 03  08 00 0A                 : ."...... ...
Config:
 wTotalLength: 59
 bNumInterfaces: 2
 bConfigurationValue: 1
 iConfiguration: 0
 bmAttributes: 160
 bMaxPower: 50
****************************************
** Interface level **
  bInterfaceNumber: 0
  bAlternateSetting: 0
  Number of endpoints: 1
  bInterfaceClass: 3
  bInterfaceSubClass: 1
    HID (BOOT)
  bInterfaceProtocol: 1
    Keyboard
  iInterface: 0
  HID Descriptor size: 65
  Endpoint: 81 In
    Attrributes: 3 Interrupt
    Size: 8
    Interval: 24
>>>>> USBDumperDevice::getHIDDesc(0) called <<<<< 
2400E918 - 05 01 09 06 A1 01 05 07  19 E0 29 E7 15 00 25 01  : ........ ..)...%.
2400E928 - 95 08 75 01 81 02 95 08  75 01 81 01 05 08 19 01  : ..u..... u.......
2400E938 - 29 03 95 03 75 01 91 02  95 01 75 05 91 01 05 07  : )...u... ..u.....
2400E948 - 19 00 2A FF 00 15 00 26  FF 00 95 06 75 08 81 00  : ..*....& ....u...
2400E958 - C0                                                : .

HID Report Descriptor (0x2400e918) size: 65
  05 01	// Usage Page(1) - Generic Desktop
  09 06	// Usage(6) -(Keyboard)
  A1 01	// Collection(1) top Usage(10000)
    05 07	// Usage Page(7) - Keycode
    19 E0	// Usage Minimum(e0) - (Left Control)
    29 E7	// Usage Maximum(e7) - (Right GUI)
    15 00	// Logical Minimum(0)
    25 01	// Logical maximum(1)
    95 08	// Report Count(8)
    75 01	// Report Size(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    95 08	// Report Count(8)
    75 01	// Report Size(1)
    81 01	// Input(1)	// (Constant, Array, Absolute)
    05 08	// Usage Page(8) - LEDs
    19 01	// Usage Minimum(1) - 
    29 03	// Usage Maximum(3) - 
    95 03	// Report Count(3)
    75 01	// Report Size(1)
    91 02	// Output(2)	// (Data, Variable, Absolute)
    95 01	// Report Count(1)
    75 05	// Report Size(5)
    91 01	// Output(1)	// (Constant, Array, Absolute)
    05 07	// Usage Page(7) - Keycode
    19 00	// Usage Minimum(0) - (Keycode 0)
    2A FF 00	// Usage Maximum(ff) - (Keycode 255)
    15 00	// Logical Minimum(0)
    26 FF 00	// Logical maximum(ff)
    95 06	// Report Count(6)
    75 08	// Report Size(8)
    81 00	// Input(0)	// (Data, Array, Absolute)
    C0	// End Collection
****************************************
** Interface level **
  bInterfaceNumber: 1
  bAlternateSetting: 0
  Number of endpoints: 1
  bInterfaceClass: 3
  bInterfaceSubClass: 0
    HID
  bInterfaceProtocol: 0
    None
  iInterface: 0
  HID Descriptor size: 159
  Endpoint: 82 In
    Attrributes: 3 Interrupt
    Size: 8
    Interval: 10
>>>>> USBDumperDevice::getHIDDesc(1) called <<<<< 
2400E918 - 05 01 09 80 A1 01 85 01  05 01 19 81 29 88 15 00  : ........ ....)...
2400E928 - 25 01 95 08 75 01 81 02  C0 05 0C 09 01 A1 01 85  : %...u... ........
2400E938 - 02 15 00 25 01 0A 83 01  0A CD 00 0A B7 00 0A E9  : ...%.... ........
2400E948 - 00 0A EA 00 0A E2 00 0A  B6 00 0A B5 00 0A 8A 01  : ........ ........
2400E958 - 0A 92 01 0A 94 01 0A 21  02 0A 23 02 0A 24 02 0A  : .......! ..#..$..
2400E968 - 25 02 0A 26 02 0A 27 02  0A 2A 02 95 12 75 01 81  : %..&..'. .*...u..
2400E978 - 02 95 01 75 06 81 01 C0  05 09 09 01 A1 01 85 03  : ...u.... ........
2400E988 - 15 00 25 01 0A 2C 00 0A  18 00 0A 20 00 0A 1F 00  : ..%..,.. ... ....
2400E998 - 0A 1C 00 0A 3D 00 0A 41  00 0A 42 00 0A 43 00 0A  : ....=..A ..B..C..
2400E9A8 - 46 00 95 0A 75 01 81 02  95 01 75 06 81 01 C0     : F...u... ..u....

HID Report Descriptor (0x2400e918) size: 159
  05 01	// Usage Page(1) - Generic Desktop
  09 80	// Usage(80) -(?)
  A1 01	// Collection(1) top Usage(10080)
    85 01	// Report ID(1)
    05 01	// Usage Page(1) - Generic Desktop
    19 81	// Usage Minimum(81) - (System Power Down)
    29 88	// Usage Maximum(88) - (?)
    15 00	// Logical Minimum(0)
    25 01	// Logical maximum(1)
    95 08	// Report Count(8)
    75 01	// Report Size(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    C0	// End Collection
  05 0C	// Usage Page(c) - Consumer
  09 01	// Usage(1) -(Consumer Controls)
  A1 01	// Collection(1) top Usage(c0000)
    85 02	// Report ID(2)
    15 00	// Logical Minimum(0)
    25 01	// Logical maximum(1)
    0A 83 01	// Usage(183) -(AL Consumer Control Configuration)
    0A CD 00	// Usage(cd) -(Pause/Continue)
    0A B7 00	// Usage(b7) -(Stop)
    0A E9 00	// Usage(e9) -(Volume Up)
    0A EA 00	// Usage(ea) -(Volume Down)
    0A E2 00	// Usage(e2) -(Mute)
    0A B6 00	// Usage(b6) -(Scan Previous Track)
    0A B5 00	// Usage(b5) -(Scan Next Track)
    0A 8A 01	// Usage(18a) -(AL Email Reader)
    0A 92 01	// Usage(192) -(AL Calculator)
    0A 94 01	// Usage(194) -(AL Local Machine Browser)
    0A 21 02	// Usage(221) -(AC Search)
    0A 23 02	// Usage(223) -(AC Home)
    0A 24 02	// Usage(224) -(AC Back)
    0A 25 02	// Usage(225) -(AC Forward)
    0A 26 02	// Usage(226) -(AC Stop)
    0A 27 02	// Usage(227) -(AC Refresh)
    0A 2A 02	// Usage(22a) -(AC Bookmarks)
    95 12	// Report Count(12)
    75 01	// Report Size(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    95 01	// Report Count(1)
    75 06	// Report Size(6)
    81 01	// Input(1)	// (Constant, Array, Absolute)
    C0	// End Collection
  05 09	// Usage Page(9) - Button
  09 01	// Usage(1) - (BUTTON 1)
  A1 01	// Collection(1) top Usage(90000)
    85 03	// Report ID(3)
    15 00	// Logical Minimum(0)
    25 01	// Logical maximum(1)
    0A 2C 00	// Usage(2c) - (BUTTON 44)
    0A 18 00	// Usage(18) - (BUTTON 24)
    0A 20 00	// Usage(20) - (BUTTON 32)
    0A 1F 00	// Usage(1f) - (BUTTON 31)
    0A 1C 00	// Usage(1c) - (BUTTON 28)
    0A 3D 00	// Usage(3d) - (BUTTON 61)
    0A 41 00	// Usage(41) - (BUTTON 65)
    0A 42 00	// Usage(42) - (BUTTON 66)
    0A 43 00	// Usage(43) - (BUTTON 67)
    0A 46 00	// Usage(46) - (BUTTON 70)
    95 0A	// Report Count(a)
    75 01	// Report Size(1)
    81 02	// Input(2)	// (Data, Variable, Absolute)
    95 01	// Report Count(1)
    75 06	// Report Size(6)
    81 01	// Input(1)	// (Constant, Array, Absolute)
    C0	// End Collection
parseInterface nb:0
 bInterfaceClass = 3
 bInterfaceSubClass = 1
    HID (BOOT)
 bProtocol = 1
    Keyboard
useEndpoint(0, 3, 2)
parseInterface nb:1
 bInterfaceClass = 3
 bInterfaceSubClass = 0
    HID
 bProtocol = 0
    None
New Debug device: VID:04ca PID:0027 [dev: 0x2400c714 - intf: 0]
USB host device(4ca:27) connected
Manufacturer: Lite-On Technology Corp.
Product: USB Multimedia Keyboard

Note: I tried to print out the speed of the device, but the method appears to always return false... From quick guessing I think should be HIGH for low speed? Would have hoped there were at least three values (LS, FS, HS), but it also appears like this library does not support High speed...

Breaking change to primary header filename not mentioned in release notes

The primary header filename was changed from USBHostMbed5.h to Arduino_USBHostMbed5.h in the 0.0.3 release:

c3182e9

This is a breaking change. Frequent breaking changes should be expected by the user of any project that is still in the unstable development phase, as indicated by the use of the the 0 major version series, however, it is still best practices to communicate about breaking changes even during that development phase.

No communication of the breaking change was made in the 0.0.3 release notes:

https://github.com/arduino-libraries/Arduino_USBHostMbed5/releases/tag/0.0.3


Originally reported at https://forum.arduino.cc/t/usb-host-keyboard-example-from-arduino-hidhost-library-not-found/1102876/10

USBHostSerial Example

I have been trying to get USB Host serial class to work with my USB device. I can connect the device to my computer and read/write commands via virtual COM port. I am using the Arduino Portneta Machine controller. Can you please give an example?

Way to retrieve the standard descriptor strings: Manufacturer, Product, Serial number

There are times, when a sketch may want to be have access to the information about what device is actually connected to their board. For example, suppose your sketch is setup to maybe handle two USBSerial objects, and both are connected. You may wish to query the Serial number to know which one is which....

For what is worth the USBHostGiga library appears to at least read them in and log them... Not sure yet if they are easily available to the user object...

But I believe with this library, the code does not even look at the indexes contained within the device descriptor. So it might be a little more problematic.

Might experiment with sketch code to see if I can ask to read the device descriptor again, and parse it myself, and then make a version of the Query Descriptor code that reads in strings.

GIGA R1: devices such as FTDI adapters with control endpoint transfer size=8 reading device descriptor does not work

As I have mentioned on the forum:
https://forum.arduino.cc/t/can-not-find-examples-for-usbhostserial/1182486/17
I am trying to hack up some code similar to the USBHostSerial code that works with other USB to Serial adapters other than those which are CDC ACM devices. Ones like FTDI, Prolific...

On the forum thread: I posted an example sketch which reproduces this, but just about any sketch that will print out the
wrong IDS. VID: 0103 PID: 0000

Where other code bases on some other Arduinos, plus Windows and Ubuntu return the IDs:
vid=403 pid=6001

Note: I just tried plugging it in to the GIGA board, with my Logic Analyzer hooked up to it, with my modified USB Analyzer and HLA, which helps reduce the data down...

The Packets that I received on the GIGA:

16.308830162 ; SETUP ; 0x0 ; 0x0 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
16.308907428 ; IN ; 0x0 ; 0x0 ;  ;  0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8
16.308963208 ; SETUP ; 0x0 ; 0x0 ; SET_ADDRESS I:0x0 L:0x0] ;  0x0 0x5 0x1 0x0 0x0 0x0 0x0 0x0
16.317414284 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x8] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x8 0x0
16.317496376 ; IN ; 0x0 ; 0x1 ;  ;  0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8
20.478046968 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - DEVICE #:0 I:0x0 L:0x12] ;  0x80 0x6 0x0 0x1 0x0 0x0 0x12 0x0
20.478125602 ; IN ; 0x0 ; 0x1 ;  ;  0x12 0x1 0x0 0x2 0x0 0x0 0x0 0x8
20.478314948 ; IN ; 0x0 ; 0x1 ;  ;  0x3 0x4 0x1 0x60 0x0 0x6 0x1 0x2
20.478336022 ; IN ; 0x0 ; 0x1 ;  ;  0x3 0x1
20.502892408 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x9] ;  0x80 0x6 0x0 0x2 0x0 0x0 0x9 0x0
20.503027744 ; IN ; 0x0 ; 0x1 ;  ;  0x9 0x2 0x20 0x0 0x1 0x1 0x0 0xa0
20.50305689 ; IN ; 0x0 ; 0x1 ;  ;  0x2d
20.510192198 ; SETUP ; 0x0 ; 0x1 ; [GET_DESCRIPTOR - CONFIG #:0 I:0x0 L:0x20] ;  0x80 0x6 0x0 0x2 0x0 0x0 0x20 0x0
20.510326864 ; IN ; 0x0 ; 0x1 ;  ;  0x9 0x2 0x20 0x0 0x1 0x1 0x0 0xa0
20.510358858 ; IN ; 0x0 ; 0x1 ;  ;  0x2d 0x9 0x4 0x0 0x0 0x2 0xff 0xff
20.510387752 ; IN ; 0x0 ; 0x1 ;  ;  0xff 0x2 0x7 0x5 0x81 0x2 0x40 0x0
20.510416558 ; IN ; 0x0 ; 0x1 ;  ;  0x0 0x7 0x5 0x2 0x2 0x40 0x0 0x0

I don't have time today, but it almost looks like the device is still only returning a max of something like 8 bytes at a time...
And You are probably indexing off the end of the data, and maybe not waiting for the additional data packets to be returned.

If I remember correctly on the Teensy USBHost code, we first asked for the device descriptor, for its first 8 bytes, and then update the control endpoint to the size specified in those first 8 bytes and then asked for the whole endpoint...

GIGA R1 USB Mass Storage Directory example causes MbedOS crash

Reference: https://forum.arduino.cc/t/giga-r1-usb-mass-storage-examples-has-anyone-managed-to-run-an-example-project/1127694

Several of us (@bobthedog, @KurtE and me) have been experimenting with the USBHost Mass Storage Example:

#include <DigitalOut.h>
#include <FATFileSystem.h>
#include <Arduino_USBHostMbed5.h>

USBHostMSD msd;
mbed::FATFileSystem usb("usb");


void setup()
{
    Serial.begin(115200);
    
    pinMode(PA_15, OUTPUT); //enable the USB-A port
    digitalWrite(PA_15, HIGH);
    
    while (!Serial)
        ;

    Serial.println("Starting USB Dir List example...");

    // if you are using a Max Carrier uncomment the following line
    // start_hub();

    while (!msd.connect()) {
        //while (!port.connected()) {
        delay(1000);
    }

    Serial.print("Mounting USB device... ");
    int err = usb.mount(&msd);
    if (err) {
        Serial.print("Error mounting USB device ");
        Serial.println(err);
        while (1);
    }
    Serial.println("done.");

    char buf[256];

    // Display the root directory
    Serial.print("Opening the root directory... ");
    DIR* d = opendir("/usb/");
    Serial.println(!d ? "Fail :(" : "Done");
    if (!d) {
        snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno);
        Serial.print(buf);
    }
    Serial.println("done.");

    Serial.println("Root directory:");
    unsigned int count { 0 };
    while (true) {
        struct dirent* e = readdir(d);
        if (!e) {
            break;
        }
        count++;
        snprintf(buf, sizeof(buf), "    %s\r\n", e->d_name);
        Serial.print(buf);
    }
    Serial.print(count);
    Serial.println(" files found!");

    snprintf(buf, sizeof(buf), "Closing the root directory... ");
    Serial.print(buf);
    fflush(stdout);
    err = closedir(d);
    snprintf(buf, sizeof(buf), "%s\r\n", (err < 0 ? "Fail :(" : "OK"));
    Serial.print(buf);
    if (err < 0) {
        snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno);
        Serial.print(buf);
    }
}

void loop()
{
}

So far as a Bottom Line Up Front:

Windows 10 with 2.2.1 IDE : Red lights of doom.
Windows 10 with 1.8.19 IDE : Works.

Windows 11 with 2.2.1 IDE : Red lights of doom.
Windows 11 with 1.8.19 IDE : Works.

Linux: MacOsX and RPI4
IDE 2.2.1 works

IDE 2.2.1 on Windows 11
Using Serial: Red lights of doom.
Using Serial1: Works

Example works if using release 0.0.3

Posts 31, 37, and 38 show and discuss debug outputs.

Believe in all cases with we are using GIGA version 4.0.8 (installed via boards manager).

As for memory sticks a number have been tested: I have used an old SansDisk Cruzer 2GB and a generic Microcenter 64Gb.

Reading Battery data from the DALY BMS in the Portenta machine control

Hi, i want to read a battery data from DALY BMS thru USB-A port in the arduino portenta machine control act as a USBHost for this particular one. So, i noticed this Arduino_USBHostMbed5 library could help on this, and i referred this to read the data from the Daly BMS, here's the output of serial monitor for the program

Starting USB File Read example...
Press any key and hit enter to query data from the BMS...
Basic BMS Data:              0.00V 0.00I 0.00% 
Package Temperature (C):     0.00
Highest Cell Voltage:        #0 with voltage 0.00
Lowest Cell Voltage:         #0 with voltage 0.00
Number of Cells:             0
Number of Temp Sensors:      0
BMS Chrg / Dischrg Cycles:   0
BMS Heartbeat:               0
Discharge MOSFet Status:     0

but first thing the arduino has to act as a usb host. Which example i can prefer on the given?

GIGA: Faults when I remove a device that has connected.

I am experimenting trying to create a USBSerial object that supports other adapters other than just CDC ACM. Such as FTDI, PL2303... Also will probably support CDC as well.

I was using version 0.2.0 of the library with USBHostConfig.h updated:

//#undef MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL
//#define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
//#include "Callback.h"

And some stuff is working. Although running into several other issues, such as failing to read in 18 byte device descriptor when the device is configured for 8 byte control endpoint #32 and that one hits in several different ways.

However, when I do succeed in having a device connect, when I unplug the device, the GIGA goes into the RED led blink of a crash.

I have now synced up to your current stuff which includes #35 and it still occurs. Also if I put those three lines mentioned above back in, the code faults on startup.

I ran the binary using hardware debugger under Ozone, and when I unplugged the adapter (PL2303), the fault happened at the address:

The target stopped in HardFault exception state.

Reason: A fault with configurable priority has been escalated to a HardFault exception at 0x0805E144.

For more information about analyzing faults on Cortex-M, refer to:
https://wiki.segger.com/Cortex-M_Fault.

image

I objdump the elf file and looked:

0805e144 <_ZZN4mbed8CallbackIFvvEE8generateIZNS2_C4IP19USBHostSerialDeviceMS5_FvvELi0EEET_T0_EUlvE_vEEvOS9_E3ops>:
 805e144:	080418bf 	stmdaeq	r4, {r0, r1, r2, r3, r4, r5, r7, fp, ip}
 805e148:	08041699 	stmdaeq	r4, {r0, r3, r4, r7, r9, sl, ip}
 805e14c:	08041587 	stmdaeq	r4, {r0, r1, r2, r7, r8, sl, ip}
 805e150:	4253555b 	subsmi	r5, r3, #381681664	; 0x16c00000
 805e154:	464e495f 			; <UNDEFINED> instruction: 0x464e495f
 805e158:	25203a4f 	strcs	r3, [r0, #-2639]!	; 0xfffff5b1
 805e15c:	64253a73 	strtvs	r3, [r5], #-2675	; 0xfffff58d
 805e160:	5355205d 	cmppl	r5, #93	; 0x5d
 805e164:	736f4842 	cmnvc	pc, #4325376	; 0x420000
 805e168:	72655374 	rsbvc	r5, r5, #116, 6	; 0xd0000001
 805e16c:	446c6169 	strbtmi	r6, [ip], #-361	; 0xfffffe97
 805e170:	63697665 	cmnvs	r9, #105906176	; 0x6500000

I have a lot of the debug outputs enabled. Last parts:


[,U,S,B,_,T,R,ANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1115]----- BULK READ [dev: 0x2400c914 - Serial - hub: 0 - port: 1 - addr: 1 - ep: 83]------
READ SUCCESS [8 bytes transferred - td: 0x240018AF] on ep: [0x2400c39c - addr: 83]: 2C 2A 31 45 0D 0A 24 47 

[,U*S1BE_
T
R$AGNSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1115]----- BULK READ [dev: 0x2400c914 - Serial - hub: 0 - port: 1 - addr: 1 - ep: 83]------
READ SUCCESS [8 bytes transferred - td: 0x240018CB] on ep: [0x2400c39c - addr: 83]: 50 52 4D 43 2C 2C 56 2C 

[PURSMBC_,T,RVA,NSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1115]----- BULK READ [dev: 0x2400c914 - Serial - hub: 0 - port: 1 - addr: 1 - ep: 83]------
READ SUCCESS [7 bytes transferred - td: 0x240018AF] on ep: [0x2400c39c - addr: 83]: 2C 2C 2C 2C 2C 2C 2C 

[,U,S,B,_,T,R,ANSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1115]----- BULK READ [dev: 0x2400c914 - Serial - hub: 0 - port: 1 - addr: 1 - ep: 83]------
READ SUCCESS [8 bytes transferred - td: 0x240018CB] on ep: [0x2400c39c - addr: 83]: 2C 2C 4E 2A 35 33 0D 0A 

[,U,SNB*_5T3R
A
NSFER: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:1115]----- BULK READ [dev: 0x2400c914 - Serial - hub: 0 - port: 1 - addr: 1 - ep: 83]------
[USB_DBG: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:507]FREE INTF 0 on dev: 0x2400c91c, 0x2400c914, nb_endpot: 2, Serial
[USB_INFO: c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHost.cpp:524]Device disconnected [0x2400c914 - Serial - hub: 0 - port: 1]

I am running the USBHostSerialToSerial example sketch. The code is up at:
https://github.com/KurtE/GIGA_USBHostMBed5_devices

GIGA R1 - Builds generate a lot of compiler warnings! (USBHALHost_STM.cpp)

This maybe is related to the crash as defined in #29

When you build a sketch such as the dirlist example for this library, it will generate a lot of compiler warnings.
Note: with the build caching, you may have to clear out the build cache to see these warnings after the first time you do a compile of the sketch.

"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -Wall -Wextra -g3 -nostdlib "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.8\\variants\\GIGA/defines.txt" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.8\\variants\\GIGA/cxxflags.txt" -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_GIGA -DARDUINO_ARCH_MBED_GIGA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.8\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.8\\variants\\GIGA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Arduino_USBHostMbed5\\src" -DCM4_BINARY_START=0x60000000 -DCM4_BINARY_END=0x60040000 -DCM4_RAM_END=0x60080000 "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.8\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.8\\cores\\arduino/api/deprecated-avr-comp" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.8\\cores\\arduino" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed_giga\\4.0.8\\variants\\GIGA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\Arduino_USBHostMbed5\\src\\targets\\TARGET_STM\\USBHALHost_STM.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\0796A63DB76D221868BE353872FAE80B\\libraries\\Arduino_USBHostMbed5\\targets\\TARGET_STM\\USBHALHost_STM.cpp.o"
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.h:20:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.cpp:17:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.cpp: In member function 'bool USBHostHub::connect(USBDeviceConnected*)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.cpp:125:45: warning: 'void rtos::ThisThread::sleep_for(uint32_t)' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
         rtos::ThisThread::sleep_for(buf[5]*2);
                                             ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:30:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/mbed.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:8,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostTypes.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.h:24,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/ThisThread.h:216:6: note: declared here
 void sleep_for(uint32_t millisec);
      ^~~~~~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.cpp: In member function 'void USBHostHub::portReset(uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.cpp:252:39: warning: 'void rtos::ThisThread::sleep_for(uint32_t)' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
         rtos::ThisThread::sleep_for(10);
                                       ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:30:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/mbed.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:8,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostTypes.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.h:24,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHub\USBHostHub.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/ThisThread.h:216:6: note: declared here
 void sleep_for(uint32_t millisec);
      ^~~~~~~~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:4,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostTypes.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBEndpoint.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:22:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:22:0:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBEndpoint.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp: In member function 'void USBEndpoint::init(HCED*, ENDPOINT_TYPE, ENDPOINT_DIRECTION, uint32_t, uint8_t, HCTD**)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:67:19: warning: 'osEvent rtos::Queue<T, queue_sz>::get(uint32_t) [with T = unsigned char; long unsigned int queue_sz = 1; uint32_t = long unsigned int]' is deprecated: Replaced with try_get and try_get_for. In future get will be an untimed blocking call. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
     ep_queue.get(0);
                   ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/Mail.h:29:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:33,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/mbed.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:8,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostTypes.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBEndpoint.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:22:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/Queue.h:311:13: note: declared here
     osEvent get(uint32_t millisec = osWaitForever)
             ^~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp: In member function 'void USBEndpoint::setDeviceAddress(uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:84:24: warning: unused variable 'hhcd' [-Wunused-variable]
     HCD_HandleTypeDef *hhcd;
                        ^~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp: In member function 'void USBEndpoint::setState(USB_TYPE)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:115:44: warning: 'osStatus rtos::Queue<T, queue_sz>::put(T*, uint32_t, uint8_t) [with T = unsigned char; long unsigned int queue_sz = 1; osStatus = long int; uint32_t = long unsigned int; uint8_t = unsigned char]' is deprecated: Replaced with try_put and try_put_for. In future put will be an untimed blocking call. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
             this->ep_queue.put((uint8_t *)1);
                                            ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/Mail.h:29:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:33,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/mbed.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:8,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostTypes.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBEndpoint.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:22:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/Queue.h:219:14: note: declared here
     osStatus put(T *data, uint32_t millisec = 0, uint8_t prio = 0)
              ^~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp: In member function 'USB_TYPE USBEndpoint::queueTransfer()':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:179:19: warning: 'osEvent rtos::Queue<T, queue_sz>::get(uint32_t) [with T = unsigned char; long unsigned int queue_sz = 1; uint32_t = long unsigned int]' is deprecated: Replaced with try_get and try_get_for. In future get will be an untimed blocking call. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
     ep_queue.get(0);
                   ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/Mail.h:29:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:33,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/mbed.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:8,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostTypes.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBEndpoint.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBEndpoint_STM.cpp:22:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/Queue.h:311:13: note: declared here
     osEvent get(uint32_t millisec = osWaitForever)
             ^~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:4,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBHostTypes.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBEndpoint.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBEndpoint.cpp:19:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBEndpoint.cpp:19:0:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBEndpoint.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost3GModule\WANDongleSerialPort.cpp:19:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost3GModule\WANDongleSerialPort.cpp:19:0:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost3GModule\WANDongleSerialPort.cpp: In member function 'virtual int WANDongleSerialPort::readPacket()':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost3GModule\WANDongleSerialPort.cpp:93:36: warning: 'void rtos::ThisThread::sleep_for(uint32_t)' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
     rtos::ThisThread::sleep_for(100);
                                    ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:30:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost3GModule\WANDongleSerialPort.cpp:30:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/ThisThread.h:216:6: note: declared here
 void sleep_for(uint32_t millisec);
      ^~~~~~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost3GModule\WANDongleSerialPort.cpp: In member function 'virtual int WANDongleSerialPort::writePacket()':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost3GModule\WANDongleSerialPort.cpp:126:36: warning: 'void rtos::ThisThread::sleep_for(uint32_t)' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
     rtos::ThisThread::sleep_for(100);
                                    ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:30:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost3GModule\WANDongleSerialPort.cpp:30:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/ThisThread.h:216:6: note: declared here
 void sleep_for(uint32_t millisec);
      ^~~~~~~~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostMouse.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostMouse.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostMouse.h:20:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostMouse.cpp:17:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostMouse.cpp: In member function 'bool USBHostMouse::connect()':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostMouse.cpp:83:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     if (len_listen > sizeof(report)) {
                         ~~~~~~~~~~~^~~~~~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostMouse.cpp: In member function 'void USBHostMouse::rxHandler()':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostMouse.cpp:137:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (len_listen > sizeof(report)) {
         ~~~~~~~~~~~^~~~~~~~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.h:22,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:19:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.h:22:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:19:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp: In member function 'bool USBHostMIDI::sendNoteOff(uint8_t, uint8_t, uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:294:38: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
     return sendMidiBuffer(8, channel & 0xf | 0x80, note & 0x7f, velocity & 0x7f);
                              ~~~~~~~~^~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp: In member function 'bool USBHostMIDI::sendNoteOn(uint8_t, uint8_t, uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:298:38: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
     return sendMidiBuffer(9, channel & 0xf | 0x90, note & 0x7f, velocity & 0x7f);
                              ~~~~~~~~^~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp: In member function 'bool USBHostMIDI::sendPolyKeyPress(uint8_t, uint8_t, uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:302:39: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
     return sendMidiBuffer(10, channel & 0xf | 0xa0, note & 0x7f, pressure & 0x7f);
                               ~~~~~~~~^~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp: In member function 'bool USBHostMIDI::sendControlChange(uint8_t, uint8_t, uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:306:39: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
     return sendMidiBuffer(11, channel & 0xf | 0xb0, key & 0x7f, value & 0x7f);
                               ~~~~~~~~^~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp: In member function 'bool USBHostMIDI::sendProgramChange(uint8_t, uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:310:39: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
     return sendMidiBuffer(12, channel & 0xf | 0xc0, program & 0x7f, 0);
                               ~~~~~~~~^~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp: In member function 'bool USBHostMIDI::sendChannelPressure(uint8_t, uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:314:39: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
     return sendMidiBuffer(13, channel & 0xf | 0xd0, pressure & 0x7f, 0);
                               ~~~~~~~~^~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp: In member function 'bool USBHostMIDI::sendPitchBend(uint8_t, uint16_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMIDI\USBHostMIDI.cpp:318:39: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
     return sendMidiBuffer(14, channel & 0xf | 0xe0, value & 0x7f, (value >> 7) & 0x7f);
                               ~~~~~~~~^~~~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.h:20:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp:17:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp: In member function 'void USBHostSerialPort::init()':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp:225:19: warning: converting to non-pointer type 'uint8_t {aka unsigned char}' from NULL [-Wconversion-null]
     serial_intf = NULL;
                   ^~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp: In member function 'virtual int USBHostSerialPort::writeBuf(const char*, int)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp:322:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             int i = (s < size_bulk_out) ? s : size_bulk_out;
                      ~~^~~~~~~~~~~~~~~
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.h:26:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp:17:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\MtxCircBuffer.h: In instantiation of 'void MtxCircBuffer<T, size>::queue(T) [with T = unsigned char; int size = 128]':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp:262:38:   required from here
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\MtxCircBuffer.h:56:40: warning: 'void rtos::ThisThread::sleep_for(uint32_t)' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
             rtos::ThisThread::sleep_for(10);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:30:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/mbed.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:8,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHost.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.h:24,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostSerial\USBHostSerial.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/ThisThread.h:216:6: note: declared here
 void sleep_for(uint32_t millisec);
      ^~~~~~~~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:4,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostTypes.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBEndpoint.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBDeviceConnected.h:21,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBDeviceConnected.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBDeviceConnected.h:21:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHost\USBDeviceConnected.cpp:17:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBEndpoint.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.h:20:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.cpp:17:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.cpp: In member function 'virtual int USBHostMSD::init()':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.cpp:351:40: warning: 'void rtos::ThisThread::sleep_for(uint32_t)' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
         rtos::ThisThread::sleep_for(100);
                                        ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:30:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/mbed.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:8,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHost.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.h:24,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/ThisThread.h:216:6: note: declared here
 void sleep_for(uint32_t millisec);
      ^~~~~~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostMSD\USBHostMSD.cpp:348:31: warning: unused variable 'ret' [-Wunused-variable]
     uint16_t i, timeout = 10, ret;
                               ^~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:23:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:23,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostKeyboard.h:20,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostKeyboard.cpp:17:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/mbed_config.h:260:0: warning: "MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL" redefined
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL                                  1                                                                                                // set by application[*]
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostKeyboard.h:20:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\USBHostHID\USBHostKeyboard.cpp:17:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src/USBHost/USBHostConf.h:21:0: note: this is the location of the previous definition
 #define MBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL  0
 
In file included from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.cpp:33:0:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h: In function 'void usb_vbus(uint8_t)':
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:152:37: warning: 'void rtos::ThisThread::sleep_for(uint32_t)' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
     rtos::ThisThread::sleep_for(1.0f);
                                     ^
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/rtos.h:30:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/mbed.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:8,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.cpp:27:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/rtos/include/rtos/ThisThread.h:216:6: note: declared here
 void sleep_for(uint32_t millisec);
      ^~~~~~~~~
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.h:29:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/stm32h7xx_hal_conf.h:398,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal.h:30,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h7xx.h:223,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/cmsis.h:22,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/PinNamesTypes.h:33,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\variants\GIGA/pinmode_arduino.h:24,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/Arduino.h:26,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed.h:4,
                 from c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.cpp:27:
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h: In constructor 'USBHALHost::USBHALHost()':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.h:1979:48: warning: conversion to void will not access object of type 'volatile uint32_t {aka volatile long unsigned int}'
                                         UNUSED(tmpreg); \
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_def.h:70:27: note: in definition of macro 'UNUSED'
 #define UNUSED(x) ((void)(x))
                           ^
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/Legacy/stm32_hal_legacy.h:2779:26: note: in expansion of macro '__HAL_RCC_CRS_CLK_ENABLE'
 #define __CRS_CLK_ENABLE __HAL_RCC_CRS_CLK_ENABLE
                          ^~~~~~~~~~~~~~~~~~~~~~~~
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:183:5: note: in expansion of macro '__CRS_CLK_ENABLE'
     __CRS_CLK_ENABLE();
     ^
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.h:1438:48: warning: conversion to void will not access object of type 'volatile uint32_t {aka volatile long unsigned int}'
                                         UNUSED(tmpreg); \
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_def.h:70:27: note: in definition of macro 'UNUSED'
 #define UNUSED(x) ((void)(x))
                           ^
c:\Users\kurte\Documents\Arduino\libraries\Arduino_USBHostMbed5\src\targets\TARGET_STM\USBHALHost_STM.h:271:5: note: in expansion of macro '__HAL_RCC_GPIOB_CLK_ENABLE'
     __HAL_RCC_GPIOB_CLK_ENABLE();
     ^
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.h:1430:48: warning: conversion to void will not access object of type 'volatile uint32_t {aka volatile long unsigned int}'
                                         UNUSED(tmpreg); \
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.0.8\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_def.h:70:27: note: in definition of macro 'UNUSED'
 #define UNUSED(x) ((void)(x))
                           ^

(Truncated to fit the max size of post)

Error writing to file/closing file

I followed the example provided to write files using a Portenta Machine Control board but I'm having no luck actually writing to files.

As you can see in my code below I've mashed together the directory read example and the file writing example so I could test whether it was a general problem with my USB connection/drive but I can read the files in the directory properly, but cannot seem to write.

You'll see also below in the console print out there is no issue with the writing inside the for loop to write the numbers, only when it's time to close.

When I check the USB in my computer there is no data written to that file (it's a file I've created previously. If I delete it no new file is created).

My code:

/*
  Portenta - FileWrite

  The sketch shows how to mount an usb storage device and how to
  write a file, eventually overwriting the original content.

  The circuit:
   - Portenta H7

  This example code is in the public domain.
*/
#include <Arduino_MachineControl.h>
#include <Arduino_USBHostMbed5.h>  //https://github.com/arduino-libraries/Arduino_USBHostMbed5
#include <DigitalOut.h>
//#include <FATFileSystem.h>

using namespace machinecontrol;

// Redirect log output from MbedOS and low-level libraries to Serial
REDIRECT_STDOUT_TO(Serial);

USBHostMSD msd;
mbed::FATFileSystem usb("usb");

//to enable thte usb otg power:
mbed::DigitalOut otg(PB_14, 0);

int err = 0;


void setup() {
  //usb_controller.powerEnable();

  Serial.begin(115200);
  //while (!Serial);

  delay(2000);

  Serial.print("Trying MSD connect");

  while (!msd.connect()) {
    delay(1000);
    Serial.print(".");
  }
  Serial.println("success");


  Serial.println("Mounting USB device...");
  err = usb.mount(&msd);
  if (err) {
    Serial.print("Error mounting USB device ");
    Serial.println(err);
    while (1)
      ;
  }
  Serial.print("read done ");

  dirRead();
  fileWrite();
}

void loop() {

   delay(1000);
    // handle disconnection and reconnection
    if (!msd.connected()) {
        msd.connect();
    }

}

void fileWrite() {
  mbed::fs_file_t file;
  struct dirent* ent;
  int dirIndex = 0;
  int res = 0;
  Serial.println("Open /usb/numbers.txt");

  FILE* f = fopen("/usb/numbers.txt", "w+"); //w+ = create a new file for update. See: https://os.mbed.com/users/berntzen/notebook/writing-files/
  printf("%s\n", (!f ? "Fail :(" : "OK"));

  for (int i = 1; i <= 10; i++) {
    Serial.print("Writing numbers (");
    Serial.print(i);
    Serial.println("/10)");
    fflush(stdout);

    err = fprintf(f, "%d\n", i);
    if (err < 0) {
      Serial.println("Fail :(");
      error("error: %s (%d)\n", strerror(errno), -errno);
    }
    //do we need to go a bit more slowly?
    delay(100);
  }

  delay(1000);

  Serial.println("closing file..");

  err = fclose(f);
  if (err < 0) {
    Serial.print("fclose error:");
    Serial.print(strerror(errno));
    Serial.print(" (");
    Serial.print(-errno);
    Serial.print(")");
  } else {
    Serial.println("File closed");
  }
}

void dirRead() {
  char buf[256];

  // Display the root directory
  Serial.print("Opening the root directory... ");
  DIR* d = opendir("/usb/");
  Serial.println(!d ? "Fail :(" : "Done");
  if (!d) {
    snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno);
    Serial.print(buf);
  }
  Serial.println("done.");

  Serial.println("Root directory:");
  unsigned int count{ 0 };
  while (true) {
    struct dirent* e = readdir(d);
    if (!e) {
      break;
    }
    count++;
    snprintf(buf, sizeof(buf), "    %s\r\n", e->d_name);
    Serial.print(buf);
  }
  Serial.print(count);
  Serial.println(" files found!");

  snprintf(buf, sizeof(buf), "Closing the root directory... ");
  Serial.print(buf);
  fflush(stdout);
  err = closedir(d);
  snprintf(buf, sizeof(buf), "%s\r\n", (err < 0 ? "Fail :(" : "OK"));
  Serial.print(buf);
  if (err < 0) {
    snprintf(buf, sizeof(buf), "error: %s (%d)\r\n", strerror(errno), -errno);
    Serial.print(buf); delay(1000);
    // handle disconnection and reconnection
    if (!msd.connected()) {
        msd.connect();
    }
  }
}

And the console print out:

Trying MSD connect.success
Mounting USB device...
read done Opening the root directory... Done
done.
Root directory:
    numbers.txt
1 files found!
Closing the root directory... OK
Open /usb/numbers.txt
OK
Writing numbers (1/10)
Writing numbers (2/10)
Writing numbers (3/10)
Writing numbers (4/10)
Writing numbers (5/10)
Writing numbers (6/10)
Writing numbers (7/10)
Writing numbers (8/10)
Writing numbers (9/10)
Writing numbers (10/10)
closing file..
fclose error:I/O error (-5)

Very slow write speeds on arduino giga

I would like someone to increase the usb speed to full 2.0 speeds. right now I'm trying to write 187KB of binary data to a binary file using binary write mode in one single fwrite operation and its taking about 3 seconds. that is way too slow for the interface the board has.

Here is the code that should be running much faster:

error = fwrite(&write_buffer, sizeof(struct DATA_FRAME_RETURN), write_buffer_item_count, binary_file);

write buffer is an array of size 125, DATA_FRAME_RETURN is about 1500 bytes long, write buffer item count is 125, binary_file is a .bin file opened in the following way:

binary_file = fopen("/DRONEDATA/data.bin", "wb");

Any ideas? Any changes you guys can make to run the USB port at full speed? Thanks! :)

Code does not handle 0 length items contained within Configuration Descriptor.

The code: void USBHost::parseConfDescr(USBDeviceConnected * dev, uint8_t * conf_descr, uint32_t len, IUSBEnumerator* pEnumerator)

Will hang if a device returns a descriptor, which has 0 length items...

One such device is a keyboard from GIGABYTE. I have one Force K83(might be H83)...
Whose descriptor is:

Configuration Descriptor
2400E8F0 - 09 02 54 00 03 01 00 A0  32 09 04 00 00 01 03 01  : ..T..... 2.......
2400E900 - 01 00 09 21 10 01 00 01  22 3B 00 07 05 81 03 08  : ...!.... ";......
2400E910 - 00 08 09 04 01 00 01 03  01 22 51 00 07 05 82 03  : ........ ."Q.....
2400E920 - 10 00 08 09 04 02 00 01  03 00 00 00 09 21 10 01  : ........ .....!..
2400E930 - 00 01 22 25 00 07 05 83  03 10 00 01 00 00 00 00  : .."%.... ........
2400E940 - 00 00 00 00                                       : ....

I ran into this issue on another USBHost implementation that I help support, which is why I have one of these
keyboards.

I was able to solve it in my fork/branch by adding test like:

void USBHost::parseConfDescr(USBDeviceConnected * dev, uint8_t * conf_descr, uint32_t len, IUSBEnumerator* pEnumerator)
{
    uint32_t index = 0;
    uint32_t len_desc = 0;
    uint8_t id = 0;
    int nb_endpoints_used = 0;
    USBEndpoint * ep = NULL;
    uint8_t intf_nb = 0;
    bool parsing_intf = false;
    uint8_t current_intf = 0;

    while (index < len) {
        len_desc = conf_descr[index];
        if (len_desc == 0) {
            index++;
            continue;
        }
        id = conf_descr[index+1];
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.