Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: MTP Troubles

  1. #1
    Junior Member
    Join Date
    Oct 2018
    Posts
    3

    MTP Troubles

    Hi

    I have been trying to use MTP to access the built in SD card on a Teensy 3.6 from Ubuntu 18.04. Using the MTP and SDFat libraries, the example MTP_blinky compiles and uploads with no errors. The serial monitor prints "I should be commented out" and the built in LED flashes c.3 secs on, c.3 secs off. However, Ubuntu can't detect the device.

    Code:
    #include <MTP.h>
    
    MTPStorage_SD storage;
    MTPD          mtpd(&storage);
    
    
    volatile int  status = 0;
    volatile bool sdfound = 0;
    volatile int  count = 1;
    
    void rtc_seconds_isr() {
      if (count-- == 0) {
        digitalWrite(LED_BUILTIN, status);
        Serial.println("I should be commented out");
        status = !status;
        if (sdfound)
          count = 2;
        else
          count = 1;
      }
    }
    
    void setup() {
      Serial.begin(19200);
      pinMode(LED_BUILTIN, OUTPUT);
    
      RTC_IER |= 0x10;  // Enable seconds IRQ from RTC peripheral
      NVIC_ENABLE_IRQ(IRQ_RTC_SECOND); // Enable seconds IRS function in NVIC
    }
    
    void loop() {
      if (SD.begin()) {
        sdfound = true;
        mtpd.loop();
      }
      else {
        sdfound = false;
      }
    }
    The libraries can be found at:
    https://github.com/yoonghm/MTP
    https://github.com/greiman/SdFat

    49-teensy.rules is saved in /etc/udev/rules.d/
    "MTP Disk (Experimental)" is selected in Arduino IDE (1.8.7). Teensyduino 1.44.
    Selected port is "/dev/ttyACM0 (Teensy 3.6) MTPDisk"

    I have tried the following techniques to no avail:
    https://forum.pjrc.com/threads/43050...r-Contribution
    http://bernaerts.dyndns.org/linux/74...any-mtp-device
    https://superuser.com/questions/1334...-18-04-upgrade

    'lsusb' shows that the Teensy is available via USB on Bus 006:
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 006 Device 010: ID 16c0:04d1 Van Ooijen Technische Informatica
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 002: ID 7392:a833 Edimax Technology Co., Ltd
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
    Bus 004 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

    'mtp-detect' (mtp-tools) does not find it though:
    libmtp version: 1.1.16
    Listing raw device(s)
    No raw devices found.

    I have tried to connect using file manager, go-mtpfs, jmtpfs and gmtp but none work. I have also tried different USB ports. Does anyone have any suggestions please?

    The serial monitor prints "I should be commented out" twice and then stops. The LED continues flashing though. Is this behaviour correct?

    Thank you.
    Dean.

  2. #2
    Junior Member
    Join Date
    Oct 2018
    Posts
    3
    I had an idea regarding access to the built in SD Card.

    Some years ago, I built a magnetometer based on a PIC that logged its readings to 2 memory chips (24LC256). These interfaced externally via a MAX232 and a serial output.

    Could the Teensy 3.6 do something similar? Record the readings to the SD card in the normal way via the onboard SDIO connection. Then, when required, use a dedicated interface for exporting the data to a PC rather than the USB (e.g. MOSI0, MISO0, SCK0 and a suitable SS pin). Would this be easier to implement? Easier than going through the USB port anyway?

    Any suggestions or wisdom would be helpful.
    Thanks.
    Last edited by xenington; 11-14-2018 at 06:25 PM. Reason: Clearer wording

Tags for this Thread

Posting Permissions

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