XRAD
Well-known member
Hello, Working on a project using RPLidar C1 tof scanner. BUT FIRST, I am just trying to read simple esp32 'counting' data output on myusb teensy 4.1. I am reading data via Teensy 4.1 myusb from a wroom esp32 dev module. I wired the USB wires to the teensy per teensy instructions. I have tried multiple methods, but I keep getting garbage. The serial output speed on serial'0' (the native USB hardware on ESP32) has to 'eventually' be 460800 for my hardware. Any thoughts?
NOTE: 'eventually' means that the C1 lidar unit runs at 460800 baud and I could not see any data in my Arduino IDE unless both baud rates matched. I have the esp32 C1 lidar working fine on its own and can see all measurements and angles in the arduino IDE.
I have checked the wiring multiple times. USB case ground, internal plug ground, D+(yellow), D- (green), 5v (red). This is my arduino IDE serial output:
�U��M�E��e��E��E��%�A��������%�A%��E��e����������������AE��������������
��M��-���
��
�����-��-��M�m��
�AM�A-��
��
�����-��-��M��������U��5��������5���5��U��u����]��}�����A��A]��=��]�A}���A������A�����������������U�����U��U��U��U����AU������u��u�����u��u��u���u��U�������������������A�A�������A���������������������A����������U�A����5��U�AU�A�������AU�
simple send counter esp32 via USB plug...
and the USB host code on the teensy 4.1:
NOTE: 'eventually' means that the C1 lidar unit runs at 460800 baud and I could not see any data in my Arduino IDE unless both baud rates matched. I have the esp32 C1 lidar working fine on its own and can see all measurements and angles in the arduino IDE.
I have checked the wiring multiple times. USB case ground, internal plug ground, D+(yellow), D- (green), 5v (red). This is my arduino IDE serial output:
�U��M�E��e��E��E��%�A��������%�A%��E��e����������������AE��������������
��M��-���
��
�����-��-��M�m��
�AM�A-��
��
�����-��-��M��������U��5��������5���5��U��u����]��}�����A��A]��=��]�A}���A������A�����������������U�����U��U��U��U����AU������u��u�����u��u��u���u��U�������������������A�A�������A���������������������A����������U�A����5��U�AU�A�������AU�
simple send counter esp32 via USB plug...
Code:
#include <Arduino.h>
int counter = 0;
void setup() {
// Initialize the native USB Serial
Serial.begin(460800);
//Wait 5 seconds for the Serial Monitor to open
while (!Serial && millis() < 5000);
Serial.println("Native USB Serial Initialized!");
}
void loop() {
// Send data to the USB host
Serial.print("Data packet: ");
Serial.println(counter);
counter++;
delay(1000);
}
and the USB host code on the teensy 4.1:
Code:
#include "USBHost_t36.h"
// Initialize USB Host
USBHost myusb;
// USB Serial object for the connected device
USBSerial userial(myusb);
void setup() {
// USB1_PORTSC1 |= USB_PORTSC1_PFSC; // force 12 Mbit/sec
Serial.begin(460800); // Debug to arduino IDE
delay(1000);
// Start USB Host
myusb.begin();
}
void loop() {
myusb.Task(); // Essential: Processes USB events
// Check if ESP32 is connected
if (userial) {
if (userial.available()) {
// Read data from ESP32
char c = userial.read();
Serial.print(c); // Print to debug PC
}
}
}