I'm trying to write a RAWHID program to connect a Windows10 tablet to a TeensyLC.
I've done it successfully for both a Teensy 2.0 and Teensy 2.0+.
But the TeensyLC doesn't work.
There is an old RAWHID example under the Teensy->Code Library tab.
It lists the "Teensy Side Functions" as:
void usb_init(void);
uint8_t usb_configured(void);
int8_t usb_rawhid_recv(uint8_t *buffer, uint8_t timeout);
int8_t usb_rawhid_send(const uint8_t *buffer, uint8_t timeout);
Before getting fancy...I'm just trying to get a simple "send" and "receive" program to work.
The TensyLC will sit in a "while loop"...waiting to receive a packet from the tablet.
The Tablet will sent the first packet.
The TeensyLC will receive it and immediately send it back.
The Tablet will receive it and immediately send it back.
Each USB packet the tablet sees will print out on a log file.
No lines are printing.
We should see approximately 500 packets going to the TeensyLC and 500 packets going to the Tablet per second.
Here's the source:
I'm getting errors in compiling...
The compiler doesn't recognize usb_init() and usb_configured()....they are undefined.
But, the compiler does recognize usb_rawhid_recv() and usb_rawhid_send().
I'm using Visual Micro to compile and am using the "USB HID" USB Type.
When the board gets plugged in it already has a RAWHID Session...so I guess usb_init() might not be necessary.
If I comment out the two lines with errors, the code itself still doesn't work
Any help would be appreciated...
Jim K.
PS.
I'm pretty sure it has to do with USB Enumeration.
Looks like the RAWHID USB type has more than HID.
I have a program the lists all the USB devices.
I see something pointing to the usbccgp.sys....and two things pointing to hidusub.sys.
These are all coming from the TeensyLC with the VendorID of 16c0....and the ProductID of 0486.
I've done it successfully for both a Teensy 2.0 and Teensy 2.0+.
But the TeensyLC doesn't work.
There is an old RAWHID example under the Teensy->Code Library tab.
It lists the "Teensy Side Functions" as:
void usb_init(void);
uint8_t usb_configured(void);
int8_t usb_rawhid_recv(uint8_t *buffer, uint8_t timeout);
int8_t usb_rawhid_send(const uint8_t *buffer, uint8_t timeout);
Before getting fancy...I'm just trying to get a simple "send" and "receive" program to work.
The TensyLC will sit in a "while loop"...waiting to receive a packet from the tablet.
The Tablet will sent the first packet.
The TeensyLC will receive it and immediately send it back.
The Tablet will receive it and immediately send it back.
Each USB packet the tablet sees will print out on a log file.
No lines are printing.
We should see approximately 500 packets going to the TeensyLC and 500 packets going to the Tablet per second.
Here's the source:
I'm getting errors in compiling...
The compiler doesn't recognize usb_init() and usb_configured()....they are undefined.
But, the compiler does recognize usb_rawhid_recv() and usb_rawhid_send().
Code:
byte buffer[64];
int count = 0x00;
byte ping = 1;
void setup()
{
usb_init(); //THIS FUNCTION THROWS AND UNDEFINED COMPILER ERROR
pinMode(LED_BUILTIN, OUTPUT);
for (int i = 0; i < 64; i++)
{
buffer[i] = count;
count++;
}
while (usb_configured() != 1); //THIS FUNCTION THROWS AND UNDEFINED COMPILER ERROR
digitalWrite(LED_BUILTIN, HIGH);
}
void loop()
{
while(usb_rawhid_recv(buffer, 100) == 0);
usb_rawhid_send(buffer, 100);
}
I'm using Visual Micro to compile and am using the "USB HID" USB Type.
When the board gets plugged in it already has a RAWHID Session...so I guess usb_init() might not be necessary.
If I comment out the two lines with errors, the code itself still doesn't work
Any help would be appreciated...
Jim K.
PS.
I'm pretty sure it has to do with USB Enumeration.
Looks like the RAWHID USB type has more than HID.
I have a program the lists all the USB devices.
I see something pointing to the usbccgp.sys....and two things pointing to hidusub.sys.
These are all coming from the TeensyLC with the VendorID of 16c0....and the ProductID of 0486.
Last edited: