Bob Randall
New member
Hello,
I'm new to this forum and have a question on using the Teensy 4.1.
I have a project I am porting from a Cypress PSoC 5LP to the Teensy 4.1 to make use of the much faster Teensy part.
The PSoC part has code which is working. I'm using its USB interface to talk to a Jetson Xavier NX running Linux. This works.
In the Teensy 4.1 project I've configured it to Tools-> USB Type: "Raw HID".
On the Linux board I can run lsusb in a terminal. It lists all the USB devices and does show the Teensy board.
Then I run my program on the Linux board which is written in C++. When that code starts up it opens the USB device (the Teensy) with code that looks like this:
The return value dev is not NULL so it found and opened the device. The next line of code is where the trouble is:
This returns an error and when I print the error text I get
So somehow the Linux system is claiming the Teensy USB. The same code works fine with the PSoC. Why is my Linux system claiming the Teensy but not the PSoC? I've tried changing these in the file "usb_desc.h":
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0486
#define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
#define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
and adjusting the code on the Linux side to match. It finds the device but still gives LIBUSB_ERROR_BUSY
I don't understand enough of the USB to know why this works for the PSoC but not the Teensy.
Can anyone point me to the culprit?
I'm new to this forum and have a question on using the Teensy 4.1.
I have a project I am porting from a Cypress PSoC 5LP to the Teensy 4.1 to make use of the much faster Teensy part.
The PSoC part has code which is working. I'm using its USB interface to talk to a Jetson Xavier NX running Linux. This works.
In the Teensy 4.1 project I've configured it to Tools-> USB Type: "Raw HID".
On the Linux board I can run lsusb in a terminal. It lists all the USB devices and does show the Teensy board.
Then I run my program on the Linux board which is written in C++. When that code starts up it opens the USB device (the Teensy) with code that looks like this:
Code:
dev = libusb_open_device_with_vid_pid(NULL, vendor_id, product_id);
The return value dev is not NULL so it found and opened the device. The next line of code is where the trouble is:
Code:
err = libusb_claim_interface(dev, INTERFACE);
This returns an error and when I print the error text I get
Code:
Error: LIBUSB_ERROR_BUSY
So somehow the Linux system is claiming the Teensy USB. The same code works fine with the PSoC. Why is my Linux system claiming the Teensy but not the PSoC? I've tried changing these in the file "usb_desc.h":
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0486
#define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
#define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
and adjusting the code on the Linux side to match. It finds the device but still gives LIBUSB_ERROR_BUSY
I don't understand enough of the USB to know why this works for the PSoC but not the Teensy.
Can anyone point me to the culprit?