Giter VIP home page Giter VIP logo

uhs30's Introduction

UHS30

Pre-release of USB Host Library version 3.0. No technical support offered at this time.

This set of libraries is EXTREMELY ALPHA!

Arduino version 1.6.9 OR BETTER ONLY! DO NOT USE 1.6.10, it is broken!

  • This library set does all USB host operations in an interrupt. This means that calling the Task() method no longer does anything, unless you disable the interrupt mode in your sketch.
  • This library set provides interrupt safe heap for AVR, ARM, and PIC32 based boards.
  • Circuitsathome USB Host Shield support (of course!)
  • Freescale Kinetis native full-speed host support!
    • NOTE! To use the Teensy 3.0/3.1/3.2/3.4/3.5 and LC in host mode, select "No USB" from the tools menu for USB Type.
  • SDcard on SPI due to popular demand!
  • Kinetis EHCI (experimental)

Current working USB interface drivers

  • HID RAW
  • MIDI
  • Hub
  • Mass storage
  • CDC-ACM serial
  • XR21B1411 serial
  • PROLIFIC serial
  • FTDI serial

USB interface drivers works in-progress

  • HID-BOOT-MOUSE
  • HID-BOOT-KEYBOARD

AVR MEGA ADK

No special modifications are required!

Thank you Olayinka Babalola for donating an Arduino Mega ADK board. It would not have been possible without your support!

AVR Arduino

Software tools

Arduino AVR boards by Arduino 1.6.11. Newer versions are broken.

hardware instructions

On AVR based Arduino boards and clones, you must do one of the following:

Connect pin 9 to pin 3 with a jumper wire.

OR

Cut the INT solder bridge. Connect from the INT thru-hole to pin 3 thru-hole with a jumper wire.

OR

Cut the INT solder bridge. Install right angle headers and use a female jumper wire.

ARM Arduino hardware instructions

No special modifications are required! ARM boards have interrupt capabilities on nearly every pin.

PIC32

UNO32, uC32, WF32, Wi-Fire

Please note that the UNO32 really lacks enough flash to be very useful. Some demos will be too big to fit into flash.

Digilent messed up on the ICSP connector. You need to modify your shield. Pull the 2x3 header plastic cover, and break off pin recepticle contacts for pins 2 and 5. Run a patch wire from +5V to pin 2. Run a patch wire from RESET to pin 5. Put plastic cover back on. Don't worry, the board will still work on all other development boards. Detailed photos are in the images directory. Alternatly, modify the Digilent board. More recent boards have an option jumper which you could use to do this fix as well, however you still need to patch 5v onto pin 2.

Then you must do one of the following:

Connect pin 9 to pin 7 with a jumper wire.

OR

Cut the INT solder bridge. Connect from the INT thru-hole to pin 7 thru-hole with a jumper wire.

OR

Cut the INT solder bridge. Install right angle headers and use a female jumper wire.

Installation

Clone the repository:

With a github account:
git clone --recursive [email protected]:felis/UHS30.git
or
Without a github account:
git clone --recursive https://github.com/felis/UHS30.git

Then

Copy each of the directories in the libraries directory into your USER LIBRARIES directory. DO NOT copy these to your system-wide installation. (you should never do that anyway!)

If you want to do development, see the wiki. https://github.com/felis/UHS30/wiki

uhs30's People

Contributors

felis avatar lauszus avatar luzpaz avatar marcio-ao avatar neilh10 avatar paulstoffregen avatar thymythos avatar vamshi253 avatar xxxajk avatar yuuichiakagawa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uhs30's Issues

MIDI don't run continues

i'm really thank you for this library.
I use it for get data form my keyboard. via USB midi.
I use usb host for arduino, and arduino mega 2560.
when connected, data send not continues, it like a "LAG" for some note, and after few seconds, it tranmist again.
I don't know why is that. Please help me ! thank you !

P/s: when connect keyboard with PC, this work well.

Migrating Marlin to UHS3.0. A few questions...

Hello,

Earlier last year, I incorporated UHS2.0 into Marlin. This year I am investigating migrating Marlin to UHS3.0, since we are seeing issues with one of our boards with the old code and I rather put our resources into fixing issues in UHS3.0 rather than UHS2.0. I believe having us chip in development work would be helpful to everyone!

In doing the preliminary work to intergrate UHS3.0, I notice a couple things:

  • The code is much cleaner and better organized (this is good!)
  • The license is GPL v2, rather than "GPL v3" or "GPL v2 or any later version" (this is a showstopper!)
  • When I try compiling with "USB_HOST_SHIELD_USE_ISR 0", I get an error saying this isn't supported (this could present problems with Marlin).

Marlin makes heavy use of interrupts itself and I feel there is much less risk involved if the USB code can run in polled mode. I notice that in "USB_HOST_SHIELD.h" if ARDUINO_AVR_BALANDUINO is defined, it asks the user to use USB_HOST_SHIELD_USE_ISR as 0. So this suggests that at least some work has been done on the feature.

So, a few questions:

  1. Could this code be relicensed to "GPL v2 or any later version", so that I can integrate it into Marlin? (which is GPL v3).
  2. UHS2.0 worked without an interrupt, how difficult would it be to make UHS3.0 work without it too?
  3. How much work has actually been done in working without interrupts? What is the ARDUINO_AVR_BALANDUINO and how does that work without interrupts?

Any help with these questions are very much appreciated! Thank you!

-- Marcio

Logitech Extreme 3D Pro Joystick Compatibility

I am making a robotic arm. The controller I am using is a Logitech extreme 3D pro. I was using an Arduino Mega 2560 with the Arduino USB Host Shield to connect to the joystick. In order to get more processing power, I switched to the Arduino Due, which has a native USB port built in. This native port replaces the need for the Arduino USB Host Shield. Because the USB_Host_Shield_2.0 Library is built for the Arduino USB Host Shield ONLY. Because of this, I need something (like this library) than can connect the Logitech Extreme 3D Pro Joystick to the Arduino Due. Is there an example like the one in USB_Host_Shield_2.0?

Old Setup with Arduino Mega & USB Host Shield New Setup with Arduino Due
img_1060 img_1062

Headers only include of submodules

Hi

now that the lib was restructured with submodules, shouldn't there be a different define for headers only include?

If I #define i.e. LOAD_UHS_KINETIS_FS_HOST both UHS_KINETIS_FS_HOST.h and UHS_KINETIS_FS_HOST_INLINE.h will be included. If I don't define anything, nothing will be included.

So it's not possible to use UHS3 from different source files, i.e. I'd like to put all the USB host stuff in a different source file away from the .ino

Thanks,
Markk

Mount point for USB drive

I have been successfully experimenting with a number of USB thumb drives all with a blank label. As expected, the drives mount at "/". I am now attempting to mount a drive with a non blank label such as 'foo'. The drive appears to mount but then reports 0 space available on the drive. With a label of 'foo' on the drive I am passing '/foo' to both 'fs_ready()' and 'fs_getfree()'. I am using 'UHS_FS_NEW_DEMO' as the basis for my tests. I recognize that once the reported free space test passes, the following file names will need to include the mount point '/foo' as well.

I suspect that my understanding of the proper mount points is in error.

In anticipation of mounting multiple drives, I have increased _FS_LOCK from 1 to 4.

Continued thanks for your great work to support UHS30.

UHS MIDI Driver issue

Hi there,

I know this is still in development, so forgive me if you are already aware of this.

Testing various MIDI controllers with this library, and I can only get one to work. Looking at the debug for those that don't work (below), it appears that the class doesn't find a compatible library, however these controllers were definitely supported by UHS v2, and are class compliant.

Thanks.

Testing Arturia Keystep:

Configuring: parent = 0, port = 1, speed = 1


Configuring PktSize x40,  rcode: x00, retries 0,
ctrlReq2: left: 64, read:64, nbytes 64
ctrlReq3: acceptBuffer sz 18 nbytes 64 left 46
Address: 1 (0.0.1)
0 retries.
DevDescr 2nd poll, bMaxPacketSize0:64
ctrlReq2: left: 18, read:18, nbytes 18
Address: 1 (0.0.1)
0 retries.
configs: 1
ctrlReq2: left: 9, read:9, nbytes 9
CONFIGURATION: 0, bNumInterfaces 2, wTotalLength 101
bLength: 9 bDescriptorType: 02
eating 8
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 0 endpoints
eating 1
ENDPOINT DESCRIPTORS FILLED
TestInterface VID:1c75 PID:0288 Class:00 Subclass:00 Protocol 00
Interface data: Class:01 Subclass:01 Protocol 01, number of endpoints 0
Parent: 00, bAddress: 01
No driver at index 1
No driver at index 2
No driver at index 3
No driver at index 4
No driver at index 5
No driver at index 6
No driver at index 7
No driver at index 8
No driver at index 9
No driver at index 10
No driver at index 11
No driver at index 12
No driver at index 13
No driver at index 14
No driver at index 15
No driver for this interface.
bLength: 36 bDescriptorType: 01
eating 35
bLength: 9 bDescriptorType: 24
eating 8
bLength: 9 bDescriptorType: 24
eating 8
bLength: 9 bDescriptorType: 05
eating 8
bLength: 5 bDescriptorType: 25
eating 4
bLength: 9 bDescriptorType: 05
eating 8
bLength: 5 bDescriptorType: 25
eating 4
USB_INTERFACE END OF STREAM

Testing AKAI LPK25:

Configuring: parent = 0, port = 1, speed = 1


Configuring PktSize x40,  rcode: x00, retries 0,
ctrlReq2: left: 64, read:64, nbytes 64
ctrlReq3: acceptBuffer sz 18 nbytes 64 left 46
Address: 1 (0.0.1)
0 retries.
DevDescr 2nd poll, bMaxPacketSize0:32
ctrlReq2: left: 18, read:18, nbytes 18
Address: 1 (0.0.1)
0 retries.
configs: 1
ctrlReq2: left: 9, read:9, nbytes 9
CONFIGURATION: 0, bNumInterfaces 3, wTotalLength 133
bLength: 9 bDescriptorType: 02
eating 8
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 2 endpoints
bLength: 9 bDescriptorType: 21
eating 7
bLength: 7 bDescriptorType: 05
ENDPOINT DESCRIPTOR: 0
ENDPOINT DESCRIPTOR OK
eating 0
bLength: 7 bDescriptorType: 05
ENDPOINT DESCRIPTOR: 1
ENDPOINT DESCRIPTOR OK
eating 0
eating 1
ENDPOINT DESCRIPTORS FILLED
TestInterface VID:09e8 PID:003e Class:00 Subclass:00 Protocol 00
Interface data: Class:03 Subclass:00 Protocol 00, number of endpoints 2
Parent: 00, bAddress: 01
No driver at index 1
No driver at index 2
No driver at index 3
No driver at index 4
No driver at index 5
No driver at index 6
No driver at index 7
No driver at index 8
No driver at index 9
No driver at index 10
No driver at index 11
No driver at index 12
No driver at index 13
No driver at index 14
No driver at index 15
No driver for this interface.
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 0 endpoints
eating 1
ENDPOINT DESCRIPTORS FILLED
TestInterface VID:09e8 PID:003e Class:00 Subclass:00 Protocol 00
Interface data: Class:01 Subclass:01 Protocol 01, number of endpoints 0
Parent: 00, bAddress: 01
No driver at index 1
No driver at index 2
No driver at index 3
No driver at index 4
No driver at index 5
No driver at index 6
No driver at index 7
No driver at index 8
No driver at index 9
No driver at index 10
No driver at index 11
No driver at index 12
No driver at index 13
No driver at index 14
No driver at index 15
No driver for this interface.
bLength: 36 bDescriptorType: 01
eating 35
bLength: 9 bDescriptorType: 24
eating 8
bLength: 9 bDescriptorType: 24
eating 8
bLength: 9 bDescriptorType: 05
eating 8
bLength: 5 bDescriptorType: 25
eating 4
bLength: 9 bDescriptorType: 05
eating 8
bLength: 5 bDescriptorType: 25
eating 4
USB_INTERFACE END OF STREAM

Support to work with the official Arduino STM32 core

I tried to compile (STM32F103C8T6) but the first error that occurred seems to be relative to the interrupt register definition.

c:\arduino ide\arduino-1.8.10-windows-portable\portable\sketchbook\libraries\dyn_swi\dyn_swi.h:106:2: error: #error SWI_IRQ_NUM not defined (CMSIS)
#error SWI_IRQ_NUM not defined (CMSIS)

https://github.com/stm32duino/Arduino_Core_STM32

I found this post that might help someone identify that SPI port interrupt register:

https://os.mbed.com/forum/mbed/topic/26688/?page=1#comment-50909

Maybe it will be interesting for some MBED developers.

I explain how to extend the SPISlave class for use interrupts on STM32 MCU. With this solution we do not need to change anything in the basic SPISlave class.

First step is common and strighforward. We create instance of SPISlave class and do some configuration (format, frequency, ...). Next we setup SPI CR2 register to enable interrupts. Especially:

  • TXEIE bit to enable 'Tx buffer empty' interrupt - RXNEIE bit to enable 'RX buffer not empty' interrupt

and at last we install own ISR routine for SPI interrupts.

Some explanaition.

Because SPI work in full duplex mode we must have 'filler' (empty) character. I use null byte as filler. Send or receive null byte means that there is nothing to send (or receive). As a consequence this protocol cant be used for binary data. Null bytes must be encoded/decoded on both side (escape sequence processing).

My ISR routine cooperate with two buffers and simple API: - saveInBuf save received characters in external buffer - char2send get next byte to send from transmit buffer

Local (static) buffer 'intBuf' is used in the case when main receive buffer is (temporarily) in use and received character can't be saved.

I run test program on Nucleo-STM32F103RB (64 MHz HSI) connected to Orange Pi Lite (Armbian Linux). On Orange Pi side I use two transmission buffers and Timer interrupt to check for pending transmission (once per 100 us). I configure SPI on both side in 8 bit mode and 16 Mhz frequency.

extern uint32_t Default_Handler;
SPI_TypeDef *cspi = SPI2;
bool blockReader, blockWriter;
 
void setIRQvector(IRQn_Type it, uint32_t fa)
{
    uint32_t dh;
    if(it >= 0)
    {
        if(!fa)
        {
            NVIC_DisableIRQ(it);
            dh = (uint32_t) Default_Handler;
            NVIC_SetVector(it, dh);
        }
        else
        {
            NVIC_SetVector(it, fa);
            NVIC_EnableIRQ(it);
        }
    }
}
 
#define TXEIE_MASK  0x80
#define RXNEIE_MASK 0x40
 
void enableSPIinterrupt(bool enable)
{
    uint32_t isr = 0;
    if(enable)
    {
        isr = (uint32_t) rwSPIservice;
        cspi->CR2 |= (TXEIE_MASK | RXNEIE_MASK);
    }
    else
        cspi->CR2 &= ~(TXEIE_MASK | RXNEIE_MASK);
    setIRQvector(SPI2_IRQn, isr);
}
 
#define RXNE_MASK   1
#define TXE_MASK        2
 
void rwSPIservice(void)
{
    static char intBuf[16];
    static uint16_t cInBuf;
    int tc;
    
    if(cspi->SR & RXNE_MASK && cInBuf < sizeof(intBuf))
    {
        tc = cspi->DR;
        if(tc)
            intBuf[cInBuf++] = tc;
    }
    if(cInBuf > 0 && !blockReader)
    {
        short saved = saveInBuf(intBuf, cInBuf);
        if(saved > 0)
        {
            cInBuf -= saved;
            if(cInBuf > 0)
                memmove(intBuf, intBuf + saved, cInBuf);
        }
    }
    if(cspi->SR & TXE_MASK)
    {
        tc = 0;
        if(!blockWriter)
        {
            tc = char2send();
            if(tc < 0)
                tc = 0;
        }
        cspi->DR = tc;
    }
}

Not working on ftdi chip

I'm trying to connect USB host shield with the device having FTDI Chip to provide virtual com port. But failed to build a connection between host and device. I'm using USB host library 2.0 available on GitHub.
Does anyone knows how to Implement FTDI on this library??
Some device specs are listed below:
VIRTUAL COM PORT
Baud Rate:9600 baud* Format: 8 data bits, no parity, 1 stop bit*
Protocol: Modbus over Serial Line

Help to move data between SD Card & USB flash Drive with UHS30 or UHS20

I am building a datalogger whose primary memory is the SD card and the secondary storage is the USB flash drive. The data in the SD card is downloaded into the USB flash drive like once a week. I am using Arduino Mega ADK with Max3421 USB host chip.

  1. How can I use both SD card and Flash Drive together. The excellent UHS30 library seems to conflict with SD.h, SdFat.h and Fatfs.h(to a limited extent).

Any example code will do, especially to be able to initialize and mount the SD card and write/read text files. CS on my SD card shield is on digital pin 8 (cs_pin=8) of my Arduino board.
2. I have some success with the SD card datalogger separately and UHS20 separately. UHS30 compiles on Arduino 1.6.9, AVR board 1.6.11, Windows 7 but it wouldn't execute any function (blank). Only UHS20 works for now.

UHS30 support for MKRZERO?

Hello - I am attempting to run the UHS30 library on a MKRZero (SAMD21 based) arduino board, connected to a UHS2.0 (mini MAX3421E based shield). My goal is to have a USB keyboard plugged into the mini-shield and continue to use the standard usb port on the arduino as a serial connection back to a host computer.

I guess my first question is whether this should be a supported configuration, should the UHS30 library be able to run in parallel with the 'standard' usb(device) support provided by the platform?

Assuming that is a reasonable goal - I started digging into the UHS30 libraries and have discovered that it appears the MKRZero isn't a supported processor right out of the box. Ok, I've recently setup this exact same scenario using the USB_Host_Shield_2.0 library and was able to modify that lib to work with MKRZero (although that required renaming a couple of the lib's classes, so not a pretty port) so decided I'd give porting this lib to the new board a shot... Since the original Arduino Zero appears to be supported I figured it shouldn't be that bad. I found the few places that ifdefs looked for "ARDUINO_SAMD_ZERO" and added "ARDUINO_SAMD_MKRZERO" as appropriate. I think I've managed to do this (close to) correctly (since the code compiles without complaints from the compiler/linker). However, after being flashed to the board something is keeping the native usb port from initializing correctly (the host PC isn't seeing it as a Serial port any longer and reports "Device Descriptor Request Failed"...
I'm using USB_HID_KB_MOUSE.ino as the main sketch (although I am using Eclipse as my dev environment, so the sketch has been turned into a .cpp file). Since the serial port back to the host isn't working, I'm not getting any debug output, but by commenting out lines of code I've manged to determine that it's the instantiation of the UHS_HID classes that appears to be causing the problem...
'''
UHS_HID hid1(&UHS_Usb, &HID_processor1);
UHS_HID hid2(&UHS_Usb, &HID_processor2);
'''

I'm instantiating the MAX3421E_HOST with (what I believe to be) the proper pins called out for SS and INT (4 and 5 in my case). SPI pins are the defaults of 9(SCK), 8(MOSI) and 10(MISO).

I realize that this library is explicitly stated as not having technical support, but I was hoping to be able to at least contribute back changes to support the MKRZero board (if I can get it working).
Any pointers on where to look for what may be causing the issue would be greatly appreciated.
Thanks.

Multiple MIDI Devices through Hub

Again, sorry if this is a known issue, but I cannot find another issue discussing it.

I have modified the USB_MIDI_Dump demo to use two hubs and two midi devices.
I find that a single device works well through a hub, but creating a second midi device stops it working. It compiles, but doesn't connect to or receive data from either MIDI device once more than one is declared.

Many thanks,

Here's the code:

#define LOAD_USB_HOST_SYSTEM
#define LOAD_USB_HOST_SHIELD
#define LOAD_UHS_HUB
#define LOAD_UHS_MIDI
#define LOAD_UHS_PRINTF_HELPER
#define USB_HOST_SERIAL Serial

#include <Arduino.h>
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif

#include <UHS_host.h>

MAX3421E_HOST UsbHost;
UHS_MIDI Midi(&UsbHost);
UHS_MIDI Midi2(&UsbHost);
UHS_USBHub Hub1(&UsbHost);
UHS_USBHub Hub2(&UsbHost);
bool connected;
char buf[20];


void setup() {
  // USB data switcher, PC -> device. (test jig, this can be ignored for regular use)
  pinMode(5, OUTPUT);
  digitalWrite(5, HIGH);
  connected = false;
  USB_HOST_SERIAL.begin(115200);
  while (UsbHost.Init(1000) != 0);
  printf_P(PSTR("\r\nHost initialized.\r\n"));

}

void loop() {
  if (Midi.isReady()) {
    if (!connected) {
      connected = true;
      printf_P(PSTR("Connected to MIDI\r\n"));
      sprintf(buf, "VID:%04X, PID:%04X", Midi.vid, Midi.pid);
      Serial.println(buf);
    }
    MIDI_poll();
  } else {
    if (connected) {
      connected = false;
      printf_P(PSTR("\r\nDisconnected from MIDI\r\n"));
    }
  }

}

// Poll USB MIDI Controler and send to serial MIDI
void MIDI_poll()
{
  uint8_t bufMidi[64];
  uint16_t  rcvd;
  if (Midi.RecvData( &rcvd,  bufMidi) == 0 ) {
    sprintf(buf, "%08lX: ", (uint32_t)millis());
    Serial.print(buf);
    Serial.print(rcvd);
    Serial.print(':');
    for (int i = 0; i < 64; i++) {
      sprintf(buf, " %02X", bufMidi[i]);
      Serial.print(buf);
    }
    Serial.println("");
  }
}

PS4 Support

How do I get this to work with the ps4 controller? Unstand in 2.0 but not in 3.0?

Thanks
Mike

UHS_HID_KB_MOUSE.ino producing unrecognizable character

HID RAW/KEYBOARD/MOUSE demo Begin.
BOOT_KEYBOARD
BOOT_MOUSE
@⸮����� @⸮HIDBOOT-RAW-MOUSE

After comparing with UHS_HID_RAW.ino, found:

Producing unrecognizable character:
void onStart(UHS_HID_base *d) { printf_P("HID driver type %d started, Subclass %02x, Protocol %02x ",

Producing normal character:
void onStart(UHS_HID_base *d) { printf_P(PSTR("HID driver type %d started, Subclass %02x, Protocol %02x\r\n"),

Recommend additional header comments to UHS_FS_NEW_DEMO.ino

Hello,

I would like to recommend adding additional header and introduction comments/documentation for the UHS_FS_NEW_DEMO.ino example.

Full path to file:
UHS30/libraries/UHS_FS/examples/USB_HOST_SHIELD/UHS_FS_NEW_DEMO/UHS_FS_NEW_DEMO.ino

I am currently adapting UHS30 to use a USB thumb drive as a flash storage device as a file system for my Project.

While reading the example code and trying to compile and deploy the example, it took me several days to fully understand the importance of defining the Volume Label correctly. Until the VOL_LABEL matched what the usb drive had, the demo would not work correctly.

I would like to recommend adding extra emphasis at the top of the header for this example to underscore and really highlight the essential importance of this configuration step. This is of particular value to new users who may not be as familiar with debugging code and just want to get up-and-running as quickly as possible. Here is my suggestion addition to the header comment:

// ******* IMPORTANT ******* READ THIS FIRST !
// You MUST define the VOL_LABEL correctly to match what is on your USB Device, or else
// the call to mount the USB mass storage volume will not succeed and this demo will fail to run
// properly and will fail to recognize the volume.
// On Windows, volume labels may be defined at the Command Line by the command label.
// On MacOS, volume labels may be changed using /usr/sbin/diskutil rename
// On Linux, volume lablels may be changed using mlabel or e2label

// define the label of your filesystem. VOL_PATH must end in '/'
// Example:
// #define VOL_LABEL "/foo"
// #define VOL_PATH "/foo/"

#define VOL_LABEL "/"
#define VOL_PATH "/"`

Also: suggest adding a possible solution to the Print Statement:

printf_P(PSTR("No media. Waiting to mount. Check VOL_LABEL is defined to match USB drive. " VOL_LABEL "\r\n"));

Thank you.

cache sync call implementation across the board

What would be the best way to implement subj.? I'm coding pic32 hal, there is a compiler macro for that so I can just use it. Another way is to define it like it's done in swi. Yet another way is to reserve a name and have a func with this name for every arch - this will be beneficial if we ever decide to remove more code from the hal into generic.

analogRead

Hi

I seem to recall that analogRead could not be used together with UHS30, but I cannot find that information again. Where can I find it? Or am I recalling wrong and analogRead is no problem?

Thanks!

Sending SMS with Huawei USB Modem

Hi

I am trying to run acm_terminal together with a Huawei USB modem. However, I am getting the following output in the serial window.

Capture2

I modified the Setup a bit, as follows

void setup() {
Serial.begin( 115200 );
delay(1000);
Serial.print("Start\r\n");
while(!USB_HOST_SERIAL);
USB_HOST_SERIAL.begin(115200);
Serial.print("USB HOST SERIAL True\r\n");

    printf_P(PSTR("\r\n\r\nStarting CDC-ACM test program...\r\n"));
    while(UHS_Usb.Init(1000) != 0);
    printf_P(PSTR("\r\n\r\nWaiting for Connection...\r\n"));

}

What may be causing this issue?

Also, as you can see there seems to be some issue with the printf_P function, as I am not getting that output.

I have included all the defines in the code.

// Patch printf so we can use it.
#define LOAD_UHS_PRINTF_HELPER 1
#define ENABLE_UHS_DEBUGGING 1
#define DEBUG_PRINTF_EXTRA_HUGE 1
#define DEBUG_PRINTF_EXTRA_HUGE_UHS_HOST 1
#define DEBUG_PRINTF_EXTRA_HUGE_USB_HOST_SHIELD 1

What could be the issue here?

Thanks, Thomas

F0x01 error

Sir im using this library for max3421e usb host controller with Arduino mega2560 but when i plug my pendrive I'm getting F0x01 error please help me

Enumerate fails when interface has not endpoint

Hello, I implementing MIDI class.
Some USB MIDI device have multiple interface. But the first interface may not have an endpoint.
In this case, enumeration is fail.

Configuration descriptor
0x0000 09 02 65 00 02 01 00 A0 32 09 04 00 00 00 01 01
0x0010 00 00 09 24 01 00 01 09 00 01 01 09 04 01 00 02
0x0020 01 03 00 00 07 24 01 00 01 41 00 06 24 02 01 01
0x0030 00 06 24 02 02 02 00 09 24 03 01 03 01 02 01 00
0x0040 09 24 03 02 04 01 01 01 00 09 05 01 02 40 00 00
0x0050 00 00 05 25 01 01 01 09 05 81 02 40 00 00 00 00
0x0060 05 25 01 01 03
Host initialized.
configs: 1
CONFIGURATION: 0, bNumInterfaces 2, wTotalLength 101
bLength: 9 bDescriptorType: 02
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 0 endpoints
ENDPOINT DESCRIPTORS FILLED
TestInterface VID:09e8 PID:007c Class:00 Subclass:00 Protocol 00
MIDI: checking vid 09e8, pid 007c, iface class 1, subclass 1
bLength: 36 bDescriptorType: 01     <- wrong
bLength: 9 bDescriptorType: 24
bLength: 9 bDescriptorType: 24
bLength: 9 bDescriptorType: 05
bLength: 5 bDescriptorType: 25
bLength: 9 bDescriptorType: 05
bLength: 5 bDescriptorType: 25
USB_INTERFACE END OF STREAM

I tried commenting out the following line.
https://github.com/felis/UHS30/blob/master/libraries/UHS_host/UHS_host_INLINE.h#L764-L766

                        if(!ei->interface.numep) {
//                                rcode = getone(pep, left, read, data, offset);
//                                if(rcode)
//                                        return rcode;
                        }

It's work fine.

Host initialized.
configs: 1
CONFIGURATION: 0, bNumInterfaces 2, wTotalLength 101
bLength: 9 bDescriptorType: 02
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 0 endpoints
ENDPOINT DESCRIPTORS FILLED
TestInterface VID:09e8 PID:007c Class:00 Subclass:00 Protocol 00
MIDI: checking vid 09e8, pid 007c, iface class 1, subclass 1
bLength: 9 bDescriptorType: 24
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 2 endpoints
bLength: 7 bDescriptorType: 24
bLength: 6 bDescriptorType: 24
bLength: 6 bDescriptorType: 24
bLength: 9 bDescriptorType: 24
bLength: 9 bDescriptorType: 24
bLength: 9 bDescriptorType: 05
bLength: 5 bDescriptorType: 25
bLength: 9 bDescriptorType: 05
ENDPOINT DESCRIPTORS FILLED
TestInterface VID:09e8 PID:007c Class:00 Subclass:00 Protocol 00
MIDI: checking vid 09e8, pid 007c, iface class 1, subclass 3
bLength: 5 bDescriptorType: 25
USB_INTERFACE END OF STREAM
bLength: 9 bDescriptorType: 02
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 0 endpoints
ENDPOINT DESCRIPTORS FILLED
MIDI: checking vid 09e8, pid 007c, iface class 1, subclass 1
bLength: 9 bDescriptorType: 24
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 2 endpoints
bLength: 7 bDescriptorType: 24
bLength: 6 bDescriptorType: 24
bLength: 6 bDescriptorType: 24
bLength: 9 bDescriptorType: 24
bLength: 9 bDescriptorType: 24
bLength: 9 bDescriptorType: 05
bLength: 5 bDescriptorType: 25
bLength: 9 bDescriptorType: 05
ENDPOINT DESCRIPTORS FILLED
MIDI: checking vid 09e8, pid 007c, iface class 1, subclass 3
MIDI: SetInterface
bLength: 5 bDescriptorType: 25
MIDI: device detected
Connected to MIDI

Am I wrong? or correct?

Does it work with ADK?

Hi,
I would like to try this out! I am currently using the USB Host 2.0 library with Android ADK and am finding issues with the Usb.Task(). I think an interrupt based usb host would work better.

Is there a UHS3.0 example that would work with ArduinoBlinkLED for Android, like there is for the UHS2.0? If not, any other examples that work with ADK?

Thanks!

UHS_MIDI: Arturia Beatstep Pro not working

Hi,

I'm trying to use UHS_MIDI to connect an Arturia Beatstep Pro which is not working.
It seems to find and connect the device, but as soon as any data from the device arrives it just disconnects the device...





Configuring: parent = 0, port = 1, speed = 1


Configuring PktSize 0x40,  rcode: 0x00, retries 0
ep entry for interface 2 ep 0 max packet size = 64
ctrlReq2: left: 64, read:64, nbytes 64
RESULT: 0x00 0x00 0x12 0x0040000001000680
ctrlReq3: acceptBuffer sz 18 nbytes 64 left 46

ep entry for interface 2 ep 0 max packet size = 64
0 retries.
DevDescr 2nd poll, bMaxPacketSize0:64
ep entry for interface 11 ep 0 max packet size = 64
ctrlReq2: left: 18, read:18, nbytes 18
RESULT: 0x00 0x01 0x12 0x0012000001000680
ep entry for interface 2 ep 0 max packet size = 64
0 retries.
configs: 1
ep entry for interface 2 ep 0 max packet size = 64
ctrlReq2: left: 9, read:9, nbytes 9
RESULT: 0x00 0x01 0x09 0x0009000002000680
CONFIGURATION: 0, bNumInterfaces 2, wTotalLength 133
ep entry for interface 2 ep 0 max packet size = 64
bLength: 9 bDescriptorType: 02
eating 8
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 0 endpoints
eating 1
ENDPOINT DESCRIPTORS FILLED
TestInterface VID:1c75 PID:0287 Class:00 Subclass:00 Protocol 00
Interface data: Class:01 Subclass:01 Protocol 01, number of endpoints 0
Parent: 00, bAddress: 01
MIDI: checking vid 1c75, pid 0287, iface class 1, subclass 1
No driver at index 1
No driver at index 2
No driver at index 3
No driver at index 4
No driver at index 5
No driver at index 6
No driver at index 7
No driver at index 8
No driver at index 9
No driver at index 10
No driver at index 11
No driver at index 12
No driver at index 13
No driver at index 14
No driver at index 15
No driver for this interface.
bLength: 9 bDescriptorType: 24
eating 8
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 2 endpoints
bLength: 7 bDescriptorType: 24
eating 5
bLength: 6 bDescriptorType: 24
eating 4
bLength: 6 bDescriptorType: 24
eating 4
bLength: 6 bDescriptorType: 24
eating 4
bLength: 6 bDescriptorType: 24
eating 4
bLength: 9 bDescriptorType: 24
eating 7
bLength: 9 bDescriptorType: 24
eating 7
bLength: 9 bDescriptorType: 24
eating 7
bLength: 9 bDescriptorType: 24
eating 7
bLength: 9 bDescriptorType: 05
ENDPOINT DESCRIPTOR: 0
ENDPOINT DESCRIPTOR OK
eating 2
bLength: 6 bDescriptorType: 25
eating 4
bLength: 9 bDescriptorType: 05
ENDPOINT DESCRIPTOR: 1
ENDPOINT DESCRIPTOR OK
eating 2
eating 1
ENDPOINT DESCRIPTORS FILLED
TestInterface VID:1c75 PID:0287 Class:00 Subclass:00 Protocol 00
Interface data: Class:01 Subclass:03 Protocol 03, number of endpoints 2
Parent: 00, bAddress: 01
MIDI: checking vid 1c75, pid 0287, iface class 1, subclass 3
Driver 0 supports this interface
Driver 0 can be used for this interface
bLength: 6 bDescriptorType: 25
eating 5
USB_INTERFACE END OF STREAM
ep entry for interface 2 ep 0 max packet size = 64
ctrlReq2: left: 9, read:9, nbytes 9
RESULT: 0x00 0x01 0x09 0x0009000002000680
CONFIGURATION: 1, bNumInterfaces 2, wTotalLength 133
Best configuration is 1, enumerating interfaces.
ep entry for interface 2 ep 0 max packet size = 64
bLength: 9 bDescriptorType: 02
eating 8
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 0 endpoints
eating 1
ENDPOINT DESCRIPTORS FILLED
AttemptConfig: parent = 0, port = 1
MIDI: checking vid 1c75, pid 0287, iface class 1, subclass 1
No driver at index 1
No driver at index 2
No driver at index 3
No driver at index 4
No driver at index 5
No driver at index 6
No driver at index 7
No driver at index 8
No driver at index 9
No driver at index 10
No driver at index 11
No driver at index 12
No driver at index 13
No driver at index 14
No driver at index 15
No interface driver for this interface.bLength: 9 bDescriptorType: 24
eating 8
bLength: 9 bDescriptorType: 04
INTERFACE DESCRIPTOR FOUND
Getting 2 endpoints
bLength: 7 bDescriptorType: 24
eating 5
bLength: 6 bDescriptorType: 24
eating 4
bLength: 6 bDescriptorType: 24
eating 4
bLength: 6 bDescriptorType: 24
eating 4
bLength: 6 bDescriptorType: 24
eating 4
bLength: 9 bDescriptorType: 24
eating 7
bLength: 9 bDescriptorType: 24
eating 7
bLength: 9 bDescriptorType: 24
eating 7
bLength: 9 bDescriptorType: 24
eating 7
bLength: 9 bDescriptorType: 05
ENDPOINT DESCRIPTOR: 0
ENDPOINT DESCRIPTOR OK
eating 2
bLength: 6 bDescriptorType: 25
eating 4
bLength: 9 bDescriptorType: 05
ENDPOINT DESCRIPTOR: 1
ENDPOINT DESCRIPTOR OK
eating 2
eating 1
ENDPOINT DESCRIPTORS FILLED
AttemptConfig: parent = 0, port = 1
MIDI: checking vid 1c75, pid 0287, iface class 1, subclass 3
Driver 0 supports this interface
MIDI: SetInterface
MIDI: found 3 endpoints
MIDI: address 1, config 1, iface 1 with 3 endpoints
Interface Configured
bLength: 6 bDescriptorType: 25
eating 5
ep entry for interface 2 ep 0 max packet size = 64
Driver 0 @ 01 Initialize
MIDI: Start
MIDI: device detected
MIDI: EpInfoEntry OK
MIDI: OnStart OK
Total endpoints = (3)3
Driver 1 no driver at this index.
Driver 2 no driver at this index.
Driver 3 no driver at this index.
Driver 4 no driver at this index.
Driver 5 no driver at this index.
Driver 6 no driver at this index.
Driver 7 no driver at this index.
Driver 8 no driver at this index.
Driver 9 no driver at this index.
Driver 10 no driver at this index.
Driver 11 no driver at this index.
Driver 12 no driver at this index.
Driver 13 no driver at this index.
Driver 14 no driver at this index.
Driver 15 no driver at this index.
Connected to MI01⸮⸮p⸮0⸮⸮ ⸮⸮01⸮⸮⸮�⸮⸮0i⸮0⸮⸮⸮⸮⸮⸮⸮⸮�⸮⸮⸮�⸮⸮⸮�⸮⸮⸮⸮⸮�⸮⸮⸮⸮⸮⸮⸮�⸮⸮⸮⸮⸮�⸮⸮⸮⸮⸮⸮⸮�⸮⸮⸮⸮⸮ϒߒ⸮⸮⸮�⸮�⸮ϓߓl�{�⸮�����⸮�^�⸮�⸮�⸮�⸮�Y⸮i⸮⸮�⸮⸮⸮�⸮⸮⸮⸮-I
ep entry for interface 8 ep 1 max packet size = 64
ep entry for interface 8 ep 1 max packet size = 64
ep entry for interface 8 ep 1 max packet size = 64
ep entry for interface 8 ep 1 max packet size = 64
ep entry for interface 8 ep 1 max packet size = 64


Disconnected from MIDI

Output of lsusb:


Bus 004 Device 004: ID 1c75:0287  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1c75 
  idProduct          0x0287 
  bcdDevice            1.00
  iManufacturer           1 Arturia
  iProduct                2 Arturia BeatStep Pro
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          133
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength            9
        bInCollection           1
        baInterfaceNr( 0)       1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           95
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 1
        iJack                   4 Arturia BeatStepPro
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 2
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 5
        iJack                   6 BeatStepProInEditor
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 6
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 3
        bNrInputPins            1
        baSourceID( 0)          2
        BaSourcePin( 0)         1
        iJack                   3 Arturia BeatStepPro
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 7
        bNrInputPins            1
        baSourceID( 0)          6
        BaSourcePin( 0)         1
        iJack                   5 BeatStepPro OutEditor
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 8
        bNrInputPins            1
        baSourceID( 0)          5
        BaSourcePin( 0)         1
        iJack                   0 
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 6
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         2
          baAssocJackID( 0)       1
          baAssocJackID( 1)       5
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 6
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         2
          baAssocJackID( 0)       3
          baAssocJackID( 1)       7
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

The Beatstep Pro reports 2 Midi-In and MidiOut Ports, one seems to be used by for the configuration utility only...

peripheral not ready during busprobe()

Hi,

my project is based on your code, thus I think maybe you have this problem too.

once every ~20-30 insertions the peripheral returns hrNAK in rHRSL without flipping JSTATUS or KSTATUS in busprobe().

the commit from rodan/lemidi@708f794#diff-15d89ed0b4fc434be8c03517072a6efa fixed that problem for me.

if you have the Logic software from Saleae you can check out the problem
https://github.com/rodan/lemidi/blob/master/qa/wrong_init.logicdata
and after the patch
https://github.com/rodan/lemidi/blob/master/qa/fix_wrong_init.logicdata

might help, might not, thought I'd share either way.

cheers,
peter

Error compiling UHS_HID_KB_MOUSE.ino

Trying to compile the example UHS_HID_KB_MOUSE.ino but keeps getting this error:

c:/users/gio/appdata/local/arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 240 bytes

c:/users/gio/appdata/local/arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 240 bytes

c:/users/gio/appdata/local/arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 240 bytes

c:/users/gio/appdata/local/arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 240 bytes

c:/users/gio/appdata/local/arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 240 bytes

C:\Users\gio\AppData\Local\Temp\arduino_build_132947\libraries\ISR_safe_memory\mlock.c.o: In function `__malloc_lock':

D:\Documents\Arduino\libraries\ISR_safe_memory/mlock.c:153: undefined reference to `__retarget_lock_acquire_recursive'

D:\Documents\Arduino\libraries\ISR_safe_memory/mlock.c:155: undefined reference to `__lock___malloc_lock_object'

C:\Users\gio\AppData\Local\Temp\arduino_build_132947\libraries\ISR_safe_memory\mlock.c.o: In function `__malloc_unlock':

D:\Documents\Arduino\libraries\ISR_safe_memory/mlock.c:162: undefined reference to `__retarget_lock_release_recursive'

D:\Documents\Arduino\libraries\ISR_safe_memory/mlock.c:177: undefined reference to `__lock___malloc_lock_object'

collect2.exe: error: ld returned 1 exit status

Any idea?

CH340/341a?

Hi all, I was looking to use the library as a starting point to getting the CH340/341a serial chip as one of the supported serial coms devices, anyone know if any of the already done ftdi or prolific would be a good jumping off point? I have been sniffing the usb packets on wireshark and it all looks fairly tame.

UHS_FS_NEW_DEMO crashing

I am trying to run the UHS_FS_NEW_DEMO on an Tosduino MEGA 2560 (Arduino Mega compatible) with an Arduino USB Host Shield and it seems to crash during Init_Generic_Storage(&UHS_Usb);, as shown by this screen shot:

usb_rebooting

One of our engineers had made a small modification to the RESET pin of the Arduino shield, so I had to add the following bit of code to the start of the sketch:

void setup() {
  // MAX3421 reset pin on D7
  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  delay(100);
  digitalWrite(7, HIGH);
  delay(100);
  ...
}

I presume this won't cause a problem, but I thought I would mention it, just in case. I'll try narrowing down where in Init_Generic_Storage the crash is happening.

USB Host Shield Failed to Connect

I failed to build a connection between USB host Shield and My Device. I'm using USB host library 2.0 and USH30 in that i have used CDC_ACM as well which is available on GitHub.
Could You please help me out I am totally new in this.

My device specs are listed below:
VIRTUAL COM PORT
Device Type: Ports (COM & LPT)
Manufacturer: FTDI
Location: on USB Serial Converter
Baud Rate:115200 baud* Format: 8 data bits, no parity, 1 stop bit*
Device Description : USB Serial Port
USB Device Hardware Ids: FTDIBUS\COMPORT&VID_0403&PID_6015

When I upload USBFTDILoopback.ino It won't give any response just print "Start", Please refer below screenshot
image

And in acm_terminal.ino it prints in Serial Monitor "waiting for connection....", Please refer below screenshot
image

Question: Connect generic HID device directly to DUEs Native USB port?

Hi,
I have a USB HID device that I would like to connect directly to the Native USB port of my DUE. I know what data to expect and what data to send, but I don't know how to approach this problem. Is it at all possible to use this library for that purpose without the USB shield? Do I need to implement my own driver and if so, is there any example for doing this? Thanks for your help.

HellG.


Under linux my device reports the following via lsusb:
Bus 001 Device 044: ID 0c29:020a Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x0c29 idProduct 0x020a bcdDevice 1.00 iManufacturer 0 iProduct 0 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 34 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x40 (Missing must-be-set bit!) Self Powered MaxPower 4mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.00 bCountryCode 8 French bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 63 Report Descriptor: (length is 63) Item(Global): Usage Page, data= [ 0x00 ] 0 Undefined Item(Local ): Usage, data= [ 0x00 ] 0 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Global): Report ID, data= [ 0x01 ] 1 Item(Local ): Usage Minimum, data= [ 0x01 ] 1 (null) Item(Local ): Usage Maximum, data= [ 0x68 ] 104 (null) Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0x01 ] 1 Item(Global): Report Count, data= [ 0x68 ] 104 Item(Global): Report Size, data= [ 0x01 ] 1 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Usage Page, data= [ 0x00 ] 0 Undefined Item(Local ): Usage, data= [ 0x00 ] 0 (null) Item(Global): Report ID, data= [ 0x01 ] 1 Item(Local ): Usage Minimum, data= [ 0x01 ] 1 (null) Item(Local ): Usage Maximum, data= [ 0x38 ] 56 (null) Item(Global): Report Count, data= [ 0x38 ] 56 Item(Global): Report Size, data= [ 0x01 ] 1 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x02 ] 2 Item(Local ): Usage Minimum, data= [ 0x01 ] 1 (null) Item(Local ): Usage Maximum, data= [ 0x38 ] 56 (null) Item(Global): Report Count, data= [ 0x38 ] 56 Item(Global): Report Size, data= [ 0x01 ] 1 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x03 ] 3 Item(Local ): Usage Minimum, data= [ 0x01 ] 1 (null) Item(Local ): Usage Maximum, data= [ 0x18 ] 24 (null) Item(Global): Report Count, data= [ 0x18 ] 24 Item(Global): Report Size, data= [ 0x01 ] 1 Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x000e 1x 14 bytes bInterval 4 Device Status: 0x0001 Self Powered

Development Environment Advice / Recomendation

I acknowledge that there is no technical support available for UHS30 at this time.

I have indeed committed to the use of UHS30 for a project. Thus far, I have been utilizing the UHS_FS_NEW_DEMO to test the mounting and access to a thumb drive. The test seems to run for days suggesting that the current UHS30 code is reliable.

I am just about to begin developing the real application which will include a few sensors and two USB thumb drives and a SD memory card. The SD card is intended to be the primary data storage location with the two USB devices available for a user to periodically swap.

My use of UHS30 thus far has been via Arduino IDE version 1.6.5. I have as well successfully built the test applications using the Visual Micro plugin for Atmel Studio 6.2. While both environments seem to work, my desire is to shift development to Atmel Studio 6.2 w/o the use of the Visual Studio plugin.
I have created a core library from the Arduino 1.6.5 IDE and libraries for all of the non UHS30 Arduino libraries that are necessary when using the IDE or Visual Micro. I seem to be having some difficulty in creating a standalone UHS30 library within Visual Studio.

I am looking for some advice or recommendations regarding my plan to shift to the use of Visual Studio.

My current strategy in attempting to create a UHS30 library is actually to create individual libraries for each of the directories within the UHS30\library structure. This may indeed be problematic.

Any thoughts, feedback or advice would be greatly appreciated.

Regards,
-marc

BULK Release() definition

This is a follow-up to a discussion between me and xxxajk about the subj. I commented out Release() from bulk_storage and verified by running UHS_FS_NEW_DEMO. See 077dca3

xxxajk pls take a look

Due to Due Serial Communication Via USB Possible?

Greetings to the authors of this library.

First of all, thank you for taking the time and efforts to create a promising library!

Please forgive me if this post is a bit premature for this library, however I hope that one may confirm or deny if this library is the right library for what I wish to achieve.

What I am trying to achieve:-
I am currently working on a project that uses nearly every single pin header available on a Due, including all hardware serial ports and I would like to use the native USB port on the Due's to communicate between each other.

I understand that it is possible to setup one Due as a USB client serial device by invoking the SerialUSB.begin(9600); command and then sending data using SerialUSB.println("Hello World");
When connected to my PC or connected to my android phone using a OTG cable with the phone as a host, it works a treat.

As such I would require to setup the master Due as a USB host with an OTG cable to accept the CDC? connection/device that is the slave Due and to be able to read the serial data using SerialUSB.read();

It would appear that all the serial communication commands are there already, however I am struggling to get the Host Due to open a serial port with the slave Due.

My Question:-
Is this library, in its current form, possible to achieve what I am wishing to?
I have downloaded it and have played with it some, however I am not familiar with setting up the native USB host on the Due so my efforts have been to no avail thus far.

If the library does not currently support this type of connectivity, is this something that is planned for this library in the future?

Again many thanks for your time and effort with this library as I foresee it opening the doors to all sorts of cool project ideas!

I understand this project is not yet in a position to start providing technical support, as mentioned on the home page, however if you can provide any pointers that would get me a step closer to my goals it would be hugely appreciated.

Many thanks.
Delphi.

Teensy 3.1 compiler error

Hi

this lib sounds great! Thank you for your efforts!

I try to compile KINETIS_DEV_DESC on a Teensy 3.1 but I get this error:

mlock.c:27:2: error: #error "No Barrier implementation"

If I track things correctly, it should probably include dyn_SWI.h. However if the latter is included compilation fails because dyn_SWI.h contains C++ stuff while mlock.c is C only.

I'm afraid I need a hint to explore this further... or am I too early to try this?

Thanks for all help!

-Markk

Communication between my Arduino and a HID-Device

Hi everyone!

I'm using my arduino uno with my UHS to make communication with a HID-Device (DataLogger). I'm thinking the UHS_HID_RAW example sketch could be useful for my project. Has anyone some information how can i send and receive data with that sketch?

this is the example sketch.

// Load the USB Host System core
#define LOAD_USB_HOST_SYSTEM
// Load USB Host Shield
#define LOAD_USB_HOST_SHIELD
// Use USB hub, you might want this for multiple devices.
#define LOAD_UHS_HUB

// Patch printf so we can use it.
#define LOAD_UHS_PRINTF_HELPER
#define DEBUG_PRINTF_EXTRA_HUGE 0
#define DEBUG_PRINTF_EXTRA_HUGE_USB_HID 1

#define LOAD_UHS_HID

#include <Arduino.h>
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif

#include <UHS_host.h>

class myHID_processor : public UHS_HID_PROCESSOR {
public:
        myHID_processor(void) {}

        void onRelease(UHS_HID_base *d) {
                printf_P(PSTR("HID driver type %d no longer available.\r\n"), d->driver);
        }
        void onStart(UHS_HID_base *d) {
                printf_P(PSTR("HID driver type %d started, Subclass %02x, Protocol %02x\r\n"), d->driver, d->parent->bSubClass, d->parent->bProtocol);
        }
        void onPoll(UHS_HID_base *d, uint8_t *data, uint16_t length) {
                switch(d->driver) {
                        case UHS_HID_raw:
                                printf_P(PSTR("RAW input %d bytes interface %d, Subclass %02x, Protocol %02x Data:"), length, d->parent->bIface, d->parent->bSubClass, d->parent->bProtocol);
                                for(int i=0; i < length; i++) {
                                        printf_P(PSTR(" %02x"), data[i]);
                                }
                                printf_P(PSTR("\r\n"));
                                break;
                        default:
                                break;
                }
        }
};

myHID_processor HID_processor1;
myHID_processor HID_processor2;
MAX3421E_HOST UHS_Usb;
UHS_USBHub hub_1(&UHS_Usb);
UHS_HID hid1(&UHS_Usb, &HID_processor1);
UHS_HID hid2(&UHS_Usb, &HID_processor2);

void setup() {
        USB_HOST_SERIAL.begin(115200);
        while(UHS_Usb.Init(1000) != 0);
        printf_P(PSTR("\r\nHID RAW demo Begin.\r\n"));
}

void loop() {
        delay(1);
        
}

thanks a lot!

Twitching Servos when using UHS3

I've found that running an Arduino sketch with UHS3 and the Arduino Servo library causes the servo to twitch. This is one of the problems I am encountering in integrating UHS3 into our printers.

However, since this isolates the problem better, limiting it to the interaction of two libraries, I figured I would pass the information along.

writeReport for UHS_HID_raw

I am looking for an example of how to leverage writeReport.
Specifically, I'm trying to send a query string which should illicit a response with the requested information.
It doesn't appear to send the query string out though;

d->writeReport(uint16_t(sizeof(upsquery1))-1, uint8_t(upsquery1));

I assume I'm doing something wrong and seeking a functional example(s) of writeReport.

The sketch I'm working with is below.

// Load the USB Host System core
#define LOAD_USB_HOST_SYSTEM
// Load USB Host Shield
//#define LOAD_USB_HOST_SHIELD
// Use USB hub, you might want this for multiple devices.
//#define LOAD_UHS_HUB

// Patch printf so we can use it.
#define LOAD_UHS_PRINTF_HELPER
#define DEBUG_PRINTF_EXTRA_HUGE 0
#define DEBUG_PRINTF_EXTRA_HUGE_USB_HID 1

#define LOAD_UHS_HID

#include <Arduino.h>
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif

#define LOAD_UHS_KINETIS_FS_HOST

#define USB_HOST_SERIAL Serial2

#define ENABLE_UHS_DEBUGGING 1
#define DEBUG_PRINTF_EXTRA_HUGE 1
#define DEBUG_PRINTF_EXTRA_HUGE_UHS_HOST 1
#define DEBUG_PRINTF_EXTRA_HUGE_USB_HOST_KINETIS 1

#include <UHS_host.h>

const uint8_t upsquery1[] = {0x00, 0x01, 0x02, 0x03};

int ii = 0;

class myHID_processor : public UHS_HID_PROCESSOR {
public:
        myHID_processor(void) {}

        void onRelease(UHS_HID_base *d) {
                printf_P(PSTR("HID driver type %d no longer available.\r\n"), d->driver);
        }
        void onStart(UHS_HID_base *d) {
                printf_P(PSTR("HID driver type %d started, Subclass %02x, Protocol %02x\r\n"), d->driver, d->parent->bSubClass, d->parent->bProtocol);
        }
        void onPoll(UHS_HID_base *d, uint8_t *data, uint16_t length) {
                switch(d->driver) {
                        case UHS_HID_raw:
                                printf_P(PSTR("\r\n"));
                                printf_P(PSTR("RAW input %d bytes Data:"), length);
                                for(int i=0; i < length; i++) {
                                        printf_P(PSTR(" %02x"), data[i]);
                                }
                                printf_P(PSTR("\r\n"));
                                ii++;
                                if (ii>2){
                                    d->writeReport(uint16_t(sizeof(upsquery1))-1, uint8_t(upsquery1));
                                    printf_P(PSTR("RAW output %d bytes Data:"), sizeof(sendsend));
                                    for(int i=0; i < sizeof(sendsend); i++) {
                                            printf_P(PSTR(" %02x"), sendsend[i]);
                                    }
                                    printf_P(PSTR("\r\n"));
                                    ii=0;
                                  }
                                break;
                        default:
                                break;
                }
        }
};

myHID_processor HID_processor1;
UHS_KINETIS_FS_HOST UHS_Usb;
UHS_HID hid1(&UHS_Usb, &HID_processor1);

void setup() {
        USB_HOST_SERIAL.begin(115200);
        while(UHS_Usb.Init(1000) != 0);
        printf_P(PSTR("\r\nHID RAW demo Begin.\r\n"));
}

void loop() {
        delay(1);
}

Any example of use with ESP32?

It would be very interesting to be able to use this library with ESP32. This Teensy is very expensive.

Does anyone know if there is already an example?

I'm trying to use STM32F4 with two internal USB Host (OTG). But this library is still the best alternative for compatibility with the mini keyboard, with touchpad.

interrupts(), noInterrupts() - new home?

ATM they come from Arduino tree and apart from hw-specific code they are called from the core as well as swi (see grep output below). PIC32 won't be able to use it. What would be the best course of action - abstract it out somewhere else, perhaps?

felis@unstable:~/NetBeansProjects/UHS30$ grep -r noInterrupts .
./libraries/UHS_KINETIS_FS_HOST/UHS_KINETIS_FS_HOST_INLINE.h: noInterrupts();
./libraries/UHS_KINETIS_FS_HOST/UHS_KINETIS_FS_HOST_INLINE.h: noInterrupts();
./libraries/UHS_KINETIS_FS_HOST/UHS_KINETIS_FS_HOST_INLINE.h: noInterrupts();
./libraries/UHS_host/mlock.c: noInterrupts();
./libraries/UHS_host/UHS_usbhost.h: noInterrupts();
./libraries/UHS_host/UHS_usbhost.h: noInterrupts();
./libraries/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h: noInterrupts();
./libraries/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h: noInterrupts();
./libraries/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h: noInterrupts();
./libraries/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h: noInterrupts();
./libraries/dyn_SWI/SWI_INLINE.h: noInterrupts();
./libraries/dyn_SWI/SWI_INLINE.h: noInterrupts();
./libraries/dyn_SWI/SWI_INLINE.h: noInterrupts();
./libraries/dyn_SWI/SWI_INLINE.h: noInterrupts();
./libraries/UHS_PIC32/UHS_PIC32_INLINE.h: noInterrupts();
./libraries/UHS_PIC32/UHS_PIC32_INLINE.h: noInterrupts();
./libraries/UHS_PIC32/UHS_PIC32_INLINE.h: noInterrupts();

malloc()/new failed with AVR.

I am testing MIDI driver with MEGA ADK.
malloc() and new fail in the AVR toolchain after version 1.6.12.

  • Work: 1.6.2 to 1.6.11
  • Not work: 1.6.12 to 1.6.20

However, in version 1.6.11 or earlier, UNO will result in a link error.

Temp\arduino_build_328310\sketch\USB_MIDI_dump.ino.cpp.o: In function `MAX3421E_HOST::ISRbottom()':

UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h:762:(.text._ZN13MAX3421E_HOST9ISRbottomEv+0x48): relocation truncated to fit: R_AVR_7_PCREL against `no symbol'

collect2.exe: error: ld returned 1 exit status

Note: ARM platform is work fine.

UHS_FS_NEW_DEMO on USB Host Shield and Teensy 3.5

This is a continuation of the issue raised on ush2 with accessing a mass storage device using a usb host shield and a teensy 3.5. By the way its a microcent 8gb thumb drive. I incorporated the suggestions in the last post:

#define UHS_DEVICE_WINDOWS_USB_SPEC_VIOLATION_DESCRIPTOR_DEVICE 0

// Uncomment to debug
#define ENABLE_UHS_DEBUGGING 1
// Uncomment to make debugging very noisy
#define DEBUG_PRINTF_EXTRA_HUGE 1

and still hangs. I am attaching a text file with the debug messages for your reference.

Teensy35 Debug Dump.txt

Mike

UPDATE: Fiddling around with the FS_lock parameter, changed it to around 1000 and it seemed to running even further. On the off chance that there is some sort of propotional time affect on the sketch with the number of files on the drive I decided to delete all files on the drive and put just 5 files on it for a test.

With a FS_lock of one I get a repeating error:

ResetRecovery

Gen SCSI Err: 27
LUN: 00

Read LUN:

CBW.dCBWTag: 00000032
USB Error: 06
Index: 01
CBW: OK
Data Stage: OK
CSW:Sig error
Invalid CSW

where the TAG keeps incrementing. Changing it to 255 it proceeds further with periodic error messages like above - gets to CBW.dCBWTag: 00000ADE hangs for awhile then it gives me a few more USB errors and SCSI errors and continues very slowly. Increasing it makes it worse like for FS_lock 1.

Hope this info helps

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.