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

Thread: Teensy 3.6's pin 4 has slightly different electrical characteristics?

  1. #1
    Junior Member
    Join Date
    Apr 2019

    Teensy 3.6's pin 4 has slightly different electrical characteristics?

    I'm building a device which will allow a teensy 3.6 to control a dot-matrix LED sign that I scavenged from a public transportation bus.

    Here's a rough schematic I made to illustrate the way that the sign works. It's not completely filled in, but I think that for my question only the left two or three columns are very important:

    And here's a schematic for two PCBs I'm designing to control the sign:

    The driver board on the right is what I think is important here.

    Here's my conundrum: BOTSIG and TOPSIG both go directly from the Teensy's ArduinoPin4 and AP5 to non-inverting inputs of some comparators. I use a voltage divider to feed about 1.5 volts to the inverting inputs of those comparators. By my understanding of things, that basically means that the comparators are giving out 5V when TOPSIG and BOTSIG are above 1.5V, and that they're giving 0V otherwise. But when I try this out on my breadboard, I don't get that result.

    What happens instead is that the TOPSIG comparator behaves in the way I just described but the BOTSIG comparator is always sending out ground. In order to get the BOTSIG comparator to reflect the changes of the BOTSIG pin, I need to lower the bias voltage down to about .5V. What's even stranger is that if I move BOTSIG to AP8 (both physically and in the code), it works out perfectly and the comparators are back do doing their 3v3-5v level shifting.

    What exactly is going on here? Does pin 4 on the Teensy 3.6 have a really slightly different output impedance than all the other pins?

    (I was worried that it was just damaged hardware, so I tried swapping out the Teensy for another 3.6. Same result. I also tried swapping out the sign with another, identical one. Same result.)

    If it matters, I'm programming this with Arduino.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Not ever heard any of the pins with the same functional notes have altered function.

    Is AP8 Digital pin #22 or Analog Pin #8? In that case yes, a pin with analog function [ LIGHT orange label number with "A" and digit ] will support ANALOG readings, and those without that indication - like pin #4 is digital only, and PWM output capability and the other two noted functions on the card.

    If that doesn't get to the question - post code that shows the issue - how the pins are setup and used.

  3. #3
    Junior Member
    Join Date
    Apr 2019
    Sorry, I should explain; I'm referring to Arduino Pin 8, or the pin that digitalWrite(8,HIGH) would effect. If it's worth mentioning, I'm doing fast writes using PORTD and such (which I know a lot of people on this forum seem to hate).

    The source code is kind of huge, so here's the parts that actually manipulate pins at all:

    #define TBlnkP 2   //blanking lines, raise to enable
    #define BBlnkP 3   //
    #define BSigP 4   //Raise this to send ones to bottom chips
    #define TSigP 5   //Raise this to send ones to top chips
    #define SClkP 6   //Raise this to lower SCLCK on the chips
    #define XLatP 7   //Raise this to lower XLAT on the chips.
    void setup() {
      pinMode(SClkP, OUTPUT);
      pinMode(XLatP, OUTPUT);
      pinMode(TSigP, OUTPUT);
      pinMode(BSigP, OUTPUT);
      pinMode(TBlnkP, OUTPUT);
      pinMode(BBlnkP, OUTPUT);
      digitalWrite(SClkP, LOW);
      digitalWrite(XLatP, LOW);
      digitalWrite(TSigP, LOW);
      digitalWrite(BSigP, LOW);
      digitalWrite(TBlnkP, HIGH);
      digitalWrite(BBlnkP, HIGH);
      msgcol = 0;
    void writeBit(bool tbit, bool bbit) {    
      //possibly raise the signal pins
      if (tbit) PORTD |= _BV(TSigP);
      if (bbit) PORTD |= _BV(BSigP);
      //pulse the clock pin
      PORTD &= ~_BV(SClkP);
      PORTD |= _BV(SClkP);
      //lower the sin pins
      PORTD &= ~(_BV(TSigP) | _BV(BSigP));
    I know that stuff like PORTD |= _BV(SClkP); only works because I'm using the first eight pins and that if SClkP had been defined to pin 16 it would break. It's just more convenient to work with it this way right now.
    Last edited by Guilt; 04-11-2019 at 05:13 PM.

  4. #4
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Germany NRW
    Quote Originally Posted by Guilt View Post
    I'm doing fast writes using PORTD and such (which I know a lot of people on this forum seem to hate).
    You really should not use PORTD - It only exists to make some old sketches written for AVR work. It's a emulation only. If you really want to do it this way, use the corresponding Teensy register!
    AND: If you think the code you wrote is faster than digitalWriteFast you're wrong

      if (tbit) PORTD |= _BV(TSigP);
    This is a read-modify-write: 1. read the register 2. OR 3. write the register. 3 -> cpu cycles minimum!
    Whereas digitalWriteFast(TSigP,1) is one cycle.
    (not counted the address-loads in both cases)

Posting Permissions

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