Page 1 of 2

Maintenance mode

Posted: Fri Mar 23, 2018 7:40 pm
by MikeB
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

Re: Maintenance mode

Posted: Fri Mar 23, 2018 7:51 pm
by rcdiy
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?

Re: Maintenance mode

Posted: Fri Mar 23, 2018 10:58 pm
by MikeB
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

Re: Maintenance mode

Posted: Mon Mar 26, 2018 5:38 pm
by MikeB
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

Re: Maintenance mode

Posted: Mon Mar 26, 2018 10:51 pm
by jhsa
Mike, you are the absolutely BEST :) ;) :mrgreen:

João

Re: Maintenance mode

Posted: Wed Mar 28, 2018 8:10 pm
by MikeB
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

Re: Maintenance mode

Posted: Thu Mar 29, 2018 3:16 pm
by MikeB
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

Re: Maintenance mode

Posted: Fri Mar 30, 2018 11:23 am
by MikeB
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

Re: Maintenance mode

Posted: Fri Mar 30, 2018 1:04 pm
by jhsa
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

Re: Maintenance mode

Posted: Fri Mar 30, 2018 1:27 pm
by lancaster
I 'm not sure I understand it - but thanks for the work Mike !
regards
Hans

Re: Maintenance mode

Posted: Fri Mar 30, 2018 8:23 pm
by Rad
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?

Re: Maintenance mode

Posted: Fri Mar 30, 2018 8:45 pm
by jhsa
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

Re: Maintenance mode

Posted: Fri Mar 30, 2018 9:17 pm
by MikeB
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

Re: Maintenance mode

Posted: Fri Mar 30, 2018 9:52 pm
by jhsa
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

Re: Maintenance mode

Posted: Fri Mar 30, 2018 10:01 pm
by MikeB
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

Re: Maintenance mode

Posted: Fri Mar 30, 2018 10:16 pm
by jhsa
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

Re: Maintenance mode

Posted: Sat Mar 31, 2018 10:04 am
by MikeB
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

Re: Maintenance mode

Posted: Sat Mar 31, 2018 10:57 am
by MikeB
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

Re: Maintenance mode

Posted: Sat Mar 31, 2018 2:20 pm
by jhsa
Thanks Mike, later I will test with the encoder and also the 9XT.

João

Re: Maintenance mode

Posted: Sat Mar 31, 2018 4:08 pm
by Rad
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 :)

Re: Maintenance mode

Posted: Sat Mar 31, 2018 8:39 pm
by jhsa
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

Re: Maintenance mode

Posted: Mon Apr 02, 2018 10:00 am
by MikeB
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

Re: Maintenance mode

Posted: Mon Apr 02, 2018 10:07 am
by jhsa
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

Re: Maintenance mode

Posted: Mon Apr 02, 2018 11:28 am
by MikeB
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).

Re: Maintenance mode

Posted: Mon Apr 02, 2018 2:23 pm
by jhsa
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


Re: Maintenance mode

Posted: Sat Apr 14, 2018 7:00 pm
by Dilbert66
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

Re: Maintenance mode

Posted: Sun Apr 15, 2018 8:14 pm
by MikeB
An app should be OK as the bootloader itself on the Taranis actually runs in RAM so it can write to the flash!

Mike

Re: Maintenance mode

Posted: Mon Apr 16, 2018 10:17 pm
by Dilbert66
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.

Re: Maintenance mode

Posted: Mon Apr 16, 2018 10:45 pm
by MikeB
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

Re: Maintenance mode

Posted: Tue Apr 17, 2018 1:29 am
by Dilbert66
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.