Experienced? A little more by trial and error.
As I mentioned, I am shooting stuff out here with my eyes closed. i.e. have no clue what your device is doing or expecting.
Also you talk both about USB and Hardware Serial? So how is this device Actually connected up to a PC?
Again are you a) trying to emulate the device and/or b) you wish to intercept and update and or log the data?
Again have you plugged the device into a PC and know which device drivers it is using? Something standard like the Teensy uses. Like on my Windows 10 machine a Teensy shows up as: USB Serial Device, driver by Microsoft, with driver details, shows it using ...\windows\system32\DRIVERS\usbser.sys
i.e. generic...
But if I for example plug in a FTDI USB to serial adapter and look at device manager it shows Driver Provider: FTDI
And it shows maybe 4 drivers under details...
Does your device show up the same or does it potentially have either some other drivers?
If it is a standard Serial device CDC_ACM, and you plug in your teensy and tell your PC to use the teensy Serial port. What does it do? Does it send out a packet to the device?
If it were me, one of the first things I would do is to see if I could do a quick and dirty dump of the data coming from the PC?
I would probably plug in the teensy and hex dump everything it receives maybe with some form of time stamps... I would probably dump it out to some other Hardware Serial port like Serial1, and then hook up Serial1 back to my PC with one of my USB to Serial adapters...
i.e. something like:
Code:
void setup() {
Serial1.begin(2000000); // whatever speed your usb to serial device can handle...
while (!Serial && millis() < 5000) ; // wait up to 5 seconds for monitor to open...
Serial.begin(115200);
}
void loop() {
if (Serial.available()) {
Serial1.printf("\nT:%u: Baud:%d num bits: %d Parity: %d Stop:%d \n", uint32_t millis(), Serial.baud(), Serial.numbits(), Serial.paritytype(), Serial.stopbits()); // might use micros if not enough resolution...
uint8_t cnt=0;
int ch;
while ((ch=Serial.read() != -1) {
Serial1.printf(" 02x", ch);
if (!(++cnt &0xf) Serial1.println();
}
Serial1.println();
}
}
Again really lame, typed in on the fly, so probably has bugs, but would start to get an idea of what the host is sending...
Also a little about timings and bauds and ...
Then depending on what I saw there, would dictate what I would do next.
But again, we are just guessing in the dark