Adding "Real-time Systems" Custom USB-Type

mhaekal

Member
Hello,
I have a task of migrating a project from Teensy 3.0 to Teensy 4.0 and unfortunately I could no longer use the same IDE 1.0.5 for Teensy 4.0 (Or is there actually a way to add Teensy 4.0 board to this IDE version). I would like to add the same custom USB-type "Real-time Systems" from Tools options in IDE 1.8.15 which i have installed for Teensy 4.0. Any idea how to do this?

FDEDDC64-6FCA-4D1C-8F55-AE6589F03366.jpg

Screenshot from 2024-03-26 15-23-42.png

Screenshot from 2024-03-26 15-22-27.png

Thanks in advance for your support
 
Sorry, I am pretty sure there will likely not be support to run on Arduino 1.0.5 with any version of Teensyduino that supports the Teensy 4.x boards.
Sorry. I personally have no idea what the Real Time System Custom USB is or was? Maybe others do? So if possible you may want to post more information about it and/or what it is you are actually trying to do. Then hopefully someone can point you into the right direction.
 
Arduino IDE 1.8.5 is the oldest supported. But the IDE version probably isn't your main challenge. If you have code which was written for the Teensy 3.0 hardware, porting to Teensy 4.0 means rewriting the low-level USB code which actually transmit and receives from the hardware's endpoints.

As far as the USB code is concerned, Arduino IDE 1.0.5 and 1.8.5 and even the latest 2.3.2 are all pretty much the same. They just run the C compiler with a -D define depending on which Tools > USB Type option was chosen.

The main difference is the USB hardware in Teensy 4.0 is quite different than the hardware in prior Teensy models. It does much more of the USB protocol in the hardware, taking directions at the transfer level rather than the token level (though you can of course do transfers which end up being only 1 token). The RAM2 memory in Teensy 4.0 is cached, which adds another detail to get right that didn't exist in earlier chips, though you can allocate your buffers in RAM1 if you want to side-step that work. Also a minor detail in Teensy 4.0 is support for 480 Mbit speed. At the very least is means 2 copies of your custom descriptors. If using USB bulk endpoints, and if you care about standards compliance, it also means 512 byte max packet size rather than only 64 bytes.

Those should be the "real" issues porting USB driver code. Which IDE runs the compiler ought to be pretty minor by comparison.
 
Sorry, I am pretty sure there will likely not be support to run on Arduino 1.0.5 with any version of Teensyduino that supports the Teensy 4.x boards.
Sorry. I personally have no idea what the Real Time System Custom USB is or was? Maybe others do? So if possible you may want to post more information about it and/or what it is you are actually trying to do. Then hopefully someone can point you into the right direction.
The idea is to write a firmware for a simple USB driver application on a Teensy device. The application is simply to read inputs from I/O (potentiometer or button) or writing outputs to LEDs. I am pretty sure this Real-time System option type was added into Arduino IDE 1.0.5, I just need to know how it was added or if anyone ever done adding a type in Tools -> USB-Type.
 
Arduino IDE 1.8.5 is the oldest supported. But the IDE version probably isn't your main challenge. If you have code which was written for the Teensy 3.0 hardware, porting to Teensy 4.0 means rewriting the low-level USB code which actually transmit and receives from the hardware's endpoints.

As far as the USB code is concerned, Arduino IDE 1.0.5 and 1.8.5 and even the latest 2.3.2 are all pretty much the same. They just run the C compiler with a -D define depending on which Tools > USB Type option was chosen.

The main difference is the USB hardware in Teensy 4.0 is quite different than the hardware in prior Teensy models. It does much more of the USB protocol in the hardware, taking directions at the transfer level rather than the token level (though you can of course do transfers which end up being only 1 token). The RAM2 memory in Teensy 4.0 is cached, which adds another detail to get right that didn't exist in earlier chips, though you can allocate your buffers in RAM1 if you want to side-step that work. Also a minor detail in Teensy 4.0 is support for 480 Mbit speed. At the very least is means 2 copies of your custom descriptors. If using USB bulk endpoints, and if you care about standards compliance, it also means 512 byte max packet size rather than only 64 bytes.

Those should be the "real" issues porting USB driver code. Which IDE runs the compiler ought to be pretty minor by comparison.
Do you have a suggestion on how to port USB driver using the available USB type in Arduino IDE 1.8.5? I tried using Serial USB type and modified the usb_desc.c & usb_desc.h with parameter values from the "Real-time Systems" USB descriptors configuration as above but it hasn't been working so far
 
I am pretty sure this Real-time System option type was added into Arduino IDE 1.0.5, I just need to know how it was added or if anyone ever done adding a type in Tools -> USB-Type.
Sorry, again at least for me it is really hard to tell. The only thing that Arduino 1.0.5 tells me, was it was done a long time ago. A more meaningful indicator might be what version of Teensyduino, but not by much. The USB types are part of the Teensy install...

At a higher level, you probably need to better understand/explain the actual communications done over USB... That is, there are several other USB types that maybe read things like potentiometer or buttons and send them to the host. Things, like keyboards, mice, joystick, game controller, ...
Some of them receive data back from the host and maybe turn on/off leds, like the keyboard.... Several of these devices I mention are HID (Human Interface Devices), where there is a descriptor that describes the data... If so you can probably model it after one of these... Does it only communicate through data sent over data endpoints or is some done over the control...

Do you have sources for the T3.x version from long ago? If so that should give a lot more hints.
And/or do you have a device with the T3.x stuff on it? If so maybe you can plug it into something like a Linux computer and look at the
the stuff from commands that for example show what the journalctl sees when plugged in, usb device info command...

And/or you have a T4.x setup that you can setup with USB Host stuff, you could try running the HID Device info sketch and see if it finds anything.
Likewise turn on debug output within the header file for the USBHost code and it will show additional info...

Sorry not much help.
 
I'm guessing you're dealing with code someone else wrote on this PC?

If so, please first make sure you have backup copies of all the files. Especially if the PC you're using has the only (very old) copy of the working (with Arduino IDE 1.0.5) code, you definitely don't want to lose that know-good code.
 
I'm guessing you're dealing with code someone else wrote on this PC?

If so, please first make sure you have backup copies of all the files. Especially if the PC you're using has the only (very old) copy of the working (with Arduino IDE 1.0.5) code, you definitely don't want to lose that know-good code.
Yes, I was given an old copy of the whole Arduino 1.0.5 folder & Teensy 3.0 device and was given a task to make it work on Teensy 4.0. Don't worry, backup is safe on cloud and I also only made changes on files in Arduino 1.8.15 folder which I created/installed myself.
 
Quick update: I managed to run it on Teensy 3.0 using IDE 1.8.15 with Serial USB Type. I copied the read_cmd & write_cmd function into wiring.h file and create the request & requestType cases on usb_dev.c file on cores/teensy3 folder.
usb_dev.png

Now I just need to do the same on teensy4 but I couldn't find usb_dev.c file on cores/teensy4 folder. Any idea why? Is it available under another file?
 
Back
Top