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

Thread: Teensy 4.1 I2C Start-up Issue

  1. #1

    Teensy 4.1 I2C Start-up Issue

    I've got a T4.1 on a custom PCB with three sensors on the I2C bus. In previous versions of this board, I've had very intermittent issues with a nearby RF radio signal killing my sensors, so in this version of the board I am using 2k pull-up resistors and ferrites on the I2C lines. Everything on the board is powered by a single 7.4v Lipo battery with a 5v 2.5A switched regulator powering the Teensy and a 3.3v 2.5a switched regulator powering the three sensors on the I2C bus. I am using the standard Wire library at 400K clock speed.

    The issue I am having is that eight out of ten times when I power up the board and sensors from the battery the I2C bus does not start up (no clock signal on the oscilloscope), but if I have the USB plugged into the computer and Teensy it works every time. There is a lot going on with the board and all the other I/O works great -- it is just the I2C bus that is not working. In the instances where the bus does start if I transmit a few packets on the radio, the small bit of RF kills the clock (sometimes). That is really easy to see on the scope. But the issue is not radio related, as it happens equally with the radio unplugged. It seems to me like something related to the I2C bus is "fragile".

    I have tried 25 things to troubleshoot this issue and isolate it. The one "fix" that corrects the issue 100% (beyond a usb computer connection) was binding the 3.3v output of the Teensy to the 3.3v output of the regulator that powers the sensors. They are both putting out clean 3.3v power within a few hundredths of a volt. In my curiosity to figure out why that worked, I measure the current flow and can see that it registers -14ma of current draw at the Teensy 3.3v pin, so I am assuming the 3.3v bus in the Teensy needs just a bit more power (current) to work properly, but why? I've confirmed the 5v regulator is working correctly and the 3.3v output on the Teensy is clean.

    Does anyone have ideas on what might be causing the inconsistencies in the I2C bus? Are the 2K pull-ups to much (I lowered these to try and reduce RFI). It is interesting that it works 100% with the 3.3v lines tied together, but I really don't want to be using that kluged together solution.

    I could post a schematic, but there is a lot going on beyond the I2C bus. For reference the three sensors I am using are an ADXL375 accelerometer, MS5607 pressure sensor, and a LSM6DS032 IMU.

    Thanks for any ideas.

    Mike

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,098
    Unless it is a power startup sequencing timing issue with the T_4.1's 1062 - where USB power or tied 3.3V brings it online in proper fashion. IIRC putting a 3.0V Cell level on vBat might assist with that. Paul made a post to that effect IIRC regarding powering T_4.x with 3.3V directly

    >> THIS POST :: pjrc.com/threads/64468-Teensy40-only-3-3V-power-supply

    The only other historical i2c issue that recurs is that Teensy is online before i2c issues can power up and be responsive.

    That probably doesn't explain failure of SCK to start, but is an easy thing to test.

    Put a delay(2500); before any i2c_device.Begin() operation as the sketch starts. That is an extreme delay() just to see if it relates.

  3. #3
    Thanks @defragster. I read through the start-up sequence thread and it really sounds like that might be the issue, but I can't nail it down in my testing. What I do know is that my 3.3v regulator (to the sensors) and my 5v regulator provide power at the exact same time (within .1 microseconds), but I can also see that my sensors are fired up and output 3.3v on a GPIO interrupt pin about 7 microseconds before the Teensy 3.3v pin goes high. So, maybe that 7ms is causing an issue. I also tried to tie the 3.3v reg output to the Bat pin, but that didn't help. Holding 3v on the bat pin before powering on also did not help. So, it doesn't seem to be an SNVS timing issue. Again, it is odd that it works 100% of the time with the 3.3v reg output and 3.3v Teensy output strapped together.

    I have a five second delay on the I2C startup, so I can confirm software timing is not an issue.

  4. #4
    So, I confirmed that this is a start-up sequence timing issue with the different power regulators. I pulled the regulators off my pcb and drove power using external bench power. When I power up the I2C sensors one second before powering up the 5v for the Teensy it fails every time. When I power up the Teensy one second before the sensors it works as expected 100% of the time. Using power on the Bat pin didn't seem to make a difference. So, I will likely just add a FET or small circuit to have the Teensy power on the I2C 3.3v regulator after the Teensy comes online.

    With the regulators out, I also confirmed that the only power going to the Teensy with the sensors on is coming from the two I2C pins. I suspect I didn't see this with the last version of my PCB (as much), because I've added lower resistors for stronger pull-up power, raising the voltage going into the (powerless) Teensy to 1.5v. That 1.5v on the I2C bus radiates internally, so the 3.3v Teensy pin raises to 1.02v, before the Teensy gets power.

    Thanks for pointing me in the right direction.

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,098
    You are welcome! Glad I took the time to find that post from last year - and it was relevant to the issue.

    I didn't check if that info was linked or posted to the 'DIY Bootloader chip' page like some others details are? Paul made a nice startup image sequence for the 1062 chips - it is mentioned or linked there?

    Post back if not and maybe Paul can add ...

  6. #6
    Yes, the link to the boot loader page was there. There is a great JavaScript animation that shows the steps to powering up the T4 with a schematic overlay. Very cool way to illustrate what is going on. Here is the link for future travelers:

    https://www.pjrc.com/store/ic_mkl02_t4.html

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,098
    I was hoping the link found in post #2 was there - but I didn't see it - so added a note at Web-site-could-use-a-few-updates

Posting Permissions

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