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

Thread: Teensy 3.5 RX4-TX4 RX5-TX5 RX6-TX6 pins inverted

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    5

    Teensy 3.5 RX4-TX4 RX5-TX5 RX6-TX6 pins inverted

    Just received my Tennsy 3.5 and I connected my 5 serial sensors on Uart2 to Uart6.
    Started the basic Serial to Serial test, as in the example, and I could not read data on Uart 4 - 5 - 6....
    After some probing, I realized that RX4-TX4 RX5-TX5 RX6-TX6 pins are inverted on the picture card

    Can anyone confirm ?

    Best regards
    Last edited by ppoirier; 12-23-2017 at 01:36 AM.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,444
    Not sure I've physically connected since Beta but ... Seems to match my card in the software it shows this - for the ones that are adjustable, others are hardcoded as needed:

    Code:
    T:\arduino_1.8.5\hardware\teensy\avr\cores\teensy3\serial4.c
    static uint8_t rx_pin_num = 31;
    static uint8_t tx_pin_num = 32;
    Code:
    T:\arduino_1.8.5\hardware\teensy\avr\cores\teensy3\serial5.c
    static uint8_t tx_pin_num = 33;
    Code:
    T:\arduino_1.8.5\hardware\teensy\avr\cores\teensy3\serial6.c
    static uint8_t tx_pin_num = 48;

  3. #3
    Junior Member
    Join Date
    Dec 2017
    Posts
    5
    Yes, I looked at that as well, I am missing the Eagle files to follow the traces, its either something overlooked... or I am getting crazy !!! Both options are plausible

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,444
    If the wires can be adjusted - loop Serial1 RX/TX to those three in turn crossing RX and TX based on the card and write out Serial1 while the Serial[4,5,6] port under test writes out what it reads in. That should then come back to read on Serial1 to print to USB.

    Perhaps the crossing is getting mixed up where "sender A" TX must connect to "receiver B" RX and then the inverse to return data from "receiver B" TX goes to "sender A" RX?

  5. #5
    Junior Member
    Join Date
    Dec 2017
    Posts
    5
    I did a simple ''read only '' test , and RX4-TX4 is still crossmapped
    #define HWSERIAL1 Serial1
    #define HWSERIAL3 Serial3
    #define HWSERIAL4 Serial4

    void setup() {
    HWSERIAL1.begin(115200);
    HWSERIAL3.begin(115200);
    HWSERIAL4.begin(115200);
    }

    void loop() {
    int incomingByte;

    if (HWSERIAL3.available() > 0) {
    incomingByte = HWSERIAL3.read();
    HWSERIAL1.print("UART3 received: ");
    HWSERIAL1.println(incomingByte, DEC);
    }

    if (HWSERIAL4.available() > 0) {
    incomingByte = HWSERIAL4.read();
    HWSERIAL1.print("UART4 received: ");
    HWSERIAL1.println(incomingByte, DEC);
    }
    }

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,444
    Re-did the example to wire Serial1<>3 and Serial2<>4 and worked as labeled on the card.
    Click image for larger version. 

Name:	Serial13_24.jpg 
Views:	13 
Size:	99.3 KB 
ID:	12360
    Output repeats::
    received UART 3: A
    RCV UART 1: A
    recevied UART 4: B
    RCV UART 2: B
    Moved Serial3 wires to Serial5 as on CARD labeled to link Serial1<>5::
    recevied UART 4: B
    RCV UART 2: B
    received UART 5: A
    RCV UART 1: A
    From code:
    Code:
    void setup() {
      Serial1.begin(115200);
      Serial2.begin(115200);
      Serial3.begin(115200);
      Serial4.begin(115200);
      Serial5.begin(115200);
    }
    
    void loop() {
      int incomingByte;
    
      if ( !(millis() % 1000 ) ) Serial1.print( 'A' );
      if ( !((millis() + 500) % 1000 ) ) Serial2.print( 'B' );
      delay(1);
      if (Serial1.available() > 0) {
        incomingByte = Serial1.read();
        Serial.print("RCV UART 1: ");
        Serial.println((char)incomingByte);
      }
    
      if (Serial2.available() > 0) {
        incomingByte = Serial2.read();
        Serial.print("RCV UART 2: ");
        Serial.println((char)incomingByte);
      }
    
      if (Serial3.available() > 0) {
        incomingByte = Serial3.read();
        Serial.print("received UART 3: ");
        Serial.println((char)incomingByte);
        Serial3.print((char)incomingByte);
      }
     if (Serial5.available() > 0) {
        incomingByte = Serial5.read();
        Serial.print("received UART 5: ");
        Serial.println((char)incomingByte);
        Serial5.print((char)incomingByte);
      }
    
      if (Serial4.available() > 0) {
        incomingByte = Serial4.read();
        Serial.print("recevied UART 4: ");
        Serial.println((char)incomingByte);
        Serial4.print((char)incomingByte);
      }
    }

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,628
    I ran the test code here too. Everything seems to be working properly with the wires connected as documented on the card.

    Click image for larger version. 

Name:	sc.png 
Views:	15 
Size:	206.5 KB 
ID:	12361
    (click for full size)

    Click image for larger version. 

Name:	DSC_0875_web.jpg 
Views:	19 
Size:	178.0 KB 
ID:	12362
    (click for full size)

    Hopefully you can clearly see in this photo how I connected the wires for all 3 ports.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,444
    Good, BTW - mine was T_3.6 - which of course uses the same PCB. And my altered code loops back to sender using the same port so both RX and TX are confirmed for #3, #4, #5 and of course #1 and #2.

  9. #9
    Junior Member
    Join Date
    Dec 2017
    Posts
    5
    Well, there is something wrong in my setup, and I will have to find out.
    I the meantime I will continue to develop my prototype with my awkward cable routing.

    I want to thank you very much for your excellent support

    Here is a picture of my prototype, basically its reading 5 laser TOF rangefinders and
    transmit data over serial to ArduPilot as it is used for avoidance on a quadcopter.

    Please note that I rerouted Uart6 on pins 35-36 (cut the runs and jump wired) to make it easier to interconnect.

    Click image for larger version. 

Name:	POC_MINI.jpg 
Views:	22 
Size:	179.4 KB 
ID:	12363

  10. #10
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,444
    Colors seem about right if the rangefinders are wired the same internally. You could swap the plugs and test or pull the wires from the Teensy and test like in my p#6 sketch/setup

  11. #11
    Junior Member
    Join Date
    Dec 2017
    Posts
    5
    I found the error, its hard to see on picture but Uart 2 & 3 where offset by a pin making all my logic fail because I was just looking at RX
    So its back to normal...

    Case closed , thanks again for your support

Posting Permissions

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