PaulStoffregen / USBHost_t36

USB Host Library for Teensy 3.6 and 4.0
167 stars 86 forks source link

undefined reference to USBDrive::filesystem_assign_to_drive(USBFSBase*, bool)' #102

Closed pr8x closed 1 year ago

pr8x commented 1 year ago

I am trying to run the "MSC List files" example using PlatformIO. This is my platformio.ini:

[env:teensy40]
platform = teensy
board = teensy40
framework = arduino
lib_deps = 
    https://github.com/PaulStoffregen/USBHost_t36/archive/refs/heads/master.zip

It should use the latest Teensyduino core 1.57. It compiles just fine, but fails to link:

.pio\build\teensy40\lib411\libUSBHost_t36.a(MassStorageDriver.cpp.o): In function `USBFilesystem::begin(USBDrive, bool, unsigned char)': MassStorageDriver.cpp:(.text._ZN13USBFilesystem5beginEP8USBDrivebh+0x94): undefined reference to USBDrive::filesystem_assign_to_drive(USBFSBase, bool)'

Any idea why this happens :/ ?

EDIT: Seems that USBDrive::filesystem_assign_to_drive is not implemented. Was removed by https://github.com/PaulStoffregen/USBHost_t36/commit/c0acb2997c281003160fe711b518fe1ce6d14394

CC: @KurtE

KurtE commented 1 year ago

@wwatson4506, @mjs513,

Thanks, you are right that that method should have been removed from the header file. We went from having each sketch have to scan the drive list to figure out which ones are new and then enumerate the partitions on them, to add the drives. This is now handled for you.

Which Example are you using?

If you are using ones from: https://github.com/wwatson4506/UsbMscFat if you look at the readme file up on github:

It now starts off with:

UsbMscFat Library
NOTE: This Library is OUTDATED !!!
Please Use the examples in the latest USBHost_t36 stable library for the Teensy. Teensyduino 1.57
pr8x commented 1 year ago

@KurtE I am using this example: https://github.com/PaulStoffregen/USBHost_t36/blob/master/examples/Storage/ListFiles/ListFiles.ino

KurtE commented 1 year ago

Thanks,

Did most of the testing using MTP, will update these examples

pr8x commented 1 year ago

@KurtE I tried testing it. It now compiles (and links), but gets stuck during:

  while (!firstPartition) {
    myusb.Task();
  }

I am using a Teensy 4 and soldered pins to the Usb Host D+/D- pads on the backside. These are connected with a simple USB breakout board:

image

5V is provided to VBus via an external power supply. The USB is formatted as FAT32. Am I missing something? Is there any verbose debug output I can enable? DBGprint doesn't seem to print anything.

KurtE commented 1 year ago

The global debug setting is in USBHost_t36.h At about line 63: //#define USBHOST_PRINT_DEBUG Uncomment the line

Also MassStorageDriver.cpp has some additional debug output:

// Uncomment this to display function usage and sequencing.
//#define DBGprint 1
#ifdef DBGprint
#define DBGPrintf Serial.printf

I am assuming you have a common ground between this board, your 5v and the teensy

pr8x commented 1 year ago

I am assuming you have a common ground between this board, your 5v and the teensy

That's a good point. I connected grounds and enabled the debug flag.

I am now getting this output:

Initializing usb host... USB2 PLL running reset waited 6 USBHS_ASYNCLISTADDR = 0 USBHS_PERIODICLISTBASE = 2000B000 periodictable = 2000B000 Waiting for partition... 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 64 85 00 10 00 11 01 02 03 01 VendorID = 8564, ProductID = 1000, Version = 1100 Class/Subclass/Protocol = 0 / 0 / 0 Number of Configurations = 1 enumeration: enumeration: Manufacturer: JetFlash enumeration: Product: Mass Storage Device ERROR Followup remain on followup list remain on followup list remain on followup list

Edit: I managed to make it work by uncommenting

//USBHS_PORTSC1 |= USBHS_PORTSC_PFSC; // force 12 Mbit/sec

in ehci.cpp. As suggsted by https://forum.pjrc.com/threads/59338-Teensy-4-0-USB-Host-Issues

Do you (or anybody else) happen to know which cables (which thickness etc) I need for high speed (480 Mbit/sec) data transfer?