Hi guys.
I posted a thread before about this issue I have, for some reason I am posting another one with more details.
So basically I have this DTV and I want to connect to my teensy usb host to be able to receive and send data and see this data traffic in general. I connected it physically to teensy's usb host port. I also extracted some information about DTV like its PID, VID with usb tree view. Then I programmed my teensy with this sketch which is very similar to one of the examples of USBHost_t36 (USB to USBHost example if I'm not mistaken):
The issue I'm facing is that I can write to this device, but can't read from it!
In Serial Monitor, I only see "write successful!" and there's no "read successful!".
What could possibly be the reason? To be honest I don't understand much about this type of communication since it's a vendor specific device and perhaps not very straightforward to work with.
I appreciate your help <3
I posted a thread before about this issue I have, for some reason I am posting another one with more details.
So basically I have this DTV and I want to connect to my teensy usb host to be able to receive and send data and see this data traffic in general. I connected it physically to teensy's usb host port. I also extracted some information about DTV like its PID, VID with usb tree view. Then I programmed my teensy with this sketch which is very similar to one of the examples of USBHost_t36 (USB to USBHost example if I'm not mistaken):
Code:
#include <USBHost_t36.h>
#define BAUD 115200
uint32_t format = USBHOST_SERIAL_8N1;
USBHost myusb;
USBSerial_BigBuffer userial(myusb, 1, 0xPID, 0xVID, USBSerialBase::CP210X, 0); // types: FTDI, PL2303, CH341, CP210X
char buffer[512];
char mybuffer[512] = "some dummy data";
void setup() {
myusb.begin();
userial.begin(BAUD);
Serial.begin(BAUD);
Serial.println("setup completed.");
}
void loop() {
myusb.Task();
uint16_t rd, wr, n;
// write to usb host
wr = userial.availableForWrite();
if (wr > 0){
userial.write(mybuffer, sizeof(mybuffer));
Serial.println("write successful!");
}
else{
Serial.println("userial not available");
}
// read from usb host
rd = userial.available();
if (rd > 0) {
Serial.println("usb host available");
n = userial.readBytes((char *)buffer, rd);
Serial.println((char *)buffer);
// check if the USB virtual serial port is ready to transmit
wr = Serial.availableForWrite();
if (wr > 0) {
if (rd > wr) rd = wr;
if (rd > 80) rd = 80;
// read data from the USB host serial port
n = userial.readBytes((char *)buffer, rd);
Serial.println("read successful!");
}
}
}
The issue I'm facing is that I can write to this device, but can't read from it!
In Serial Monitor, I only see "write successful!" and there's no "read successful!".
What could possibly be the reason? To be honest I don't understand much about this type of communication since it's a vendor specific device and perhaps not very straightforward to work with.
I appreciate your help <3