Programming Teensy from Chromebook?

mwomack

Well-known member
Is anyone programming a Teensy from their Chrombook? I set the secret flag to allow USB devices in Linux, Installed the Arduino IDE 2.3.10. Installed the Teensy stuff into the IDE. Set the Teensy rules.

When I connect the Teensy to the Chromebook, it asks if I want to use it in Linux or Android, I say Linux.

I launch the Arduino IDE, and it can see the Teensy (yeah!). I compile and upload the program (I'm trying blink), and the Teensy loader window shows up, and it says it is trying to automatically upload. But it fails and I get a message in the IDE:

Opening Teensy Loader...
Memory Usage on Teensy 4.0:
FLASH: code:7812, data:1992, headers:8624 free for files:2013188
RAM1: variables:2432, code:6096, padding:26672 free for local variables:489088
RAM2: variables:12416 free for malloc/new:511872

Teensy did not respond to a USB-based request to enter program mode.
Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
Failed uploading: uploading error: exit status 1

But pressing the button on the Teensy doesn't help. There is a red LED like it is in program mode though.

Is anyone else able to do this or am I trailblazing here?

-Mark
 
@mwomack: It may sound trivial, but you should try a different USB cable. It is a very commonly reported problem (not unique to linux) & very likely that you have a "charging only" cable (which has only the 5VDC & GROUND wires, so it is not capable of passing data to/from the Teensy, which is required for programming). Barring that as the simplest solution, try programming your Teensy on a Windows machine (if you don't have one, maybe you have a friend that will let you use theirs as an experiment).

Good luck & let us know how it goes . . .

Mark J Culross
KD5RXT
 
Three ways to collect more info:

1: After you see "Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch", watch the red LED (it's near the USB connector) and then press the pushbutton on Teensy. What do you see on the red LED before and after you've pressed the pushbutton?

2: Run a terminal and use a command to watch the Linux kernel log. You're looking for the kernel messages about detecting USB devices. On some systems the command is "tail -f /var/log/syslog". On others it's "dmesg --follow". I have no idea what it would be on a Chromebook running Linux, but hopefully knowing it exists on all other Linux distro can help you find the right way to do this on your Chromebook.

3: Teensy Loader has a Help > Verbose Info window. Open it and watch for an excessive amount of info. You can copy to clipboard, or use its Log menu to save to a file.
 
Three ways to collect more info:

1: After you see "Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch", watch the red LED (it's near the USB connector) and then press the pushbutton on Teensy. What do you see on the red LED before and after you've pressed the pushbutton?

2: Run a terminal and use a command to watch the Linux kernel log. You're looking for the kernel messages about detecting USB devices. On some systems the command is "tail -f /var/log/syslog". On others it's "dmesg --follow". I have no idea what it would be on a Chromebook running Linux, but hopefully knowing it exists on all other Linux distro can help you find the right way to do this on your Chromebook.

3: Teensy Loader has a Help > Verbose Info window. Open it and watch for an excessive amount of info. You can copy to clipboard, or use its Log menu to save to a file.
Paul,

Thanks for the help and pointers.

1. Before I do anything, the LED that you mention is completely off. After I select upload and I get the "Teensy did not respond.../Please press the PROGRAM MODE.../Failed uploading" messages, the LED is now on and flickering. If I press the program button, the LED goes off while pressed, and then back to on/flickering when released. It does not turn off after that. I'm staring at it right now as I write this.

2. For future reference, the command that works on my Chromebook is "dmesg -follow". I had the following output after connecting the Teensy, starting the IDE, and then doing the upload/button press:
Code:
[76234.831501] usb 1-1: new high-speed USB device number 11 using xhci_hcd
[76234.978620] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
[76261.520954] fuse: fusermount: init connection, mounts: 0:65 (fuse.arduino-ide_2.3.10_Linux_64bit.AppImage)
[76317.220738] usb 1-1: USB disconnect, device number 11
[76317.934217] usb 1-1: new high-speed USB device number 12 using xhci_hcd
[76318.066147] hid-generic 0003:16C0:0478.0006: device has no listeners, quitting
[76383.271986] usb 1-1: USB disconnect, device number 12
[76384.448459] usb 1-1: new high-speed USB device number 13 using xhci_hcd
[76384.592862] hid-generic 0003:16C0:0478.0007: device has no listeners, quitting

3. I have attached the verbose output from the loader.

Hopefully this gives you some new insights.
thanks,
-Mark
 

Attachments

  • loader_output.txt
    20 KB · Views: 26
@mwomack: It may sound trivial, but you should try a different USB cable. It is a very commonly reported problem (not unique to linux) & very likely that you have a "charging only" cable (which has only the 5VDC & GROUND wires, so it is not capable of passing data to/from the Teensy, which is required for programming). Barring that as the simplest solution, try programming your Teensy on a Windows machine (if you don't have one, maybe you have a friend that will let you use theirs as an experiment).

Good luck & let us know how it goes . . .

Mark J Culross
KD5RXT
Thanks, Mark. I can of course use my other Linux system (running on a Pi) to complete uploading, etc. And I am using a cable that I used on that system with success. But I would love to be able to do all of this from my Chrombook, which is my primary computer. Previously I couldn't even get this far as Chrome locked out USB devices on Linux. I'm hoping we can figure out what is happening and how to rectify it.
thanks,
-Mark
 
My best guess is this Chromebook Linux system may be missing the Linux hidraw driver?

Teensy Loader needs that driver. Most Linux distros have it installed by default. But your kernel messages don't say anything about starting hidraw.

One thing looks pretty clear from the messages, your USB cable seems to be fine. Also the red LED remaining on (slight flicker is ok) means successful USB communication.
 
Here is kernel log info from my Linux desktop after pressing the button on Teensy 4.1:

Code:
[19823.699932] usb 3-1.3: new high-speed USB device number 4 using xhci_hcd
[19823.775223] usb 3-1.3: New USB device found, idVendor=16c0, idProduct=0478, bcdDevice= 1.08
[19823.775228] usb 3-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=1
[19823.775229] usb 3-1.3: SerialNumber: 001A3412
[19823.778980] hid-generic 0003:16C0:0478.000E: hidraw9: USB HID v1.11 Device [HID 16c0:0478] on usb-0000:0e:00.0-1.3/input0

Notice the hid-generic line says "hidraw9" and more info. The Chromebook one says "device has no listeners, quitting". I'm pretty sure that means your system is lacking the hidraw driver.

Normally hidraw is a loadable module which you would use with a command like "modprobe". To be honest, I'm really not sure exactly how since it's been installed by default on every Linux distro I've used for the last decade or so.
 
My best guess is this Chromebook Linux system may be missing the Linux hidraw driver?

Teensy Loader needs that driver. Most Linux distros have it installed by default. But your kernel messages don't say anything about starting hidraw.

One thing looks pretty clear from the messages, your USB cable seems to be fine. Also the red LED remaining on (slight flicker is ok) means successful USB communication.
Gemini is saying that the default ChromeOS Linux Environment (which appears to be a Crostini virtual container) does not have hidraw installed and does not allow hidraw due to "security concerns": "Google intentionally leaves CONFIG_HIDRAW turned off in the container's kernel configuration to ensure that connected hardware cannot be used by malicious Linux apps to log keystrokes or mouse movements."

I don't know if there is another secret flag I can set that will allow me to install more of these drivers. Gemini is also saying there is some kind of "developer mode" that I can switch to that will allow for more Linux drivers. Let me dig around a bit and see what I can find.

-Mark
 
Gemini is saying that the default ChromeOS Linux Environment (which appears to be a Crostini virtual container) does not have hidraw installed and does not allow hidraw due to "security concerns": "Google intentionally leaves CONFIG_HIDRAW turned off in the container's kernel configuration to ensure that connected hardware cannot be used by malicious Linux apps to log keystrokes or mouse movements."

I don't know if there is another secret flag I can set that will allow me to install more of these drivers. Gemini is also saying there is some kind of "developer mode" that I can switch to that will allow for more Linux drivers. Let me dig around a bit and see what I can find.

-Mark
I should also mention that when I checked on the state of CONFIG_HIDRAW, it was not set. So, yeah, I think that is the problem. :)

-Mark
 
Yeah, it seems the only way to try this would be to go "full" developer mode and not have a Crostini container and wipe my machine in the process. Not sure I want to do that, and it's not entirely clear that it would work even after all of that. Oh well. Foiled again. Maybe I'll try it when I can be a bit more adventurous. If anyone out there has tried this, let me know.

thanks for the help,
-Mark
 
Back
Top