Maintenance mode

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Maintenance mode

Post by MikeB » Fri Mar 23, 2018 7:40 pm

On ersky9x, I have a "maintenance mode" that handles things like updating the bootloader and flashing SPort devices. It also allows flashing the multiprotocol module. This last is not in openTx, and I'm not sure it is going to be added.
I can think of a number of useful options that could be added, but they require that openTx is modified to add them.

I've been looking in to this and have a possible solution that doesn't rely on openTx being changed. I have a "proof of concept" working.
On the Taranis, the bootloader runs in RAM, but uses less than 64K of the 128K available.
I have changed my bootloader to include a new option "Run App". This loads and runs a program from the SD card, using 64K of RAM (max of 32K for the "app" code) located in the second 64K of RAM. This is working and I have a small "app" that loads and runs and displays some options on the display and allows you to select one, so buttons and the display all work.

My idea is to have an "app" that just does the flashing of a MultiProtocol module, and then others that allow for different functions. In ersky9x, in "maintenance mode", I have a function to allow the SPort ID of a sensor to be changed. This could be another "app".
I have also just got the same "app" running on a SKY board, which has the smallest amout of RAM available.

To use such a facility does not require openTx to be modified, just flash an alternative bootloader, then run an app from there to carry out these sorts of functions.

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
rcdiy
Posts: 190
Joined: Fri Jul 01, 2016 6:13 am
Country: Canada
Contact:

Re: Maintenance mode

Post by rcdiy » Fri Mar 23, 2018 7:51 pm

I like the idea:) Just thinking for the point of view of documenting this.
As a user/documenter with regards to OpenTX"
Where would I go to get the boot loader with app option?
Is the boot-loader installed by navigating to the download using the SD CARD screen and then long pressing enter?
What is the risk that the TX gets bricked?
Who would I report possible bugs to?
How many different apps do we possibly have to start with?
How are apps added or removed and stored?
RCdiy.ca
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Fri Mar 23, 2018 10:58 pm

The source code of the bootloader(s) is here: https://github.com/MikeBland/OpenRcBootloader. Normally these get built into ersky9x, I'd would need to write and build special versions if the bootloaders were to be available separately as there is specific code also needed to detect the trims being pressed.

Yes, if you put the appropriate version of ersky9x in the firmware folder, you may flash the bootloader from that.

No worse than flashing the wrong bootloader from openTx.

Bugs would likely be reported to me, or whoever might write an "app". I'll probably include the code of some "app"s on the OpenRcBootloader repository, since they will almost certainly use some of the files used to build the bootloaders.

Probably only 1 or 2 "app"s to start with, they need to be compiled for the different hardware (X9D, X9DP, QX7, SKY, AR9X, 9XR-PRO etc.).

I've created an "apps" folder off the root of the SD card where they reside, adding or removing is simply adding or removing files to/from this folder.

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Mon Mar 26, 2018 5:38 pm

I've just posted a test version of ersky9x (ProvR222a2) (http://openrcforums.com/forum/viewtopic.php?f=7&t=4676) for the Taranis, Taranis Plus and the QX7(s). The bootloader in these has the options of "Flash Firmware" and "Run App". I haven't had the "Restore EEPROM" in my version of the bootloader, so I don't have that available (yet). I'll either add that, or make it another "app"!

The .zip file also includes an app for each of these transmitters, you need to use the "app" that matches your hardware.
Each "app" includes an identifier of the hardware on which it runs. The bootloader checks any "app" it loads and only runs it if the identifier matches the bootloader.

To use this with openTx, just copy the required .bin file to your firmware directory, and copy the required "app" file to an "apps" directory.
Use openTx to update the bootloader on the radio from the .bin file.
Now restart the radio in bootloader mode, choose the "Run App" option, then select the "FlashMulti" "app".

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Mon Mar 26, 2018 10:51 pm

Mike, you are the absolutely BEST :) ;) :mrgreen:

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW


User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Wed Mar 28, 2018 8:10 pm

I've just posted ersky9x (ProvR222a3), which includes bootloaders for the Atmel based boards that allow running "apps". It also includes an "app" for these for flashing the Multi Module.
The bootloader for the 9Xtreme also includes the "Run App" function. I need to test the "FlashMulti" app on the 9Xtreme, particularly for the internal module and COM2.
In time I may remove the option for flashing the Multi Module from the SKY version maintenance mode (ersky9xs_rom.bin), to save some flash space. I'll leave it in the others.

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Thu Mar 29, 2018 3:16 pm

Removing the "Flash Multi" option from the SKY version saves 1980 bytes of flash. Since we only have 6300 bytes of flash spare, this is useful.

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Fri Mar 30, 2018 11:23 am

For the SKY board, I have now got a "FlashCoPro.app" working for updating the co-processor. Removing this option from "maintenance mode", this saves around another 700 bytes of flash.
I'll do an app for the "Update Xmega" option, which is only rarely needed (flashing the Orange DSM module).

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Fri Mar 30, 2018 1:04 pm

I still have to try it (been busy with other stuff), but I do like the app idea.. :) You always find a way of saving some bytes ;) :) :mrgreen:
Perhaps Eepskye could be made as an app for android? ;)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

lancaster
Posts: 178
Joined: Thu Jun 12, 2014 10:28 pm
Country: United Kingdom

Re: Maintenance mode

Post by lancaster » Fri Mar 30, 2018 1:27 pm

I 'm not sure I understand it - but thanks for the work Mike !
regards
Hans

Rad
Posts: 176
Joined: Wed Apr 20, 2016 3:43 pm
Country: -

Re: Maintenance mode

Post by Rad » Fri Mar 30, 2018 8:23 pm

Hi Mike, 9xtreme with ersky9xProvR222a4, bootloader 2.9 and I have the run app window on screen... But where do I put the app? Do I have to create a folder or something? I guess the app I have to put in the radio is the FlashMulti_atmel.app right?

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Fri Mar 30, 2018 8:45 pm

MikeB wrote:
Mon Mar 26, 2018 5:38 pm

To use this with openTx, just copy the required .bin file to your firmware directory, and copy the required "app" file to an "apps" directory.
Use openTx to update the bootloader on the radio from the .bin file.
Now restart the radio in bootloader mode, choose the "Run App" option, then select the "FlashMulti" "app".

Mike
It might be the same as for OpenTX? ;)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Fri Mar 30, 2018 9:17 pm

Yes, .app files go in the "apps" directory in the root.
For the 9Xtreme, you will need "FlashMulti_9xt.app". I haven't posted this yet as I have a problem with the backlight brightness and with the display "flickering" when flashing, although it flashes an external module OK. I have yet to try on an internal module.

The option to flash the multi module is still available in "maintenance mode".

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Fri Mar 30, 2018 9:52 pm

Mike, run app for ATMEL radios is not working well.
Ar9x Radio with Ersky9x. Enter the flash multi app. navigation keys up and down are swapped.. pressing up moves down and pressing down moves up.. Encoder seems to move in the right direction, but it is hard to stop in the module selection line.
Difficult to select internal / external.. Encoder and Keys.
To change the settings on one line, you need to select the previous line. For example, to change the COM port, you need to select the RF Module setting. to invert the com port, you need to select the COM port selection line, and so on.
Once I managed so select update and enter the file section screen, i can't navigate up or down, Only sideways..
Am I doing something wrong??

Thanks
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Fri Mar 30, 2018 10:01 pm

The 9Xtreme app is crashing when trying to flash an internal module, so I can't post it yet.

The app for Atmel radios is working fine for me, on both a SKY board and an AR9X (with 4S8 processor, and I had previously checked it in an AR9X with a 3S8 processor).

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Fri Mar 30, 2018 10:16 pm

Well, it isn't on mine.. :o

This radio has encoder, and internal STM32 multi module on COM2 inverted. Original processor. So, the question is what might be causing it not to work?
Let me flash the other Ar9x radio.. Internal DHT, so flashing only external modules.

OHHHH, wait.. I have just managed to flash the internal module, so it works on Ar9x and using COM2.. If I don't touch the encoder all works as it should.. If I touch the encoder's wheel, I start getting the odd behavior I described above..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Sat Mar 31, 2018 10:04 am

I've posted an updated "FlashMulti_atmel.app" that should fix the encoder problem. Because the app doesn't have access to the radio setting for the encoder divider, I've now selected the divide by 4 option. This does mean that, depending on the encoder fitted, you may need to move the encoder more than 1 "click" to get a response.

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Sat Mar 31, 2018 10:57 am

Rad wrote:
Fri Mar 30, 2018 8:23 pm
Hi Mike, 9xtreme with ersky9xProvR222a4, bootloader 2.9 and I have the run app window on screen... But where do I put the app? Do I have to create a folder or something? I guess the app I have to put in the radio is the FlashMulti_atmel.app right?
I've just posted the "FlashMulti" app for the 9Xtreme. Unzip this and put it in an "apps" directory in the root of the SD card.

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Sat Mar 31, 2018 2:20 pm

Thanks Mike, later I will test with the encoder and also the 9XT.

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

Rad
Posts: 176
Joined: Wed Apr 20, 2016 3:43 pm
Country: -

Re: Maintenance mode

Post by Rad » Sat Mar 31, 2018 4:08 pm

MikeB wrote:
Sat Mar 31, 2018 10:57 am
Rad wrote:
Fri Mar 30, 2018 8:23 pm
Hi Mike, 9xtreme with ersky9xProvR222a4, bootloader 2.9 and I have the run app window on screen... But where do I put the app? Do I have to create a folder or something? I guess the app I have to put in the radio is the FlashMulti_atmel.app right?
I've just posted the "FlashMulti" app for the 9Xtreme. Unzip this and put it in an "apps" directory in the root of the SD card.

Mike
Done, I launched the app and works :)

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Sat Mar 31, 2018 8:39 pm

Problem with the encoder on Ar9x solved.. I do need to rotate the encoder wheel 2 clicks to move 1 line..

9xtreme, successfully flashed internal module. encoder does not work at all..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Mon Apr 02, 2018 10:00 am

I've posted an updated "FlashMulti" app for the 9Xtreme that might get the encoder working, I can't test the encoder however as my 9Xtreme doesn't have one.

I've also posted apps that allow you to change the physical ID of FrSky SPort devices.

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Mon Apr 02, 2018 10:07 am

Thanks Mike.. Encoder now works with the app, but it doesn't work to select between app and flashing firmware, and it also doesn't work to navigate the firmware files..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Mon Apr 02, 2018 11:28 am

Some radios don't have encoders, some only have encoders (X7) and some have both. I'll see if I can enable the encoder code for the 9Xtreme to select the firmware file. Selecting between the flashing firmware and the app is in the bootloader. With only one item to move between, I'll leave that as it is for now.

Mike

Edit: I can't see why the encoder doesn't work for file selection if it works to select the options (like BIN/HEX).
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
jhsa
Posts: 17923
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Maintenance mode

Post by jhsa » Mon Apr 02, 2018 2:23 pm

Mike, I meant to say that it doesn't work when navigating the SD Card firmware files while in bootloader mode.

Thanks

João

Sent from my BLN-L21 using Tapatalk

My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

Dilbert66
Posts: 6
Joined: Thu Apr 13, 2017 11:57 am
Country: Canada
Location: Toronto

Re: Maintenance mode

Post by Dilbert66 » Sat Apr 14, 2018 7:00 pm

Hi Mike, just posting some thoughts on a future app possibility. I currently use your bootloader on all my radios, even on my taranis 9xdplus which uses opentx 2.2.1 since I do like the ability to flash my multiprotocol modules and the sport id change capability. Great concept!! Only thing that I miss on my Taranis is the Restore Eeprom capability. Yes, if i needed to do that , i can still restore the opentx bootloader, then access the restore eeprom function from it, but it's a pain in the you know what . I like messing around with different firmware variations, etc so like the ease of going back and forth without having to keep restoring using my pc. I do realize the possible danger of eeprom corruption when this is done but I've never had issues so far. Is flashing eeprom from a RAM based application a recipe for disaster or best to leave it as part of a bootloader function that resides in flash? I like the idea of it being an app because of it's versatility..

Edit: just re-read your earlier posts and realized you had already noted the possibility of having a restore eeprom app :) Gotta love the flexibility of the app concept.


Alain
Last edited by Dilbert66 on Tue Apr 17, 2018 1:54 am, edited 1 time in total.

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Sun Apr 15, 2018 8:14 pm

An app should be OK as the bootloader itself on the Taranis actually runs in RAM so it can write to the flash!

Mike
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Dilbert66
Posts: 6
Joined: Thu Apr 13, 2017 11:57 am
Country: Canada
Location: Toronto

Re: Maintenance mode

Post by Dilbert66 » Mon Apr 16, 2018 10:17 pm

Interesting.. I had a look at the linker files for both projects and yes, I can see that the ersky9x bootloader gets moved to ram after initial start if required via loadboot while opentx runs its own bootloader from flash. It is kinda cool how it's done that either way, both bootloaders will work with either firmware.

User avatar
MikeB
9x Developer
Posts: 15651
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Maintenance mode

Post by MikeB » Mon Apr 16, 2018 10:45 pm

That's a change, openTx was also copying the bootloader to RAM. I did it that way so that while writing to the flash memory the bootloader code is not "stalled", with the possibility of causing problems with the USB connection.

MIke
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Dilbert66
Posts: 6
Joined: Thu Apr 13, 2017 11:57 am
Country: Canada
Location: Toronto

Re: Maintenance mode

Post by Dilbert66 » Tue Apr 17, 2018 1:29 am

Looks like they switched it around in 2.2. 2.1 was using ram. I don't know the reasoning for it.

Edit: looks like it was introduced as a new version of bootloader with support for the Horus for flashing firmware via usb or sd card.

Post Reply

Return to “openTx”