Hi there,
I've been struggling with this for quite some time now so hope someone might have an idea;
I have a Teensy 4.0 hooked up with some RX/TX pins (Hardwareserial) through an FTDI converter into a Raspberry pi 4. Communication from the Teensy 4.0 to the Raspberry Pi 4 seem fine. Communication also seems fine when I use my laptop (macbook pro) to send serial commands to the Teensy over this FTDI connection by using this software called 'CoolTerm'.
Though when I hook up the Teensy and Raspberry Pi together the communication TO the Teensy (Raspberry Pi -> Teensy) seems to halt untill the Raspberry Pi programme stops and everything seems to come in as one big dump of data. Feel like I'm missing something that might be obvious to some of you.
I've got a lot of code running but here is at least the bit that runs the serial read-in; (Some Serial.prints for me to read out whats happening).
I've been struggling with this for quite some time now so hope someone might have an idea;
I have a Teensy 4.0 hooked up with some RX/TX pins (Hardwareserial) through an FTDI converter into a Raspberry pi 4. Communication from the Teensy 4.0 to the Raspberry Pi 4 seem fine. Communication also seems fine when I use my laptop (macbook pro) to send serial commands to the Teensy over this FTDI connection by using this software called 'CoolTerm'.
Though when I hook up the Teensy and Raspberry Pi together the communication TO the Teensy (Raspberry Pi -> Teensy) seems to halt untill the Raspberry Pi programme stops and everything seems to come in as one big dump of data. Feel like I'm missing something that might be obvious to some of you.
I've got a lot of code running but here is at least the bit that runs the serial read-in; (Some Serial.prints for me to read out whats happening).
Code:
void Comm::retrieve(HardwareSerial& serial, char* buffer, char* temp_buffer, unsigned int& buffer_index) {
// Code heavily based on; [url]https://forum.arduino.cc/index.php?topic=396450.0[/url]
while (serial.available() != 0) {
Serial.print("retrieve serial");
char rc = serial.read();
Serial.print(rc);
if (rcInProgress == true) {
if (rc != endMarker) {
buffer[buffer_index] = rc;
buffer_index++;
if (buffer_index >= 128) {
buffer_index = 127; // Safety for memory overflow
}
} else {
buffer[buffer_index] = '\0'; // terminate string
rcInProgress = false;
buffer_index = 0;
strcpy(temp_buffer,buffer);
Serial.print(temp_buffer);
parseData(serial,temp_buffer); // Parse data to the right location.
}
} else if (rc == startMarker) {
rcInProgress = true; // Start receiving block of data
}
}
}