Trying to implement FOTA on Teensy 4.0

Sakshi Jadhav

New member
Hello,
Hello,

We have a Teensy 4.0 running with an Android tablet application. The tablet application has an Android app that controls (via command/response) the Teensy 4.0. The connection between the tablet and Teensy 4.0 is made through a Micro USB cable on the Teensy side and a USB-C cable to the tablet. The tablet is connected to the Internet.

I am trying to implement Firmware Over the Air (FOTA) on the Teensy 4.0 via USB. For this, I am using FlasherX, based on the link shared here https://github.com/joepasquariello/FlasherX . My process is as follows:

  1. First, I flash the FlasherX.ino file using the Arduino IDE.
  2. Then, I use the TeraTerm software to upload the .hex file generated by the Arduino IDE for FlasherX.ino.
However, when uploading the file, I receive the error shown below.
Screenshot (320).png

Could you please confirm whether I am following the correct steps and assist me in resolving this issue?
 
I'm not sure what's wrong, but can you please do a restore to factory blink program and then try to repeat the process? It looks like you may have some data in upper flash that is preventing FlasherX from creating a sufficient buffer.

You can find instructions to do the factory reset on this page (https://www.pjrc.com/store/teensy40.html) in the section labeled Programming.
 
The message "abort - new code missing string fw_teensy40" is also relevant. As a sanity check, FlasherX *REQUIRES* that string to be present in the hex file to ensure that the correct hardware is being flashed
 
@thebigg is correct, and that string *should* be in the file if you build the FlasherX example sketch with no changes to the source file. Perhaps you made some changes? You'll have to tell us more for us to help you solve the issue.
 
FlasherX assumes that your new code that you are uploading also includes FlasherX, after all why would you want to upgrade to a firmware that can't be upgraded again?

If you have a basic flasherX bootloader (FlasherX.ino) that loads your main application but your main application doesn't include flasherX (or includes it but doesn't then use it so the compiler optimised it out) then this is exactly the error you would expect to see.

There are three options:
1) Change the bootloader code to remove the check.
2) Include the string as a constant somewhere in your code (make sure it can't get optimised out).
3) Include flasherX in your main application so that it can update itself, this will result in the string being included automatically.

edit - you indicate that you're trying to upload the same code as is already running. This should work fine. Are you sure you're uploading the same .hex file and it was built for a teensy 4.0?
The check is that the board name is in the file. In order to check that it's correct the code must contain the string to look for which means by definition the correct string should be in there. Which means either a) you're using a different file or b) the compiler has done some very sneaky optimisation.
In your init() code add Serial.println(FLASH_ID); that will force it to print out the flash ID it thinks is correct for this board which in turn should stop it from trying to optimise the string out. You will need to #include "FlashTxx.h" if you aren't already for this to be defined.
 
Last edited:
Back
Top