Teensy 3.6 and a Memory stick

Hai,

The Teensy 3.6 have a USB host, this work good with a USB keyboard.

I will (with a USB hub) a keyboard and memory stick connecting.

Is there a librarie for usb memory, with the "USBHost_t36.h"?

Thanks.

Sorry for my bad english.
 
Hai,

The Teensy 3.6 have a USB host, this work good with a USB keyboard.

I will (with a USB hub) a keyboard and memory stick connecting.

Is there a librarie for usb memory, with the "USBHost_t36.h"?

Thanks.

Sorry for my bad english.

Here are a couple of links to my Mass Storage driver 'MSC' and 'MSC2':

https://github.com/wwatson4506/MSC/tree/master

https://github.com/wwatson4506/MSC/tree/MSC2

The master brach is the oldest version of MSC and is stable. The MSC2 branch is the newest version and is still work in progress but has some new features and more example sketches. With the MSC branch you will need to use WMXZ'z uSDFS example sketches. With the MSC2 branch you will have to use my forked and modified version of uSDFS.

Here are the links to both version of uSDFS:

https://github.com/WMXZ-EU/uSDFS WXMZ's version.

https://github.com/wwatson4506/uSDFS My version.

The MSC driver has been tested with SSD, HD, Memory sticks and SD card readers.

Hope this is what you are looking for.
 
Last edited:
Hai thanks.

When i build this, than i see this error:

Naamloos.jpg

I see thee fault: uSDconfig.h:30:23: fatal error: spiconfig.h: No such file or directory


What are wrong.

Thanks
 
I am not sure where those errors are coming from. I cannot find references to those files anywhere in uSDFS. Did you download the latest version of uSDFS? What version of MSC did you download? To use WMXZ's uSDFS you will need to download MSC not MSC2. Also in line #59 of sd_config.h you will need 'USE_MSC' set to 1.

What version of Arduino are you using and what version of Teensyduino are you using?

Here is a link to the original MSC thread you might find it helpful:
https://forum.pjrc.com/threads/55821-USBHost_t36-USB-Mass-Storage-Driver-Experiments?highlight=Mass+storage
 
Last edited:
Thanks Wwatson,

After a reinstall of the libraries, wil this work now.

When no USB memory in the USB HUB, the program not running and wait on a USB memory.

Is it posible to run the program, after 2 seconds of not USB storage on the USB HUB?

Thanks.
 
Thanks Wwatson,

After a reinstall of the libraries, wil this work now.

When no USB memory in the USB HUB, the program not running and wait on a USB memory.

Is it posible to run the program, after 2 seconds of not USB storage on the USB HUB?

Thanks.

Yes it is by adding a timeout. I assume you are using MSC2. The example sketches 'HotPlug.ino' and 'CopyFiles.ino' wait for USB storage devices to be plugged in if they have not previously been plugged in. 'test_RawWrite.ino' should just give a mounting error if no USB drive is attached.

Are you using MSC or MSC2?
 
Hai,

I have this for check on USB Storage online:

uint8_t devices = 0;
unsigned long devMillis = millis() + 1000;
while(devices == 0 && millis() < devMillis) {
devices = findDevices();
}

Serial.println("Devices: " + String(devices));
if (devices == 0) {
Serial.println("No USB storage found!");
} else {
Serial.println("mscInit Start");
initDrive(0);
WaitMediaReady(0);
//numDevices = 1;
Serial.println("mscInit End");

rc = f_mount (&fatfs, Dev, 1);
Serial.println("Mount........: " + String(Dev) + ": " + String(rc));
rc = f_chdrive(Dev);
Serial.println("Change Drive.: " + String(Dev) + ": " + String(rc));
rc = f_stat("config.ini", 0);
Serial.println("File Stat....: " + String(Dev) + ": " + String(rc));
if (rc == 0) {
rc = f_open(&fil, "config.ini", FA_READ);
Serial.println("File Open RC.: " + String(rc));

rc = f_close(&fil);
Serial.println("File Close RC: " + String(rc));
}
Serial.println("Drive connected: " + String(checkDeviceConnected(0)));
}
 
@stanleyvc1 - I have another version of MSC that I am working on that times out of no USB drive is found. I have that working. It sets the default drive to the drive that is available if no other drive is found. As stated before this is (WIP), 'Work In Progress'. The 'findDevices()' function will be gone. All detection and initialization will be done through a call to 'mscInit()'. My goal is to be able to hot plug USB Mass Storage Devices and have it auto initialize and optionally mount those devices by plug in or initial access to the device:)
 
Hello @wwatson! First of all: thanks for this great library!

I've got one question: how can i read a specific file (let's say: confic.dat in root-dir) and store it in a simple string?
 
Hello @wwatson! First of all: thanks for this great library!

I've got one question: how can i read a specific file (let's say: confic.dat in root-dir) and store it in a simple string?

Thanks,
I am assuming that the data in confic.dat is an ASCII file. What is the size of the file? What version of MSC are you using MSC or MSC2? Checkout 'test_RawWrite.ino for clues on how to read an write a file. As these are based on FatFs, you need to checkout the FatFs site here:

http://elm-chan.org/fsw/ff/00index_e.html

A littie more information would help me understand what you are after. If you have code, please post it:)
 
I'm using MSC2, alle the examples are working.

But i don't know how to read a specific file and store the read data in an char-array

The config.dat file is an ascii file with only a few lines...

Example:
lastVal1=...
Val2=...

and so on... for let's say 20 variables.

After i read the file i want to set my internal variables to these read values from the file on the usb stick.
 
I'm using MSC2, alle the examples are working.

But i don't know how to read a specific file and store the read data in an char-array

The config.dat file is an ascii file with only a few lines...

Example:
lastVal1=...
Val2=...

and so on... for let's say 20 variables.

After i read the file i want to set my internal variables to these read values from the file on the usb stick.

I understand what you are after. This is a programming issue that you need to learn how to develop. My MSC2 driver is just that. It controls the communications between your program and and the USB Mass Storage Device. There are several levels of file control and manipulation that you need to learn to use.
Top level is FatFs. This where you write data to a file in a formatted fashion using all of the FATFs functions available and then read that same data back into your char-array in a formatted fashion. Structurally it depends on what you are trying to do.

I would suggest searching the Internet for information on how to do that:)

EDIT: You might also want to search this forum for ideas as well.
 
Last edited:
Back
Top