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

Thread: Hardware Differences LC vs 4.0, SPI, I2C and decisions to make

  1. #1
    Senior Member
    Join Date
    Sep 2020
    Location
    Massachusetts
    Posts
    133

    Hardware Differences LC vs 4.0, SPI, I2C and decisions to make

    Hello,

    I am working on a hobby project using I2C for an OLED display and SPI for an SD card reader plus 3 digital potentiometers.

    For the Teensy 4, the SD reader does not initialize. It's one of those super-cheap things with a 5-to-3.3v regulator and level shifters. I disabled the regulator on the card reader, and still no success. About to give up, I swapped my Teensy LC and witnessed the card reader able to initialize, read and write without a problem. But then I noticed the LC has problems with the OLED display. As per suggestion on the forum (thanks Frank), I boosted the pull-up resistors on the I2C pins and got the OLED display to work _better_ but still a little flaky. Of course I had to change timing on my loop() method on the LC but it's okay. (Did I forget to say I'm also receiving serial MIDI?)

    So. Yes I am curious as what accounts for the differences here (seems like voltage/current more than timing or speed).

    But mostly I'm trying to get a sense of which Teensy is right for my project. I would prefer to use a Teensy 4, but I'm not crunching numbers or driving the Audio Library. If the best advice is "don't be so cheap and get a better SD card reader", I'll take my medicine and do that.

    Thanks,

    Ben

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,763
    With many things like this, it might help to see the code that is not working. For example which library? What version of Teensyduino? How do you have the SD Card wired?

    Dito for what OLED display? How is it wired? Things like how long are the wires? Do they make good connections? Which Library? what does it setClock to? Have you tried a lower speed to see if that helps?

    What would I do?

    I would tend to maybe try to use a Teensy that has the SD Built in if I could (T4.1 or T3.5/6) why? One less piece of hardware to have to make work...
    T4 you have this option as well, although connecting up a SD adapter to the bottom pins through things like Ribbon cables or castellated adapter can be problematic.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,232
    On Teensy 4, try using 1.54-beta6. I believe we lowered the default SPI speed to only 16 MHz so more of those cheap level shifter boards could work by default.

    https://forum.pjrc.com/threads/66182...no-1-54-Beta-6

    There's also a special syntax to access the SdFat instance, so you can configure for even lower SPI speeds.

  4. #4
    Senior Member
    Join Date
    Sep 2020
    Location
    Massachusetts
    Posts
    133
    Quote Originally Posted by PaulStoffregen View Post
    On Teensy 4, try using 1.54-beta6. I believe we lowered the default SPI speed to only 16 MHz so more of those cheap level shifter boards could work by default.

    https://forum.pjrc.com/threads/66182...no-1-54-Beta-6

    There's also a special syntax to access the SdFat instance, so you can configure for even lower SPI speeds.
    Will do, thank you!

  5. #5
    Senior Member
    Join Date
    Sep 2020
    Location
    Massachusetts
    Posts
    133
    ...where do I download beta Teensyduino? oh, I see

  6. #6
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,435
    The 16MHz is a breaking change for some, as their SD become slower without warning.

  7. #7
    Senior Member
    Join Date
    Sep 2020
    Location
    Massachusetts
    Posts
    133
    I had to rollback the beta Teensyduino before I could test it with the Teensy 4, because I could not compile my project for the LC with that beta.
    (Also, noticed Teensy Loader would not launch.)
    I will try it again when I finish the POC I am doing at this time with controlling a guitar pedal with digital pots.
    I'm excited to try some STL. Collection classes?

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,232
    Quote Originally Posted by blakeAlbion View Post
    (Also, noticed Teensy Loader would not launch.)
    Any chance you're using Ubuntu 20.04?

    Might be this issue.
    https://forum.pjrc.com/threads/62809...ow-to-start-up

  9. #9
    Senior Member
    Join Date
    Sep 2020
    Location
    Massachusetts
    Posts
    133
    No, sorry, I did not know this was not a known issue. I am using Big Sur (I think). When I changed the board manager to use Teensy 4, the loader came up on compile. Seems like something got stuck when I switched back to 1.53, but now fixed.

  10. #10
    Senior Member
    Join Date
    Sep 2020
    Location
    Massachusetts
    Posts
    133
    I don't know why I did not ask this before, but is there an example of how to set up SPI with the SD library?
    How do I override the SPI settings the SD library uses?
    Thanks,
    Ben

Posting Permissions

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