Program Teensy 4.0 via Arduino Nano ISP

Status
Not open for further replies.

SpiderPig

Member
Hi, I've just set up an Arduino Nano as an ISP and have had it successfully uploading code to another Arduino Nano. I'd now like to upload code to the Teensy 4.0 but not too sure where to start as it doesn't have a RESET pin? Wondering if this has been done before?
 
PJRC supported upload uses the Device USB port through a RawHID connection for the programming upload.

It has been done in some fashion using the USB Host port of a T_3.6 - at least was published for a T_3.6, not sure if it was updated beyond that. But only a direct USB interface is PJRC supported for programming.
 
Thanks. I downloaded the Teensy Loader Command Line source here and got it running in Visual Studio. I can now debug it and see exactly what's going on when a hex file is uploaded.

I'm thinking I can edit the ISP program on the Nano to write the hex code into the USB. Am I right in saying the USB is RX0 & TX0? 1 - 5 is available on the IO pins, but not 0. I can also see on the bottom of the board (under the USB jack) two solder pads marked D- & D+. I don't know much about the USB protocol but if I write an Arduino program that behaves the same as the Teensy Loader - it should work right?
 
On Nano the Device USB shares the RX0 and TX0 pins - but does not provide USB Host capabilities - those are UART serial pins, noted as required in p#2 to connect Teensy as a Device for RawHID programming.

A Host shield may work - but would be easier to see if another Teensy with USB Host capabilities ( 3.6, 4.1, or even a 4.0 with added connections ) has code written to process the upload.

But in that case - just easier to plug USB directly into the computer.

Seems there are threads for non PJRC supported 'FLASHER' that can be used to program the Teensy 4.0 though/from other than USB Device port
 
After a bit of looking around I think the "Flasher" might be the way to go. That, and I've been looking into writing my own bootloader - but I may be getting a bit ahead of myself.
 
The answer, for the best way to do things like, this probably depends on what it is you are trying to solve...

For example earlier when I was playing with a robot (hexapod), Where I was using a Teensy to control servos, and wanted to update the software on Teensy without having to unplug it and connect it to my PC....

I setup the build to generate the hex file, then send the .hex file to the SBC (either RPI or probably Odroid at that time). I then had script running on the SBC that checked if a new file existed in some specific directory and would run a version of the TeensyLoaderCLI to program the teensy... Worked well at the time. I had hacked up the platform.txt to add an option to program using normal or remote... And the remote was setup to automatically send the file using something like CLI version of WinSCP... It was several years ago and I pretty sure I lost these scripts/platform.txt....

I know others have setup to allow you to plug your Teensy into another Teensy (3.6 or 4.x) USB host, and allow for the host code to program the other teensy.

Now on the other hand if your updates are very specific and you don't mind having the flasher code built in and .. That might be the way to go.

Good luck.
 
Thanks for your input. I'm creating a multicore teensy project where I can have up to ten teensy 4's working together, so rather than plugging each one to my PC for an update I made a C# program that compiles a single project into a hex file for each teensy and then it will upload it via the NANO to each teensy.

One idea for now, may be to plug each teensy into a USB hub and have ten com ports open that my program will have to talk to each one to identify what core number it is and then upload the appropriate HEX file...

However I'm wondering if it's possible to have the same program running on each teensy that will look for incoming serial data from the NANO and write it to an external flash chip, then load it into memory to run? The program has to be run from RAM, yes?
 
On Nano the Device USB shares the RX0 and TX0 pins - but does not provide USB Host capabilities - those are UART serial pins, noted as required in p#2 to connect Teensy as a Device for RawHID programming.

A Host shield may work - but would be easier to see if another Teensy with USB Host capabilities ( 3.6, 4.1, or even a 4.0 with added connections ) has code written to process the upload.

But in that case - just easier to plug USB directly into the computer.

Seems there are threads for non PJRC supported 'FLASHER' that can be used to program the Teensy 4.0 though/from other than USB Device port

I have a board with a Teensy 4.0 that is placed too far to be accessed by a USB connection, moreover, it must be electrically insulated from any computer, because it is placed at high voltage. I am currently accessing this board through an optical fibre connection by 2 serial TX, RX signals, that I use to send and receive data from the Teensy 4.0. My question is: is it possible to program the Teensy 4.0 through this kind of optical fibre connection? Or, is there any serial connection, different from USB, that I could use to program the Teensy 4.0 through optical fibres?
 
is there any serial connection, different from USB, that I could use to program the Teensy 4.0 through optical fibres?

Yes, you can use the method described in the thread linked below. Instead of loading firmware via the Teensy bootloader, you can add the capability within your own application to load new firmware into a temporary buffer in flash, then overwrite the existing firmware and reboot. Please take a look and ask questions there.

https://forum.pjrc.com/threads/4316...dates-changes-for-flashing-Teensy-3-5-amp-3-6
 
Status
Not open for further replies.
Back
Top