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

Thread: problems with microSD and communication between two teensy 3.6

  1. #1
    Junior Member
    Join Date
    May 2020
    Posts
    3

    problems with microSD and communication between two teensy 3.6

    Hello.

    I am having a problema with trying to communicate two teensy 3.6 between them, while one of them is logging data to a microSD. The micro loggiong data is using the Sdfat.h library and I used the LowLatebncyLogging example from greiman. I have used i2c, with the i2c_t3.h library, and Serial1 to create the communication, but in both cases, when the micro that is logging reach the sample number 3069, this micro stops working (the another micro, which is sending a pair of PWM signals keeps working). The sampling period in the logging micro is 1 millisecond and each data block is filled with 1023 samples.

    I have tried some debugging, and I found that the micro that is logging never finish writting the first block of data, and if I comment the code lines related to the communication with the other micro, the logging works fine.

  2. #2
    Junior Member
    Join Date
    May 2020
    Posts
    3
    I have found the solution. There seems to be a conflic between the sdfat library and the Serial1 to 6. To solve this problems, I had to add a file.sync after the file.open() and after file.write() (inmediatly after).

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,490
    Interesting - Serial1-6 shouldn't be a factor conflicting with any other - if i2c is on pins 18&19? - though the Serial buffers may overflow during long SD writes?

    Using the T_3.6 native SD card socket?

  4. #4
    Junior Member
    Join Date
    May 2020
    Posts
    3
    Yes, I am using the native sd socket.

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,674
    Quote Originally Posted by defragster View Post
    Interesting - Serial1-6 shouldn't be a factor conflicting with any other - if i2c is on pins 18&19? - though the Serial buffers may overflow during long SD writes?

    Using the T_3.6 native SD card socket?
    IIRC, the first 2 serial ports on the Teensy 3.6 (Serial1 on 0/1, Serial2 on 9/10) have 8 byte hardware FIFO (first-in, first-out) hardware queues, so they are less likely to lose data if interrupts are turned off for a bit.

    In addition, Serial1/2/3 all support hardware flow control (CTS on a dedicated pin, RTS on any pin) on the Teensy 3.6. So you may want to activate this as well:

Posting Permissions

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