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

Thread: Serial port on Teensy4.1

  1. #1
    Senior Member
    Join Date
    May 2017
    Location
    Netherlands
    Posts
    121

    Serial port on Teensy4.1

    Hi all,

    In my previous project with a Teensy 3.6 I used Serial port 4 at 2400 baud (Serial.begin(2400); Now I rewrite my program for a Teensy 4.1 and used Serial port 7, Serial7.begin(2400); This is not working ... what can be the problem?

    Please help this is the only thing in my project what is not working.

    Thanks,
    Johan Holstein

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,458
    Quote Originally Posted by pd0lew View Post
    This is not working ... what can be the problem?
    Maybe the wires aren't connected properly? Or maybe there's a mistake somewhere in your program? All it would take is one "Serial4" not changed to "Serial7", sort of like how your message has "Serial.begin(2400)" where you meant "Serial4.begin(2400)".

    One thing I can confirm is not the problem is whether Serial7 works at 2400 baud. I tested it just now, using File > Examples > Teensy > Serial > EchoBoth, with these lines edited:

    Code:
    // set this to the hardware serial port you wish to use
    #define HWSERIAL Serial7
    
    void setup() {
    	Serial.begin(9600);
    	HWSERIAL.begin(2400);
    }
    It definitely works. I ran "seyon" on Linux to talk to the FTDI cable, and the Arduino Serial Monitor to talk to Teensy 4.1. Anything sent from either side appears on both.

    Click image for larger version. 

Name:	serial7.jpg 
Views:	6 
Size:	66.0 KB 
ID:	21232

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,408
    What is not working?
    I did a quick and dirty program that opened Serial7 (pins 28 and 29)
    First I verified that it should be able to create that baud.
    Then I did simple output with counter and saw the data on Logic Analyzer.
    Than added simple loop read and it is echoing...

    So I think it is working

  4. #4
    Senior Member
    Join Date
    May 2017
    Location
    Netherlands
    Posts
    121
    Hi all,

    There where two issues at my place first the level shifter was wrong and second I reversed TX and RX. Everything is working fine now.

    I feel a bit dumm and sorry for bothering the group!

    Thanks for helping!

    Best regards,
    Johan

  5. #5
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,408
    Glad you have it working

Posting Permissions

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