Serial Input Not As Expecting

Status
Not open for further replies.

brs480

New member
I'm trying to setup the Etherkey sketch (emulates USB keyboard from serial input) on a Teensy 4.1 and I'm running the usb-serial-echo to get started:

#define HWSERIAL Serial1

#define PRNT_BUFFSZ 80

char inChar;
char prnt_buff[PRNT_BUFFSZ];

void setup() {
Serial.begin(115200);
HWSERIAL.begin(115200);
}

void loop() {
if (Serial.available() > 0) {
inChar = Serial.read();
snprintf(prnt_buff, PRNT_BUFFSZ, "USB recv -> Keycode: %i\tCharacter: %c", inChar, inChar);
Serial.println(prnt_buff);
HWSERIAL.println(prnt_buff);
}
if (HWSERIAL.available() > 0) {
inChar = HWSERIAL.read();
snprintf(prnt_buff, PRNT_BUFFSZ, "UART recv -> Keycode: %i\tCharacter: %c", inChar, inChar);
Serial.println(prnt_buff);
HWSERIAL.println(prnt_buff);
}
}

The Teensy is being fed by a USB to Serial adapter feeding the GND/RX0/RX1 pins at 115.2k. The Teensy is responsive to data being sent, but it's not displaying the characters
that are actually being sent.

abcde <cr> results in this:

UART recv -> Keycode: 77 Character: M
UART recv -> Keycode: 34 Character: "
UART recv -> Keycode: 79 Character: O
UART recv -> Keycode: 39 Character: '
UART recv -> Keycode: 78 Character: N
UART recv -> Keycode: 19 Character:
UART recv -> Keycode: 77 Character: M
UART recv -> Keycode: 38 Character: &
UART recv -> Keycode: 121 Character: y

which doesn't look right to me.
 
Status
Not open for further replies.
Back
Top