Logic level converter for teensy 3.6

Status
Not open for further replies.

Nader

Member
Hello everyone,

Sorry if this is a dummy question but I have noticed that my LED strip (Ws2812b) is behaving in a weird way when uploading a standard code (mainly in FastLed library).
So a friend here suggested that I use a level logic converter (3.3v to 5v logic conversion) for the data pin that is going through to the LED strip. Can someone please direct me to a compatible converter with teensy 3.6.

Any help is appreciated!
 
Last edited:
Hello everyone,

Sorry if this is a dummy question but I have noticed that my LED strip (Ws2812b) is behaving in a weird way when uploading a standard code (mainly in FastLed library).
So a friend here suggested that I use a level logic converter (3.3v to 5v logic conversion) for the data pin that is going through to the LED strip. Can someone please direct me to a compatible converter with teensy 3.6.

Any help is appreciated!

In a previous post, I mentioned the Adafruit best practices page for Ws2812b LEDs (what Adafruit calls Neopixels). In that page is a link to the 74AHCT125 that is fast enough for ws2812b LEDs (most level converters meant for things like i2c levels are not fast enough):
 
IIRC it is fully compatible - except if the DAC is used to feed the amp for audio output as the pin moved. It is Teensy LC compatible - I know I used it there and on T_3.1 during Prop Shield Beta - so it only has 3.3V touching the Teensy and from the full page with Pin Table you can confirm the connected control I/O are still in the proper positions.

[@Paul] - Though the linked page and the Full Prop_shield page do not indicate it is or is not which would be a helpful note to address such questions.
 
Thank you Michael for the quick response!
It looks like i will get the 74AHCT125.
Also a quick question, if I build a small step-up level shifter (3.3v to 5v) using resistors and diodes, would that be good speed wise?
Something similar to this if you scroll down a little bit:

https://hackaday.com/2016/12/05/tak...and-5v-logic-communicate-with-level-shifters/

I would imagine that would be too slow. Paul S. has generally said 'naive' level shifters made of resistors and diodes normally is not fast enough. The issue with the ws2812b is it has a very precise timing window that you have to hit. This allows it to omit the 2nd data wire for clocking like the APA102/dotstar LEDs use. But it also causes all of the problems with interrupts.

Thanks defragster! Is that shield compatible with teensy 3.6?

As defragster says, the position of the back 5 pins (on the 3.2: DAC, program, ground, 3.3v, and Vbat) has moved in the 3.5/3.6. The only pin of those 5 pins that the prop shields really care about the DAC pin for producing mono sound. If you care about sound, you can easily snake a wire from A21 (DAC0) to the pin on the prop shield. Also remember if you are mounting the prop shield on top, you probably need to snake out the 'program' wire so you can connect it to ground if you need to physically get the board into program mode.

The other pins the prop shield uses all have the same position in the 3.5/3.6.

Note, if you have SPI display(s), SPI uses pins 11/13 and does advanced SPI operations, you have to be care to properly stop the display, enable the prop shield, do the ws2812b/apa102 LEDS, disable the prop shield, and re-enable the SPI. This involves some amount of port configuration. I had asked about previously, and KurtE replied with the configuration:

Here is a fragment of the code that I did when I tested it with a 3.2 (I don't currently do both ws2812b and OLED/TFT displays at present). Note, I only use Adafruit_Neopixel, so you may need to dig into FastLED to see if there are other things that are needed. Or just don't use SPI displays:

Code:
#ifdef SPI_HAS_TRANSACTION

// Return true if the pin is one of the special SPI0 pins for ouptut
static inline bool
is_spi0_pin (Neopixel_pin_t pin)
{
  if (pin < 0)
    return false;

#ifdef PROCESSOR_TEENSY_3_X
  switch (pin)
    {
    default:
      break;

#if PROCESSOR_TEENSY_3_5 || PROCESSOR_TEENSY_3_6
    case 27:			// 3.5/3.6 alternate SCLK0
    case 28:			// 3.5/3.6 alternate MOSI0
#endif
    case  7:			// alternate MOSI0
    case 11:			// normal MOSI0
    case 13:			// normal SCLK
    case 14:			// alternate SCLK
      return true;
    }
#endif

  return false;
}

#endif

// display the pixels and possibly blink the LED

void
Neopixel_object::show (void)
{
  if (lowlevel)
    {
#ifdef SPI_HAS_TRANSACTION
      bool pin_spi_p  = do_spi_reserve && is_spi0_pin (pin_neopixel);
      bool pin2_spi_p = do_spi_reserve && is_spi0_pin (pin_neopixel2);

      if (do_spi_reserve)
	{
	  // beginTransaction prevents SPI bus conflicts
	  // We need to reset 11 & 13 to being digital pins
	  // https://forum.pjrc.com/threads/46640-Neopixels-with-SPI-transactions-on-prop-shield-working-with-ST7735-SSD1351-displays
	  SPI.beginTransaction (SPISettings(24000000, MSBFIRST, SPI_MODE0));

	  if (pin_spi_p)
	    pinMode (pin_neopixel, OUTPUT);

	  if (pin2_spi_p)
	    pinMode (pin_neopixel2, OUTPUT);

	  // Doing uncanny eyes, we need a slight delay after doing the beingTransaction so that the first LED doesn't glitch
	  if (do_spi_delay)
	    delay (do_spi_delay);
	}
#endif

      if (pin_enable >= 0)
	digitalWrite (pin_enable, HIGH);

      lowlevel->show ();

      if (do_blink)
	blink ();

      if (pin_enable >= 0)
	digitalWrite (pin_enable, LOW);

#ifdef SPI_HAS_TRANSACTION
      if (do_spi_reserve)
	{
	  // allow other libs to use SPI again
	  SPI.endTransaction ();

#ifdef PROCESSOR_TEENSY_3_X
	  if (pin_spi_p)
	    {
	      volatile uint32_t *reg = portConfigRegister (pin_neopixel);
	      *reg = PORT_PCR_MUX (2);
	    }

	  if (pin2_spi_p)
	    {
	      volatile uint32_t *reg = portConfigRegister (pin_neopixel2);
	      *reg = PORT_PCR_MUX (2);
	    }
#endif

	}
#endif
    }
  else
    abort_with_message ("Neopixel_object::show, no lowlevel neopixel");
}

Some time ago, FrankB designed a PCB that converted the pinout for 3.6/3.5 to 3.2 for shields like the prop shield that used the back 5 pins. He also put holes in the front for the 4 inner pins (Vusb, Aref, A10, A11) that the prop shield doesn't allow for in case you wanted access to those pins as well:

One other note is the prop shield extends beyond the classic Teensy 3.2 size, adding the breakout pins for Agnd/sound +/sound -/VIN in the front and VIN/ground/11/13 in the back. You need to plan your prop shield to be high enough so you can access the pins in the back.

At the moment, I'm in fact about to solder up a stack with the Adafruit Teensy -> Feather adapter, Prop shield, and the FrankB PCB to sit on top of either a 3.2 or the 3.6 I just added stacking headers to. However, like most of my soldering projects, it goes in fits and spurts.
 
Status
Not open for further replies.
Back
Top