Arduino CLI And IDE now Released - Teensy Supported!

Sad to see #769 got pushed back to rc5. If they still haven't done it by the time we release 1.57, maybe I'll try to communicate with them about it. But from the many other issues, seems they have their hands full.

Do you see any reason to update the experimental package we have already? Without #769, kinda seems like best course is to just wait.

Hard to say. As I know you must have lots of free time :lol:

I would say when we are ready for a new beta build, it would be good thing at that point. For me as long as the stuff I am playing with has a USB type that includes Serial, than you can do most things... Although for major things I still much prefer to build within sublime text.... And I am setup for being able to do Serial with the USB types I have been working on.

One area it might be a good thing to have a new release, is the examples. Two fold:
a) The new IDE was not showing examples with files with extensions .pde... Which I know you recently made a pass through to change all of yours to .ino...

b) The top level Teensy examples do not show up, as you don't have an easy place to hack up this list. As I mentioned in the issue: https://github.com/arduino/arduino-ide/issues/869

I know that the majority of other board types do this, by installing a dummy library, with a name like "Teensy", where they have dummy source file, and then all of their platform specific examples. I hacked up on on my machine which works. Would maybe suggest some special name like start with 0 or the like as to get it to top of sorted list.
 
Hard to say. As I know you must have lots of free time :lol:

I would say when we are ready for a new beta build, it would be good thing at that point. For me as long as the stuff I am playing with has a USB type that includes Serial, than you can do most things... Although for major things I still much prefer to build within sublime text.... And I am setup for being able to do Serial with the USB types I have been working on.

One area it might be a good thing to have a new release, is the examples. Two fold:
a) The new IDE was not showing examples with files with extensions .pde... Which I know you recently made a pass through to change all of yours to .ino...

b) The top level Teensy examples do not show up, as you don't have an easy place to hack up this list. As I mentioned in the issue: https://github.com/arduino/arduino-ide/issues/869

I know that the majority of other board types do this, by installing a dummy library, with a name like "Teensy", where they have dummy source file, and then all of their platform specific examples. I hacked up on on my machine which works. Would maybe suggest some special name like start with 0 or the like as to get it to top of sorted list.

Had a feeling #769 was not going to get incorporated this go around as there is a related PR associated with the release of CLI 1.22.0 but that was just a gut feeling.

Converting library files to .ino from .pde's solve only have the problem, the other issue is associated that it does not handle legacy (1.0) libraries (which we have alot of problem), https://github.com/arduino/arduino-ide/issues/40. Also alot of the other annoying issues that are still open really make it more annoying to use than anything else like
1. having to use CTRL-ENter instead of just enter from the serial monitor.
2. Splash screen issues
3. And most of the issues that Kurt added to there list are still open.
4. If you are creating a blank sketch and close it, the ide doesn't ask if you want to save it first - got me a couple of times.

Again the IDE is usable but.... Hopefully with the release of RC5 alot of these will be fixed.

As for a new experimental package - might be good just to check what was done with the libraries so far as Kurt said as time permits
 
Installed IDE 2 Nightly 15 March ... now a week old.
> As usual building under SublimeText: so, this may be a local install build issue
Building for Locked T_4.1 upload failed as key.pem not found in the sketchbook where it is and has been: "C:\T_Drive\tCode\key.pem"

> Put a copy into: "D:\Tim\documents\Arduino\key.pem"
Rebuild presented properly encrypted eHex and upload worked

It was a simple edit to a recent DMA example with no libraries needed from sketchbook - not sure if it was just PJRC finding pem.key, or IDE command line build confusion with provided paths?

Did confirm IDE 2.0 knows where the sketchbook folder is.
 
I just discovered the latest progress on Teensy-support for arduino-cli. I must say this is great news. Finally an easy way to use my favourite IDE for editing without having to rely on the Arduino IDE for compiling. After fighting with makefiles for a week, it was amazing the get the blink.ino compiled and uploaded to a Teensy in 15 minutes, including installation and setup of arduino-cli. Btw, on the first page instructions, there is one step missing. The command 'arduino-cli core update-index' should be run before 'arduino-cli core install teensy:avr'. This will download the 'package_teensy_index.json'. Otherwise it will just complain about the file missing and not go forward.

I have one question at this point. What is the correct compile flag for different usb-modes for Teensy? For example, what would be the command to run to compile for Teensy 4.1 and set USB to Audio + Midi + Serial? Is there existing documentation on this somewhere that I just could not find?
 
I just discovered the latest progress on Teensy-support for arduino-cli. I must say this is great news. Finally an easy way to use my favourite IDE for editing without having to rely on the Arduino IDE for compiling. After fighting with makefiles for a week, it was amazing the get the blink.ino compiled and uploaded to a Teensy in 15 minutes, including installation and setup of arduino-cli. Btw, on the first page instructions, there is one step missing. The command 'arduino-cli core update-index' should be run before 'arduino-cli core install teensy:avr'. This will download the 'package_teensy_index.json'. Otherwise it will just complain about the file missing and not go forward.

I have one question at this point. What is the correct compile flag for different usb-modes for Teensy? For example, what would be the command to run to compile for Teensy 4.1 and set USB to Audio + Midi + Serial? Is there existing documentation on this somewhere that I just could not find?

Look in the installed boards.txt for the USB menu item listing for the needed #define.
Looks something like this here:
Code:
teensy41.menu.usb.serial=Serial
teensy41.menu.usb.serial.build.usbtype=[B]USB_SERIAL[/B]
teensy41.menu.usb.serial2=Dual Serial
teensy41.menu.usb.serial2.build.usbtype=[B]USB_DUAL_SERIAL[/B]
teensy41.menu.usb.serial3=Triple Serial
teensy41.menu.usb.serial3.build.usbtype=[B]USB_TRIPLE_SERIAL[/B]
teensy41.menu.usb.keyboard=Keyboard
teensy41.menu.usb.keyboard.build.usbtype=[B]USB_KEYBOARDONLY[/B]
teensy41.menu.usb.keyboard.fake_serial=teensy_gateway
teensy41.menu.usb.touch=Keyboard + Touch Screen
teensy41.menu.usb.touch.build.usbtype=USB_TOUCHSCREEN
teensy41.menu.usb.touch.fake_serial=teensy_gateway
teensy41.menu.usb.hidtouch=Keyboard + Mouse + Touch Screen
teensy41.menu.usb.hidtouch.build.usbtype=USB_HID_TOUCHSCREEN
teensy41.menu.usb.hidtouch.fake_serial=teensy_gateway
teensy41.menu.usb.hid=Keyboard + Mouse + Joystick
teensy41.menu.usb.hid.build.usbtype=[B]USB_HID[/B]
teensy41.menu.usb.hid.fake_serial=teensy_gateway
teensy41.menu.usb.serialhid=Serial + Keyboard + Mouse + Joystick
teensy41.menu.usb.serialhid.build.usbtype=[B]USB_SERIAL_HID[/B]
teensy41.menu.usb.midi=MIDI
teensy41.menu.usb.midi.build.usbtype=USB_MIDI
teensy41.menu.usb.midi.fake_serial=teensy_gateway
teensy41.menu.usb.midi4=MIDIx4
teensy41.menu.usb.midi4.build.usbtype=USB_MIDI4
teensy41.menu.usb.midi4.fake_serial=teensy_gateway
teensy41.menu.usb.midi16=MIDIx16
teensy41.menu.usb.midi16.build.usbtype=USB_MIDI16
teensy41.menu.usb.midi16.fake_serial=teensy_gateway
teensy41.menu.usb.serialmidi=Serial + MIDI
teensy41.menu.usb.serialmidi.build.usbtype=USB_MIDI_SERIAL
teensy41.menu.usb.serialmidi4=Serial + MIDIx4
teensy41.menu.usb.serialmidi4.build.usbtype=USB_MIDI4_SERIAL
teensy41.menu.usb.serialmidi16=Serial + MIDIx16
teensy41.menu.usb.serialmidi16.build.usbtype=USB_MIDI16_SERIAL
teensy41.menu.usb.audio=Audio
teensy41.menu.usb.audio.build.usbtype=USB_AUDIO
teensy41.menu.usb.audio.fake_serial=teensy_gateway
teensy41.menu.usb.serialmidiaudio=Serial + MIDI + Audio
teensy41.menu.usb.serialmidiaudio.build.usbtype=USB_MIDI_AUDIO_SERIAL
teensy41.menu.usb.serialmidi16audio=Serial + MIDIx16 + Audio
teensy41.menu.usb.serialmidi16audio.build.usbtype=USB_MIDI16_AUDIO_SERIAL
teensy41.menu.usb.mtp=MTP Disk (Experimental)
teensy41.menu.usb.mtp.build.usbtype=USB_MTPDISK
teensy41.menu.usb.mtp.fake_serial=teensy_gateway
teensy41.menu.usb.rawhid=Raw HID
teensy41.menu.usb.rawhid.build.usbtype=USB_RAWHID
teensy41.menu.usb.rawhid.fake_serial=teensy_gateway
teensy41.menu.usb.flightsim=Flight Sim Controls
teensy41.menu.usb.flightsim.build.usbtype=USB_FLIGHTSIM
teensy41.menu.usb.flightsim.fake_serial=teensy_gateway
teensy41.menu.usb.flightsimjoystick=Flight Sim Controls + Joystick
teensy41.menu.usb.flightsimjoystick.build.usbtype=USB_FLIGHTSIM_JOYSTICK
teensy41.menu.usb.flightsimjoystick.fake_serial=teensy_gateway
 
Just wondering about the plans for headless support. Not looking for definitive answers, just thinking about a couple of things. My project has a headless RPi Zero W hooked to a Teensy4.0. The main issue I have right now is that with teensy-loader-cli I need to press the reset button for it to upload. I'm getting close to the point where everything will be enclosed and inaccessible, and so I need a fully headless solution.

  • Is the plan that arduino-cli will need this button press or not?
  • I'm not sure that I really need arduino-cli anyway, because it's quicker to develop and compile on my PC, and then transfer the .hex file. (I may change my view on this when I move from development to a more stable product that only requires infrequent updates.)
  • If a reset is required, using either cli, what's the consensus on the best way to achieve this? I'm thinking an RPi GPIO connected to the Teensy RESET pin would be required, and then something to toggle it - probably a Python app. Any easier way? (I know the Teensy CLI Loader page mentions a second Teensy and the -r flag, so I'm hoping I can do something similar with the RPi.)
  • If I switch from RPi-OS Lite to the full desktop version I think I'm still going to have the same issue, even if I install the GUI Teensy Loader. Although I'll be booting the full desktop, I'll be SSH'ing in via a terminal, and so no Xserver. Does anyone know if this thinking is correct or not?
Thanks in advance!
 
You can run the teensy_reboot program. That's what Arduino does to automatically enter program mode.

If you have previously loaded bad code, physically pressing the button or pulling the Program pin low is required. Unless you can be sure you will only load working code, connecting a GPIO pin to the Program pin is probably your most reliable way to design this system.
 
Thanks Paul! I missed teensy_reboot in my research last night. I'll go try it out. Sounds like the GPIO will be a necessary addition for reliability after all, although as it stands my code has been reliable so far. But of course that can change! I'll look into any option other than Python to do a simple pin toggle, but expect Python will be the way to go.
 
Look in the installed boards.txt for the USB menu item listing for the needed #define.
Looks something like this here:
Code:
teensy41.menu.usb.serial=Serial
teensy41.menu.usb.serial.build.usbtype=[B]USB_SERIAL[/B]
teensy41.menu.usb.serial2=Dual Serial
teensy41.menu.usb.serial2.build.usbtype=[B]USB_DUAL_SERIAL[/B]
teensy41.menu.usb.serial3=Triple Serial
teensy41.menu.usb.serial3.build.usbtype=[B]USB_TRIPLE_SERIAL[/B]
teensy41.menu.usb.keyboard=Keyboard
teensy41.menu.usb.keyboard.build.usbtype=[B]USB_KEYBOARDONLY[/B]
teensy41.menu.usb.keyboard.fake_serial=teensy_gateway
teensy41.menu.usb.touch=Keyboard + Touch Screen
teensy41.menu.usb.touch.build.usbtype=USB_TOUCHSCREEN
teensy41.menu.usb.touch.fake_serial=teensy_gateway
teensy41.menu.usb.hidtouch=Keyboard + Mouse + Touch Screen
teensy41.menu.usb.hidtouch.build.usbtype=USB_HID_TOUCHSCREEN
teensy41.menu.usb.hidtouch.fake_serial=teensy_gateway
teensy41.menu.usb.hid=Keyboard + Mouse + Joystick
teensy41.menu.usb.hid.build.usbtype=[B]USB_HID[/B]
teensy41.menu.usb.hid.fake_serial=teensy_gateway
teensy41.menu.usb.serialhid=Serial + Keyboard + Mouse + Joystick
teensy41.menu.usb.serialhid.build.usbtype=[B]USB_SERIAL_HID[/B]
teensy41.menu.usb.midi=MIDI
teensy41.menu.usb.midi.build.usbtype=USB_MIDI
teensy41.menu.usb.midi.fake_serial=teensy_gateway
teensy41.menu.usb.midi4=MIDIx4
teensy41.menu.usb.midi4.build.usbtype=USB_MIDI4
teensy41.menu.usb.midi4.fake_serial=teensy_gateway
teensy41.menu.usb.midi16=MIDIx16
teensy41.menu.usb.midi16.build.usbtype=USB_MIDI16
teensy41.menu.usb.midi16.fake_serial=teensy_gateway
teensy41.menu.usb.serialmidi=Serial + MIDI
teensy41.menu.usb.serialmidi.build.usbtype=USB_MIDI_SERIAL
teensy41.menu.usb.serialmidi4=Serial + MIDIx4
teensy41.menu.usb.serialmidi4.build.usbtype=USB_MIDI4_SERIAL
teensy41.menu.usb.serialmidi16=Serial + MIDIx16
teensy41.menu.usb.serialmidi16.build.usbtype=USB_MIDI16_SERIAL
teensy41.menu.usb.audio=Audio
teensy41.menu.usb.audio.build.usbtype=USB_AUDIO
teensy41.menu.usb.audio.fake_serial=teensy_gateway
teensy41.menu.usb.serialmidiaudio=Serial + MIDI + Audio
teensy41.menu.usb.serialmidiaudio.build.usbtype=USB_MIDI_AUDIO_SERIAL
teensy41.menu.usb.serialmidi16audio=Serial + MIDIx16 + Audio
teensy41.menu.usb.serialmidi16audio.build.usbtype=USB_MIDI16_AUDIO_SERIAL
teensy41.menu.usb.mtp=MTP Disk (Experimental)
teensy41.menu.usb.mtp.build.usbtype=USB_MTPDISK
teensy41.menu.usb.mtp.fake_serial=teensy_gateway
teensy41.menu.usb.rawhid=Raw HID
teensy41.menu.usb.rawhid.build.usbtype=USB_RAWHID
teensy41.menu.usb.rawhid.fake_serial=teensy_gateway
teensy41.menu.usb.flightsim=Flight Sim Controls
teensy41.menu.usb.flightsim.build.usbtype=USB_FLIGHTSIM
teensy41.menu.usb.flightsim.fake_serial=teensy_gateway
teensy41.menu.usb.flightsimjoystick=Flight Sim Controls + Joystick
teensy41.menu.usb.flightsimjoystick.build.usbtype=USB_FLIGHTSIM_JOYSTICK
teensy41.menu.usb.flightsimjoystick.fake_serial=teensy_gateway



Thanks, got it working!
 
Just as an update to my posts I now have a working setup where I can use Visual Studio Code to edit, compile, (using arduino-cli), and upload to a remote Teensy 4.0, (via rsync to a Raspberry Pi Zero W running a Python app that in turn runs teensy_loader_cli). Couldn't get the GPIO to PROGRAM pin to work successfully, so I'll need to revisit that at some point. This is all from my Ubuntu desktop. I can post some configuration stuff if anyone wants it.
 
Last edited:
I have managed to run and test a build in github-actions my using Xserver to launch a buffer display, necessary for the Teensyloader, even for compilation.
Quick and dirty: [url]https://github.com/dattasaurabh82/ARTNET_TEENSY41_ETH_NEOPIXEL/blob/main/.github/workflows/main.yml [/URL]
 
This might be better suited directed to other forums, but I'm logged on here right now, so:

1. Is it possible to run arduino-cli without discovery? I only run it to compile my code and do not have a Teensy connected to my development machine. Because of this I always get "Error initializing instance: discovery not found: teensy:teensy-discovery". I've tried with discovery timeout set to zero and also using the quiet flag. Neither make a difference.

2. Is it possible to ignore #pragma messages when compiling? I'm using a third party library that spits out a couple of useless messages that I'm tired of seeing. And these also show when using the --quiet flag.
 
I only run it to compile my code and do not have a Teensy connected to my development machine. Because of this I always get "Error initializing instance: discovery not found: teensy:teensy-discovery".

I'm pretty sure this error means something is messed up with the software installation.

It could be a bug in the Teensyduino package, or a bug in arduino-cli, or something has gone wrong on your machine. Very difficult to know. But I can say I'm pretty sure it's not merely due to not have a Teensy connected to any USB port.

Please try running arduino-cli with "-v" for verbose messages. Maybe it will show something more useful?
 
Hmmm. Nothing useful, to me at least. The error happens immediately before any compiling starts:

Code:
arduino-cli compile -v -b teensy:avr:teensy40 --build-path /home/dave/Arduino/Blink/build/ /home/dave/Arduino/Blink
Error initializing instance: discovery not found: teensy:teensy-discovery
Using board 'teensy40' from platform in folder: /home/dave/.arduino15/packages/teensy/hardware/avr/1.56.1
Using core 'teensy4' from platform in folder: /home/dave/.arduino15/packages/teensy/hardware/avr/1.56.1
Detecting libraries used...
/home/dave/.arduino15/packages/teensy/tools/teensy-compile/1.56.1/arm/bin/arm-none-eabi-g++ -E .......

I edited platform.txt and commented out the last three lines of the discovery section:

Code:
## Teensy Ports Discovery
##  Arduino 1.8.9 requires pathPrefs patch
##  discovery patters have only limited support for substitution macros,
##  so we can not use {teensytools.path} or {compiler.path} here

# Teensyduino Installer
#discovery.teensy.pattern="{runtime.hardware.path}/../tools/teensy_ports" -J2

# Arduino Boards Manager
#discovery.teensy.pattern="{runtime.tools.teensy-tools.path}/teensy_ports" -J2
#pluggable_discovery.required=teensy:teensy-discovery
#pluggable_monitor.required.teensy=teensy:teensy-monitor

Now it compiles without the discovery error, which is fine for my immediate needs, but chances are I'll forget that I did this when I start a new project connected by USB!! :D

Still get the stupid #pragma messages, but that's a library issue and I'll just have to live with it unless I can figure out how to suppress them via a compiler command.

As a side note I got my Pi side Python script running as a service so now whenever my project is powered up I get wireless and headless updating of the Teensy without any need to open a terminal. Just a compile and an upload command from within VS Code.
 
If you're willing to try some tests, I'd really like to understand why it wasn't working. It might be a bug, and if so, I want to fix it.
 
If you're willing to try some tests, I'd really like to understand why it wasn't working. It might be a bug, and if so, I want to fix it.
Absolutely. I'll do what I can to help. I don't typically delve too deep into the weeds on stuff, but I'm happy to take your direction and try anything you'd like me to try. To me this error is just an annoyance and doesn't affect the compile process other than a distracting message. (I've edited the library I was having the #pragma issue with, so now I have a clean compile output with just the errors that I introduce to my own code.)
 
Sounds good. Still draft PR (not sure what that means), but hopefully soon!

Looks like progress on this :D

There were some more commits to this PR over the last couple of days and
The PR has been updated to be a PR and no longer a draft PR :D (fingers crossed)
 
Arduino now has a snapshot build of IDE 2.0-rc6 with pluggable monitor support. Anyone can download it here (scroll down to "Artifacts")

https://github.com/arduino/arduino-ide/actions/runs/2447002574

I'm running the Linux x86-64 build on my Ubuntu 20.04 desktop. And wow, it's able to keep up with sustained maximum speed Serial printing from Teensy 4.0 running at 912 MHz! Manage a very respectable 776000 lines/sec speed too.

screenshot.jpg
 
Looks like they are getting closer to getting into the build :D Will try the artifacts later. Is there an updated TD installer (with beta 2?)
 
Looks like they are getting closer to getting into the build :D Will try the artifacts later. Is there an updated TD installer (with beta 2?)

Would be nice to get a beta2 installer at least this one time for testing both the beta2 and the ide changes. Playing on running on a Windows10x64
 
Arduino now has a snapshot build of IDE 2.0-rc6 with pluggable monitor support. Anyone can download it here (scroll down to "Artifacts")

https://github.com/arduino/arduino-ide/actions/runs/2447002574

I'm running the Linux x86-64 build on my Ubuntu 20.04 desktop. And wow, it's able to keep up with sustained maximum speed Serial printing from Teensy 4.0 running at 912 MHz! Manage a very respectable 776000 lines/sec speed too.

View attachment 28623

Ok couldn't resist. Install 2.0-rc6-snapshot and after installing 1.56 from the boards manager I updated core/library and boards.txt files to 1.57-beta2 (copy and paste and ran the speed test. It looks like it may be faster:
Capture.PNG

EDIT: Forgot this is with a T4.1 running at 912Mhz.

Looks like they fixed the issue with Legacy libraries as well.
 
Are you seeing the "garbage" problem we normally get on Windows when receiving at this speed?

Looks like Arduino merged the pluggable monitor stuff into their main branch, by tomorrow we should see it in the normal nightly builds and not need to run this special snapshot version.


Would be nice to get a beta2 installer at least this one time for testing both the beta2 and the ide changes.

I'll do this "soon". But it's not a simple matter. I still have a lot of work to do on my build scripts. The 1.56.1 package is the result of a lot of manual work, including running sha256sum on command line and editing the index file in a text editor. I'm not so eager to keep redoing that work manually.
 
PaulStoffregen said:
Are you seeing the "garbage" problem we normally get on Windows when receiving at this speed?

Didn't see the normal garbage at using the IDE serial monitor but did see alot of it when I tried using TyCommander but then I was also seeing speeds of up to 950K/sec and higher (again that was with Tycommander) after it was running awhile:
TyCommander OUtput:
Code:
count=32377667, lines/sec=1284316
count=32377668, lines/sec=1284316
count=32377669, lines/sec=1284316
count=32377670, lines/sec=1284316
count=32377671, lines/sec=1284316
count=32377672, lines/sec=1284316
count=32377673, lines/sec=1284316
count=32377674, lines/sec=1284316
count=32377675, lines/sec=1284316
count=32377676, lines/sec=1284316
count=32377677, lines/sec=1284316
NOTE: eventually TyComm hangs

I'll do this "soon". But it's not a simple matter. I still have a lot of work to do on my build scripts. The 1.56.1 package is the result of a lot of manual work, including running sha256sum on command line and editing the index file in a text editor. I'm not so eager to keep redoing that work manually.
Not a problem updating it manually worked and to be honest - don't blame you - enough on your hands.

UPDATE: Just reran Tycom again and seems like when the speed gets about 1Mb/sec for too long it hangs.
 
Back
Top