Teensy 3.6: Can I see the microSD as a pendrive?

Status
Not open for further replies.

Bullone

Well-known member
Hi guys,
I'm working on a cataloguer that will store on the internal SD of my Teensy v3.6 some log files.... after a run Ill have to remove the microSD and read the content from my PC/MAC... is there a way to not remove the microSD and see its content just connecting the Teensy to the USB as a pendrive?
 
Yes, but the code is still at experimental level.

Search this forum for MTP RESPONDER.

I found I had to disable the MTP interupt whenever accessing the SD card for logging or my logs would stop as soon as this interupt fired.
 
wow! That's really ineresting!
I'll give it a look thanks.

So if I understood I have to disable MTP interrupt while writing on the SD card and re-enabling it when finished correct?
What about the USB port: can I still use it to program the device and to get the Serial dump messages?
My tipical scenario could be:
I connect my Teensy to the bike and it will log on the SD card some info and I can also read some value or configure parameters via Serial interface...
After one or more runs I'll disconenct the Teensy and when back at home I'd like to copy the files from SD card in a simple way (now I have to remove the card and put on a card reader).
I have a menu on the Serial interface so I can decide to enable or disable the MTP via menu if needed or any other idea is appreciate :)
 
I have only done limited testing so far, but from my experience, yes you can do all that you want to do.
If you make sure all of your SD card access starts with an interupt disable and finishes with an interupt enable, then all is well. Not yet tried serial comms while logging ( I use a switch on my car to start and stop logging, then connect PC to download logfile after a session )

You may find that you do not need to start/stop the interupt if you are not using folders and are writing to a single location on the root of the SD card. I have folders for date and time and for binary and ascii data, and my very wild guess is that folder traversing for logging and MTP are conflicting. I have tried adding SD Class instances to avoid this conflict, but drowned myself though lack of coding ability & understanding.

When browsing files through the USB/MTP interface on a computer, I found at times I could not delete multiple files and/or folders. Siingle item deletes were OK so for me this issue is painful but acceptable.
 
Thanks you so much!
I'm trying the MTP and it seems to works fine but if I write a file on SD while the Teensy is connected to the PC I can't see the new file even if I refresh with F5 key... if I disconnect and reconnect the Teensy it comes up.

Is this issue what you have solved disabling the interrupt? How to disable and reenable that interrupts?
 
No - this issue with modifications to SD files by the Teensy not being seen by the PC I think is normal behaviour and is not solved by disabling re-enabling the interupt.
(This is OK for my application as I am either logging, or downloading, but never both together.)
 
Ok, I think it will be fine olso for me! :)

My datalogger also have a menu that I access via COM serial and Putty.... is it possible to use both MTP and Serial communication with Putty?
 
Sorry I have not tried putty or other OS's other than Win7. I am interested in anything you discover though so please post any success or limitations you find.
 
Just testing and... I can't find a way to modify or overwrite a file contained in the SD from the Windows fiel explorere.
I'm able to remove files but if I open a file (I have a configuration file fro my app) and modify its content I loose the modification....

Any idea?
 
Tested and same result here. Workaround is drag config file from SD to windows desktop, file edit and save to desktop, drag file to SD and the modifications are there OK.
 
Status
Not open for further replies.
Back
Top