Teensy 3.2 dual power (UBS & External) with I2C LCD display initialisation issues

Status
Not open for further replies.

dzalf

Member
Dear Teensy community colleagues

Let me try to explain the issue I am facing at the moment in the most succinct way possible.

I am working on a project that will be powered by both USB (when debugging the system via serial port) and standalone using an external power source.

My project consists on the control of a pair of stepper motors via an analog joystick. It includes an I2C LCD display powered by the common +5V rail that feeds other active components (including the +5V rails from the stepper drivers).

I've followed all the recommendations from this forum regarding cutting the trace between VUSB and VIN and adding the two diodes (normal rectifiers in my case - for now-). The system works as expected (kinda...) if I power up the board using the external source, however here are some compromises after doing this:

1. If I use the USB cable attempting to debug the system, the I2C LCD won't turn on, for obvious reasons. The diode feeding the Teensy blocks the voltage that feeds the rest of the components, namely, the +5V rail. This means that basically only the Teensy is powering on when doing this BUT in addition to the LCD not turning on, the serial port won't receive any data under this condition. I must clarify that this is the ONLY case when I am capable of programming the Teensy without pressing the button.

2. When I plug in my power supply (leaving the USB plugged-in), then the serial port reports some expected info and everything seems to work "normally" (not quite true*. Bare with me...). Under this condition the I2C LCD shows ONLY black washed-off boxes but the system in general works "ok-ish", as I mentioned earlier.

3. If I ONLY power the system on through the external power supply, naturally the whole system works as expected without any problems but I don't have serial communication available for debugging purposes.

*The reason the system does not operate under normal conditions is that my particular application strongly depends on the ADCs: if I am under scenario No. 2 and I unplug the USB, the motors start randomly moving. My assumption is that the supply voltage changes thus affecting the analog references and the system "thinks" that I am moving the controller (Joystick).

Is there any way to have both USB and external power connected so that the I2C display responds normally and I am able to debug a normally operating system via serial port.

I believe that the reason why the I2C LCD is not turning on is for timing reasons. Clearly the MCU starts sending both SDA and SCL pulses before the LCD even turns on. I was thinking including a feature of powering on the whole system upon USB connection. A MOSFET that turns on when the USB cable is connected and switches the +5V rail at the same time. However my crappy solution will make the system entirely dependant on the USB connection. Nonetheless, a series of basic logic gates (OR) might do the trick...(perhaps)

Any help will be very much appreciated

Please do not hesitate to ask me any further questions in case my explanation was absolutely confusing

dzalf

P.S. I have the feeling that the solution might be trivial but I wanted to share my experience ;)

P.S.2 Sorry for the typo on the title :eek:
 
Last edited:
You can disconnect the USB power from the Teensy by cutting the solder pad underneath the Teensy. It is the solder pad next to the VIN (5v) pin (see the back of your Teensy card). Then the Teensy will only be powered either by external power to the 5v pin or external power to the 3.3v pin.

This means you have choices when you program the Teensy:
  • You can install a header for the VUSB pin (inside pin next to the analog/normal ground pin between VIN and 3.3v pins), and when you are powering the Teensy via USB only, attach the jumper to VIN;
  • You can supply external 5v power when you program the Teensy; (or)
  • You could set up a pair of diodes, so if there is external power, it uses the external power, and if not it uses the USB power.

Here is a post from 2013 that describes the procedure:

Instead of cutting the solder jumper pad, I've seen some people cut up a USB cable to not provide power, but connect all of the other pins. If you don't want to cut up a USB cable, you could use this product instead:
 
Dear Michael

Thank you very much for your response

I indeed followed the instructions for connecting the diodes, however I am not particularly pleased with the results. For now I just left VIN and VUSB separated without any diodes and I expect to program the board every time with an external PS.

Your link was of great help ;)

If I find any other option I will let you know.

Have a great Sunday

Cheers

dzalf
 
Status
Not open for further replies.
Back
Top