Arduino CLI And IDE now Released - Teensy Supported!

Quick FYI - Yesterday RC8 of the IDE was released.
If you have others installed that is not ancient, when you start it up, they will ask you if you wish to download and install...
 
Try running "arduino-cli version"? What does it show?

When I try here with the latest, I see this:

Code:
arduino-cli  Version: nightly-20220624 Commit: 4a4b784 Date: 2022-06-24T01:38:17Z

Here's a screenshot of how it works when I use it.

screenshot.png
 
@PaulStoffregen: this is my version and how it looks:

Code:
~ 
$ arduino-cli version   
arduino-cli  Version: nightly-20220624 Commit: 4a4b784 Date: 2022-06-24T01:38:17Z

~ 
$ arduino-cli board list
Error initializing instance: Error loading hardware platform: discovery teensy:teensy-discovery not found
Port         Protocol Type              Board Name FQBN Core
/dev/ttyACM0 serial   Serial Port (USB) Unknown

This is my `preferences.txt`:

Code:
board=teensy41
boardsmanager.additional.urls=https://www.pjrc.com/teensy/td_156/package_teensy_index.json
browser=mozilla
build.verbose=false
build.warn_data_percentage=75
cache.enable=true
compiler.cache_core=true
compiler.warning_level=none
console=true
console.auto_clear=true
console.error.file=stderr.txt
console.length=500
console.lines=4
console.output.file=stdout.txt
custom_keys=teensy41_en-us
custom_opt=teensy41_o2std
custom_speed=teensy41_600
custom_usb=teensy41_serial
editor.antialias=true
editor.auto_close_braces=true
editor.caret.blink=true
editor.code_folding=false
editor.divider.size=0
editor.external=false
editor.font=Monospaced,plain,12
editor.indent=true
editor.invalid=false
editor.keys.alternative_cut_copy_paste=true
editor.keys.home_and_end_beginning_end_of_doc=false
editor.keys.shift_backspace_is_delete=true
editor.languages.current=
editor.linenumbers=false
editor.save_on_verify=true
editor.tabs.expand=true
editor.tabs.size=2
editor.update_extension=true
editor.window.height.default=600
editor.window.height.min=290
editor.window.width.default=500
editor.window.width.min=400
export.applet.separate_jar_files=false
export.application.fullscreen=false
export.application.platform=true
export.application.stop=true
export.delete_target_folder=true
gui.scale=auto
ide.accessible=false
last.ide.1.8.19.daterun=1656073907
last.ide.1.8.19.hardwarepath=/usr/share/arduino/hardware
last.screen.height=1200
last.screen.width=3840
last.sketch.count=0
last.sketch.default.location=1670,300,500,600,-1,0
last.sketch.default.path=/tmp/untitled1924177766.tmp/sketch_jun24a/sketch_jun24a.ino
launcher=xdg-open
platform.auto_file_type_associations=true
preferences.readonly=false
preproc.color_datatype=true
preproc.enhanced_casting=true
preproc.imports.list=java.applet.*,java.awt.Dimension,java.awt.Frame,java.awt.event.MouseEvent,java.awt.event.KeyEvent,java.awt.event.FocusEvent,java.awt.Image,java.io.*,java.net.*,java.text.*,java.util.*,java.util.zip.*,java.util.regex.*
preproc.output_parse_tree=false
preproc.save_build_files=false
preproc.substitute_floats=true
preproc.substitute_unicode=true
preproc.web_colors=true
programmer=arduino:avrispmkii
proxy.manual.hostname=
proxy.manual.password=
proxy.manual.port=
proxy.manual.type=HTTP
proxy.manual.username=
proxy.pac.url=
proxy.type=auto
run.display=1
run.options=
run.options.memory=false
run.options.memory.initial=64
run.options.memory.maximum=256
run.present.bgcolor=#666666
run.present.exclusive=false
run.present.stop.color=#cccccc
serial.databits=8
serial.debug_rate=9600
serial.line_ending=1
serial.parity=N
serial.port=/dev/ttyACM1
serial.port.file=ttyACM1
serial.port.iserial=null
serial.stopbits=1
sketchbook.path=/home/chris/Arduino
software=ARDUINO
target_package=teensy
target_platform=avr
theme.file=
update.check=true
update.id=-3677535932606265667
update.last=1656073573065
upload.using=bootloader
upload.verbose=false
upload.verify=true

And my `arduino-cli.yaml`:

Code:
board_manager:
  additional_urls:
  - https://www.pjrc.com/teensy/td_156/package_teensy_index.json
daemon:
  port: "50051"
directories:
  data: /home/chris/.arduino15
  downloads: /home/chris/.arduino15/staging
  user: /home/chris/Arduino
ide:
  bundled: false
  portable: false
library:
  enable_unsafe_install: false
locale: en
logging:
  file: ""
  format: text
  level: info
metrics:
  addr: :9090
  enabled: true
output:
  no_color: false
sketch:
  always_export_binaries: false
updater:
  enable_notification: true
 
I just tried it on my Windows machine:
Code:
C:\Users\kurte\Documents\Arduino\libraries>arduino-cli board list
Port               Protocol Type         Board Name FQBN                Core
usb:0/140000/0/1/4 teensy   Teensy Ports Teensy 4.1 teensy:avr:teensy41 teensy:avr
 
Thank you both! It is now working. I removed all configuration and started anew. I think it was a bit confused about paths.
 
If you find any insight about what path issues got arduino-cli so confused, please share.

With the old Arduino 1.8.x software, we've seen pretty much every problem many times and we know how to solve them. But this new software is, well, pretty new and that experience with the sorts of things that go wrong in practical situations and how to solve them hasn't been built up yet.
 
I think it had to do with me having an `.arduino15` and an `.arduinoIDE` (I believe this is from the 2.0 IDE) folder, in which the arduino-cli.yaml was. Now I just have a single folder `.arduino15` and it works in the IDE and in the CLI as well.
 
I thought I would post an update on the IDE2/CLI issues with the Pluggable Serial Monitor support and the issue I ran into:

More ore the details are up in the IDE issues.
https://github.com/arduino/arduino-cli/issues/1774#issuecomment-1175908540

Summary of issue:
Code:
elapsedMillis em = 0;
uint32_t alive_count = 0;
void setup() {
  pinMode(13, OUTPUT);
  while (!Serial)
    ;
  Serial.begin(115200);
  delay(1000);
  Serial.println("Start of Echo Test");
}

void loop() {
  if (Serial.available()) {
    digitalToggleFast(13);
    Serial.print("Received:(");
    int ch;
    while ((ch = Serial.read()) != -1) Serial.write(ch);
    Serial.println(")");
  }
  #if 0
  if (em > 5000) {
    // If I Uncomment the print below it echos???
    Serial.printf("Alive Count: %u\n", ++alive_count);
    em = 0;
  }
  #endif
}
With the above code: if you run this on Windows, you will never receive the data. That is if you type: abcdefg CTRL-Enter
in the Serial Monitor you will not receive the data.

If however you change the #0 to #1, you will receive the data, but only when the next output happens (Alive Count printed)

This does NOT replicate on Ubuntu and I believe someone tried on MAC as well and it did not replicate.

Yesterday with some hints from @cmaglie - I am pretty sure the problem is somewhere in the teensy-monitor.exe code.

That is, I installed: npcap which has ncat command.

So in one command prompt I ran: C:\Program Files\Npcap>ncat -l 12345

in a second command prompt I ran:
Code:
C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\tools\teensy-monitor\1.56.53>teensy-monitor.exe
[COLOR="#FF0000"]HELLO 1 "arduino-cli"[/COLOR]
{
"eventType": "hello",
"protocolVersion": 1,
"message": "OK"
}
[COLOR="#FF0000"]OPEN 127.0.0.1:12345 usb:0/140000/0/1/2[/COLOR]
{
"eventType": "open",
"message": "OK"
}
Note: you enter the command line, and then the app talks with standard in/standard out.
The part in RED is the part I typed. Note: the usb:0... is the name shown in the Arduino IDE for USB address...

After they connected, the output from the Teensy showed up in the ncat window and in the case with the #1 the input worked:

Code:
C:\Program Files\Npcap>ncat -l 12345
Start of Echo Test
Alive Count: 1
Alive Count: 2
Alive Count: 3
abcdefg
Alive Count: 4
Received:(abcdefg
)
Alive Count: 5
...

But in the case of #0
Code:
C:\Program Files\Npcap>ncat -l 12345
Start of Echo Test
If at first
It did not echo anything... I tried entering additional text to see if maybe there was some form of latency stuff where it was trying to group the input into one USB buffer.
But I typed in I believe 18 lines of: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
And still nothing.

Also the LED on the Teensy never toggled state.

Note: as the teensy-monitor.exe size was different between the .1 and .53 installs I copied the .1 into the .53 and still the same issue...

Edit: Was wondering if made a difference if USB Serial versus Seremu... So tried building as USB Type Serial... Same issue

Edit2: Downloaded latest MAC daily build 0706 and example works fine.

Edit3: The Arduino CLI issue was closed
 
Last edited:
Some more notes on getting all of the Teensy Arduino 1.x functionality into Arduino 2 IDE.

Some of these are already known issues that I have mentioned before and/or created Issues up on Arduino IDE github project.


Teensy Examples:
In Arduino 1.x - Teensy Install installs in the "Teensy" example menu area like on my machine for 1.8.19: C:\arduino-1.8.19\examples\Teensy

With 2.x we are not showing these examples. Earlier I created an Issue. https://github.com/arduino/arduino-ide/issues/869

I know for most other Arduino installs, they way they would do it, is to have their install, put in a platform specific library, in our case probably Named Teensy,
which has no code (Might need an empty .h and .cpp file) and then directory examples
where all of the examples live.
I know this is what Robotis does for OpenCM904 and OpenCR
Likewise for ESP32 (although they put dummy .h file in src and have a library.properties file

Tools->Teensy 4 Security

This menu item is not in the IDE 2. Not sure if there is proper valid way for Board types to add in generic menus?

Side note: was looking at this, as playing with something like Littlefs_program and was wondering about where is the proper way to determine where is a safe place to start
stuff, like CircuitPython does. i.e. at the 500k mark or the 1mb mark. Plus if program is larger than that...

Unclear to me from the code security page: https://www.pjrc.com/teensy/td_code_security.html
With bootloader version 1.07, only the first 512K in normal mode or first 1M in secure mode is unconditionally erased, if the flash memory contains a previously written program with valid IVT+BootData fields.
If "In Secure Mode" if this means: The Fuse Write sketch has run, or if programmed with EHEX file or The Teeny has been locked.

And what should a program test to know if they erased .5 or 1MB?

I know there are probably comments on this elsewhere...

But now back to playing
 
With the above code: if you run this on Windows, you will never receive the data. That is if you type: abcdefg CTRL-Enter
in the Serial Monitor you will not receive the data.

Yup, it's a Windows-only issue (and yet another example of really odd WIN32 API limitations).

Here's an attempt at a fix. Extract and copy teensy-monitor.ext to C:/Users/{yourname}/AppData/Local/Arduino15/packages/teensy/tools/teensy-discovery/1.56/

I only did serial so far. Haven't touched HID yet.
 

Attachments

  • teensy-monitor-serialfix.zip
    26.1 KB · Views: 59
It works :D

I am testing it on the Just Released RC9

screenshot.jpg

Edit: Forgot to mention, the location I installed it was:
Code:
C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\tools\teensy-monitor\1.56.53
 
Yup, it's a Windows-only issue (and yet another example of really odd WIN32 API limitations).

Here's an attempt at a fix. Extract and copy teensy-monitor.ext to C:/Users/{yourname}/AppData/Local/Arduino15/packages/teensy/tools/teensy-discovery/1.56/

I only did serial so far. Haven't touched HID yet.

Paul - is that path right or should it be ...\AppData\Local\Arduino15\packages\teensy\tools\teensy-monitor\1.56.53 thats where teensy-monitor is located for me?
 
Is it still broken when using HID?

If you mean just compile with USB Type as Raw Hid and re-run Kurt's test case the answer is Yes, at least for me. I also tried MTP_Disk and Serial_MTP_DISK and it failed as well. EDIT: Maybe a few minutes later something may show up in Serial monitor - sometimes.

If I try it with TyCommander the sketch worked - this was just as a confirmation.
 
Here's an attempt to fix the bug with HID mode.

I did quick test of building the sketch I mentioned for USB Type Keyboard and it properly received the data I typed in.

Also tried with MTP_Teensy sketch with the USB simple sketch and it looks like keyboard responses are coming in.
 
Still stuck on first start of IDE 2.0 RC9.

Went to %appdata% and removed folders: roaming\arduino* and local\Arduino_15

Odd because the earlier noted RC installed (months back) and ran here on Win 11.

Also, this time before starting I marked the RC9 ZIP as 'not blocked' - so All *.exe's indicated not blocked when copied out to empty folder.
That extracted folder c:\T_drive and the TEMP on R:\ {a RAM DRIVE} are marked with 'Ignore all MalwareBytes' exception

Running from Admin CMD window shows this - where it doesn't like R:\TEMP:
Code:
C:\T_Drive\ardIDE_2>"Arduino IDE.exe"

C:\T_Drive\ardIDE_2>
Starting backend process. PID: 19108
Using browser-only version of superagent in non-browser environment
Error: EISDIR: illegal operation on a directory, realpath 'R:\Temp'
    at Function.realpathSync.native (node:fs:2540:3)
    at Function.native (node:electron/js2c/asar_bundle:5:4819)
    at new SketchesServiceImpl (C:\T_Drive\ardIDE_2\resources\app\node_modules\arduino-ide-extension\lib\node\sketches-service-impl.js:48:51)
    at _createInstance (C:\T_Drive\ardIDE_2\resources\app\node_modules\inversify\lib\resolution\instantiation.js:27:12)
    at Object.resolveInstance (C:\T_Drive\ardIDE_2\resources\app\node_modules\inversify\lib\resolution\instantiation.js:47:18)
    at C:\T_Drive\ardIDE_2\resources\app\node_modules\inversify\lib\resolution\resolver.js:75:42
    at Object.resolve (C:\T_Drive\ardIDE_2\resources\app\node_modules\inversify\lib\resolution\resolver.js:99:12)
    at C:\T_Drive\ardIDE_2\resources\app\node_modules\inversify\lib\container\container.js:335:37
    at Container._get (C:\T_Drive\ardIDE_2\resources\app\node_modules\inversify\lib\container\container.js:326:44)
    at Container.get (C:\T_Drive\ardIDE_2\resources\app\node_modules\inversify\lib\container\container.js:243:21) {
  errno: -4068,
  syscall: 'realpath',
  code: 'EISDIR',
  path: 'R:\\Temp'
}
Configuration directory URI: 'file:///c%3A/Users/Tim/.theia'
Theia app listening on http://localhost:51093.
root INFO Finished starting backend application: 4.7 ms [Finished 1.417 s after backend start]
[23040:0720/163411.348:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is disabled, ANGLE is
Stored workspaces roots:
 
Hi @defragster - suggest you check out the current issues in: https://github.com/arduino/arduino-ide/issues
example: last one created: https://github.com/arduino/arduino-ide/issues/1235

And probably create a new one with as much info as possible. Maybe mention your posts here.

Then hopefully one of the Arduino people like PerT (per1234 on Arduino) will see it and hopefully will either know what is going on and/or give more informed
suggestions.

Note: I have IDE2 installed two different ways. The Daily builds are done as I mentioned earlier, where I have one directory that I keep reusing, from either daily builds or sometimes from the Artifacts that are generated by their Pull requests.
The main RC versions I have installed using the installer. This one today for example, I was notified a new release was released and it downloaded and updated.

Good luck.
 
Thanks @KurtE ...
Quick glance at issues ... and decided to try the .MSI installer.
Installer ran - and exited with no IDE start or feedback.

Found it did install: C:\Users\Tim\AppData\Local\Programs\arduino-ide

Running that gives the same annoying screen blocking SPLASH and opens the "Arduino IDE" window with just that in title bar and no menu or other except a spinning object in the white space.

I'll have to look for an issue and perhaps open one with no more info than that ... there must a .log somewhere that would tell the devs what is going on behind the scenes.

Has not even recreated the '\localArduino15' though the 2 folders in Roaming are back.

>> EDIT >> Still just spinning (as with unzip) ... an hour later
 
Last edited:
@defragster - Some other things I have had to do in the past, (arduino 1.x) when things were screwy,
was to rename my sketch folder (documents)/arduino to something like arduino_save
And that got Arduino 1.??? working long ago. I figured at the time it was either:
a) lots and lots of sketches, under several levels of menu
b) Lots and lots of libraries... Maybe it did not like some of them...
c) <sketches>/hardware/??? - I had some versions of ESP32 and/or 8266 installed there. Probably one or more versions of OpenCM and/or OpenCR versions there... Maybe one of them was screwing things up...

You might try something like that to see if it then comes up... Or you might try it piecemeal
 
... @KurtE ... As noted on 1.57b4 thread ... and above
.msi install still failing to get beyond blank window and the wait loop. Was reading git issues ... page 8 so far ... looking for anything similar and nothing yet.

> removed 1.8.19 zip folder contents and re-Unzipped, then installed TD 1.57b4. T_4.1 built and worked from Sublime (had to add 'new' packages folder as TSET demands it as written,opps), and built from IDE all seems good.

- until then there was no Arduino history; %appdata% folders removed, so no preferences.txt and sketchbook and manual libs are 'gone' linked to default DOCS folder that is empty and never used.
> also, no prior 'packages' ESP32 or other with those deletions.

So, everything in 'NOOB' state AFAIK ... unless the Jan/Feb nightly installs left something somewhere else?
> seeing ref to '.../Users/Tim/.theia', but cannot find a sign of that folder. p#270:: Configuration directory URI: 'file:///c%3A/Users/Tim/.theia'
> scanning issues it seems theia is the name of something
 
Created this issue 1236: github.com/arduino/arduino-ide/issues/1236

Reading page 8 the dates seemed to be Nov 2021 and getting older ... it worked on this machine in Jan/Feb with nightly build then.

<EDIT>: Seem a dupe of #1117: ImDisk RamDrive Virtual Disk with TEMP on R:\TEMP

Title didn't click - but same issue, and it also used to work there on Win 10.
 
Last edited:
Back
Top