Forum Rule: Always post complete source code & details to reproduce any issue!

1. @Fluxanode
- do not use Sdfat.h but only SD.h, which since recently uses Sdfat internally.
- teensy is a mtp responder and therefore has no control in what PC (the master or initiator) knows about the existing files.
in particular, when teensy is adding files (during data acquisition) , PC will not know about this. The MTP protocol is designed to transfer existing files and not to monitor a device.
Under normal circumstances, Teensy should only reply to PC requests. However, there are some possibilities that teensy informs PC that situation has changed. One of this options is to reset completely the MTP. this is done in mtp-basic by receiving the letter 'r' from the PC.

better not to call mtpd.loop() while in acquisition mode, it is useless. better to call this function only when acquisition is stopped.
you may check with mtp-logger.ino how this could be done.

2. Thanks again for the help, let me mull this over.
I'm sure I'll have more questions, thanks for your patience with my rookie questions.

BTW where is the mtpd_loop() in your source code?
Can I call mtpd_loop() from a menu item?
Does it need to be in a loop and how does it exit when finished?
Is there a method to send the reset 'r' from the program rather than serial monitor?

3. @WMXZ
BTW where is the mtpd_loop() in your source code?
Can I call mtpd_loop() from a menu item?
Does it need to be in a loop and how does it exit when finished?
Is there a method to send the reset 'r' from the program rather than serial monitor?

4. @WMXZ - Is there a method to send the reset 'r' from the program rather than serial monitor?

I found my answer to that question... mtpd.send_DeviceResetEvent() Where is this function located?

5. mtp.loop() is in the MTP.cpp file and similar to loop() must be called continuously to service each PC mtp request.

mtp.loop() contains a mtp protocol interpreter. that's all.
where you loop you call it, its up to you. but to service PC MTP request you must call it continuously. If there are no requests, mtp.loop() simply exits.

Is there a method to send the reset 'r' from the program rather than serial monitor?
PC sends 'r' (or any command to tell Teensy to send reset event) and teensy sends reset event over MTP back to PC.

of course, on PC you can unmount/mount the MTP portable device to do the same. But this is all discussed earlier in this thread.

6. Ok how do I unmount the MTP device in windows?

7. Originally Posted by Fluxanode
Ok how do I unmount the MTP device in windows?

8. Is there a way to unmount other than device manager? Maybe using a batch file, script or in a program?

9. Originally Posted by Fluxanode
Is there a way to unmount other than device manager? Maybe using a batch file, script or in a program?
did you look under scripts?

10. No, is there something there to unmount?
is that the reset script?

11. Nevermind I see now. So I just edited it to disable and that works! Thanks!

12. @WMXZ - FYI, tried to compile the mtp-logger example to a teensy 3.2 and received the following compile errors.

D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino:155:26: warning: invalid conversion from 'long unsigned int (*)()' to 'getExternalTime {aka long int (*)()}' [-fpermissive]
setSyncProvider(rtc_get);
^
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time/time.h:2:0,
from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\stat.h:9,
from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\_default_fcntl.h:188,
from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\fcntl.h:4,
from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\fcntl.h:1,
from c:\program files (x86)\arduino\hardware\teensy\avr\libraries\sdfat\ src\common\fsapiconstants.h:30,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat\ src/ExFatLib/ExFatFile.h:36,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat\ src/ExFatLib/ExFatVolume.h:28,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat\ src/ExFatLib/ExFatLib.h:27,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat\ src/SdFat.h:33,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD\src/SD.h:27,
from D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino:18:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time/TimeLib.h:134:9: note: initializing argument 1 of 'void setSyncProvider(getExternalTime)'
void setSyncProvider( getExternalTime getTimeFunction); // identify the external time provider
^
D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino: In function 'int16_t acq_check(int16_t)':
D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino:944:17: error: 'acq_start' was not declared in this scope
acq_start();
^
D:\ChuckW\Arduino\MTP_t4-master\MTP_t4-master\examples\mtp-logger\mtp-logger.ino:948:16: error: 'acq_stop' was not declared in this scope
acq_stop();
^
Using library SD at version 2.0.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
Using library SdFat at version 2.0.5-beta.1 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI
Using library MTP_t4-master at version 1.0.0-beta.1 in folder: D:\ChuckW\Arduino\libraries\MTP_t4-master
Using library Time at version 1.6.1 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time
Error compiling for board Teensy 3.2 / 3.1.

13. Originally Posted by Fluxanode
@WMXZ - FYI, tried to compile the mtp-logger example to a teensy 3.2 and received the following compile errors.
Because it is coded for T3.5/T3.6. If really required, I suggest potential users modify the code to run on T3.2. This way the user learns the concept behind the mtp-logger.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•