Trouble interfacing Teensy 4.1 to USB2241+eMMC via USBHost_t36 Library

ewer_ya

New member
Hey,

I am working on interfacing the Teensy 4.1 with a Microchip USB2241 Flash Media Controller (https://www.microchip.com/en-us/product/USB2241), which is connected to an eMMC (IS21ES08GA-JCLI-TR) on a custom PCB for datalogging.

Here, I followed the hardware design checklist provided by Microchip. When I connect the USB2241+eMMC to my PC, it works fine as it shows up as a regular USB drive and file operations work as well. However, when I try to access it using the Teensy and the USBHost_t36 library (with the "DriveInfo.ino" sketch), it is not detected at all. Apparently, the code gets stuck at the task() function. I've tried formatting it as exFAT and Fat32 multiple times, but neither worked. However, when trying another USB stick to verify the host port functioning correctly, the code works fine.

Has anyone successfully interfaced similar devices with the USBHost_t36 library? Any ideas on what might cause this problem?

Thanks in advance!
 
Something that seems curious is found at the bottom of page 1 of the data sheet.
1.Bulk only is not applicable to USB2240/40i/41/41i.
The T4.1 uses bulk only data transfers. You might want to turn on debugging in the "USBHost_36.h" file. This can be found at the beginning of the file at about line 63:
Code:
// Uncomment this line to see lots of debugging info!
//#define USBHOST_PRINT_DEBUG  <----------------- Un-comment this line to enable debugging info. ------------------------


// This can let you control where to send the debugging messages
//#define USBHDBGSerial Serial1
#ifndef USBHDBGSerial
#define USBHDBGSerial   Serial
#endif
This will spew lots of debugging information that you can post to the forum and maybe see if your device is actually being seen or where it is failing. This will allow us to see if the device is compatible with the USBHost_t36 library or see if the library can be made to work with your device.
 
Appreciate your help! I receive the following output after enabling the debugging info:

USB2 PLL running

reset waited 6

USBHS_ASYNCLISTADDR = 0

USBHS_PERIODICLISTBASE = 20003000

periodictable = 20003000



Waiting for Drive to initialize...
 
New update: I tried the "HIDDeviceInfo" sketch and when I plug in the Teensy with the USB2241 connected, the following is printed to the serial monitor:

USB HID Device Info Program



This Sketch shows information about plugged in HID devices



*** You can control the output by simple character input to Serial ***

R - Turns on or off showing the raw data

C - Toggles showing changed data only on or off

<anything else> - toggles showing the Hid formatted breakdown of the data



USB2 PLL running

reset waited 6

USBHS_ASYNCLISTADDR = 0

USBHS_PERIODICLISTBASE = 20005000

periodictable = 20005000

However, if I unplug the USB2241 while the Teensy is still connected the following is printed:

port change: 14001403

connect

port change: 1C001002

disconnect

And reconnecting it again results in:

port change: 14001403

connect

begin reset

port change: 14001005

port enabled

end recovery

new_Device: 1.5 Mbit/sec

new_Pipe

ERROR Followup

remove from followup list

stray halted 20005120

qtd: 200050E0, token=80080180, next=20005120

qtd: 20005120, token=80008080, next=20005160

dummy halt: 20005160

So I guess something is being detected.

Edit:
After disconnecting it once more I received:

port change: 1C001002

disconnect

disconnect_Device:

USBDriver (available_drivers) list: 2000CAC0 -> 2000CE80 -> 2000DF68 -> 2000A680 -> 2000ADC0 -> 2000B500 -> 2000BC40 -> 2000C380

USBDriver (dev->drivers) list: (empty

USBDriver (available_drivers) list: 2000CAC0 -> 2000CE80 -> 2000DF68 -> 2000A680 -> 2000ADC0 -> 2000B500 -> 2000BC40 -> 2000C380

delete_Pipe 20005080

shut down async schedule

Free transfers

* 536891616

* 536891744 * remove * free

* 536913472 * remove * defer free until QH

Free transfers attached to QH

* 536913472

* 536891808

* Delete Pipe completed

removed Device_t from devlist

Another edit:
I hotplugged the USB2241 after I connected the Teensy to my PC. Then, I receive:
port change: 10001803

connect

begin reset

port change: 10001005

port enabled

end recovery

new_Device: 12 Mbit/sec

new_Pipe
 
Last edited:
Ok. The device does not appear to be presenting itself as a bulk only USB mass storage device :( The following is what you would typically see from the debug info if it was:
Code:
USB2 PLL running
 reset waited 6
USBHS_ASYNCLISTADDR = 0
USBHS_PERIODICLISTBASE = 20003000
periodictable = 20003000
port change: 10001803
    connect

Waiting for Drive to initialize...
  begin reset
port change: 18001205
  port enabled
  end recovery
new_Device: 480 Mbit/sec
new_Pipe
enumeration:
enumeration:
enumeration:
Device Descriptor:
  12 01 10 02 00 00 00 40 81 07 90 55 00 01 01 02 03 01
    VendorID = 0781, ProductID = 5590, Version = 0100
    Class/Subclass/Protocol = 0 / 0 / 0
    Number of Configurations = 1
enumeration:
enumeration:
Manufacturer: SanDisk
enumeration:
Product: Ultra
enumeration:
Serial Number: 4C530001120612122373
enumeration:
Config data length = 32
enumeration:
Configuration Descriptor:
  09 02 20 00 01 01 00 80 70
    NumInterfaces = 1
    ConfigurationValue = 1
  09 04 00 00 02 08 06 50 00
    Interface = 0
    Number of endpoints = 2
    Class/Subclass/Protocol = 8(Mass Storage) / 6(SCSI) / 80(Bulk Only)
  07 05 81 02 00 02 00
    Endpoint = 1 IN
    Type = Bulk
    Max Size = 512
    Polling Interval = 0
  07 05 02 02 00 02 00
    Endpoint = 2 OUT
    Type = Bulk
    Max Size = 512
    Polling Interval = 0
enumeration:
USBHub memory usage = 960
USBHub claim_device this=20003220
USBDrive claim this=200035E0
Descriptor 4 = INTERFACE
USBDrive claim this=200035E0
09 04 00 00 02 08 06 50 00 07 05 81 02 00 02 00 07 05 02 02 00 02 00
numendpoint=2
endpointIn=81
endpointOut=2
packet size in (USBDrive) = 512
packet size out (USBDrive) = 512
polling intervalIn = 0
polling intervalOut = 0
new_Pipe
new_Pipe
Descriptor 5 = ENDPOINT
Descriptor 5 = ENDPOINT
Notice that when the "HIDDeviceInfo.ino" sketch is used you see:
new_Device: 12 Mbit/sec
With a mass storage device it is:
new_Device: 480 Mbit/sec
In the spec sheet it mentions that there are two interfaces to the MCU:
MCU Interface:USB, UART
So based on that and the previously noted:
1.Bulk only is not applicable to USB2240/40i/41/41i.
I suspect your USB2241 device does not do bulk only comms with USB.
I have taken the time to search the net a little but have not found much info other than design data sheets. Also I don't know much about windows (if that is what you are using) so I am not sure how you would get more information about the device from that. Maybe Somebody else does know how.

Is there some reason you are not using a USB stick or SD card reader?
 
That sounds unfortunate but thank you for your efforts!

I am looking for storage on my custom Teensy board that exceeds 4GB and is resistent against mechanical loads. I have already found a working solution with a SPI Flash that can be communicated with just like a SD card (https://www.adafruit.com/product/6039). However, the IC is not that easy to get for me and I wanted to optimize the system for higher write speeds and more storage.
I also thought about soldering a MicroSD Card directly to the board, which might be the best solution moving forward. :)
 
Back
Top