Serial Commnication not worknig?

Status
Not open for further replies.

AdmiralCrunch

Well-known member
Hi

I once got had the communication from Teensy to Raspi working, but since a few days I got back to work on it and it just does not work whatever I try..
So I went now to test it between Teensy 3.2 and Teensy 3.6.

I connected the T3.2 RX0 -> T3.6 TX0
and the T3.2 TX0 -> T3.6 RX0

code for the T3.2 (sending)

Code:
const int ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
  
	Serial.begin(9600);
	Serial1.begin(9600);
}

void loop() {       
	Serial.write("hhh");
	Serial1.write("fff");
      
  digitalWrite(ledPin, HIGH);  
	delay(500);                    
  digitalWrite(ledPin, LOW);    
  delay(500); 
}

on the T3.6 side I simply want the LED blink when something is recieved:
Code:
const int ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial1.begin(9600);  
}

void loop() {
  int incomingByte; 
     
  if (Serial1.available() > 0) {
    incomingByte = Serial.read();
    if(incomingByte != -1) {
      digitalWrite(ledPin, HIGH);   
      delay(500);                  
      digitalWrite(ledPin, LOW);    
      delay(500);    
    }                  
  } 
}

the T3.6 is blinking but nothing on the T3.6 .. why is that? what am I doing wrong?
 
whats the actual pin connections, for serial1 you should be using pins 0 and 1 on both, from 0 to 1 and 1 to 0, and common ground
 
whats the actual pin connections, for serial1 you should be using pins 0 and 1 on both, from 0 to 1 and 1 to 0, and common ground

yes I did wire it that way:

Teensy 3.2 .................. Teensy 3.6
RX0 ------------------------> TX0
TX0 ------------------------> RX0
GND -----------------------> GND
 
Did you really mean
incomingByte = Serial.read();
or
incomingByte = Serial1.read();

?
 
Did you really mean
incomingByte = Serial.read();
or
incomingByte = Serial1.read();

?

oh.. thanks.. now that seems to work now.. on the recieving T 3.6 i println the incoming Byte and something comes in.

now back to the Raspi, still nothing coming in -.- .. I know this is the wrong forum, but maybe someone has experience in raspi, too?

I have Stretch-Lite with Chromium and NodeJS installed. When I do
cat < /dev/ttyAMA0
... nothing.. silence.. but T3.2 is sending ..
 
When serial# testing on Teensy it is easy to wire same port TX <> RX and read back what was written as a self check.

If you can get that working on raspi that might be a good start. Start with short messages and go from there perhaps. Raspi has unique buffering habits based on a recent post ...
 
When serial# testing on Teensy it is easy to wire same port TX <> RX and read back what was written as a self check.

If you can get that working on raspi that might be a good start. Start with short messages and go from there perhaps. Raspi has unique buffering habits based on a recent post ...

yes I got that working with two tennsys now, but raspi just wont read anythig :(

the curious thing about it is, that I got that wokring a while ago.. I wanted to check out if I can use the Raspi for the displays in my project.. so I got one Raspi 3, installes Stretch-lite and NodeJS, then I got this working.. the Raspi recieved messages from Teensy and output'ed them. Then I stopped working and went to do something else. Now I am back to work on this and .. nothing happens on Raspi..
 
Status
Not open for further replies.
Back
Top