Code Monkey home page Code Monkey logo

flysky-i6x_firmware_bugfix's Introduction

FlySky FS-i6X Firmware Bug Fix

Why is this needed?

The FlySky-i6X's official firmware has a bug which is decreasing its performance. It is not a hardware problem, but a software mistake. Unfortunately FlySky never addressed that bug with an official update. I tried on several occasions to get in contact with them and to ask them if they are even aware of the problem, but I never got any response back.

The effect of this bug is not so pronounced that it makes the radio unusable (obviously). It is also technical enough that its nature can be grasped only when working with blackbox logs and applying some observation. For the average user it is simply the case that this radio seems to be not of high enough quality compared to others.

This firmware patch will not give your radio "superpowers" but it will simply make it work as it was originally designed to.

This is how a single channel's data looks like before (with original firmware) and after (with bugfix):

Before-After

The problem is much more pronounced when using a digital protocol (IBUS or SBUS). PPM is not affected that much because by its nature it has lower frame rate than digital protocols.

If you just want to install the update head over to the How to flash section.

If you are interested in the details - read on.

The problem

The radio data from the transmitter is sent over 2.4GHz in frames (packets) of information. Each frame is a short sequence of binary data. There are different types of frames, carrying different kinds of information. The most important and most frequently sent frame type is the one that carries the channel data. These frames are sent at approximately 7 milliseconds interval (which is actually one of the best frame rates, compared to other radio brands).

The problem is that although frames are sent every 7ms, most of the time we receive several frames which carry the same channel data!

See this graph:

Stepped graph

This is just the first channel (roll). The rectangles represent the channel's value as it arrives with each frame. On the X axis we have time, on Y - the channel value [1000 - 2000]. Note how several consecutive frames carry the same channel value.

In many cases this is not necessarily a problem. It simply means that the effective frame rate is lower. For example instead of getting fresh channel data every 7ms, you get it every 14 or 21ms.

If you are flying airplanes or some other not-so-sensitive craft you might never sense a problem.

The problem becomes more pronounced when the radio is used for higher-performance quad copters for example.

Flight Controller software (Cleanflight, Betaflight) can detect quick movements of the sticks and apply further boost to the motors. This is much used in racing because it can provide more crisp and responsive behavior of the copter.

In former versions this feature was called Setpoint Weight, now it has been extracted as the F (Feedforward) gain of the PID loop. The Feedforward component is a direct derivative of the stick movement - if your stick is stationary F is zero, if your stick is moving F rises. The faster you move the stick, the higher F's value is (the sign of F depends on the direction you are moving the stick).

In the early days of flight controller software this has posed a problem: as we are using digital radio protocols and the channel data arrives in frames, channel values stay the same most of the time (between two frames) and then jump to their new values when a new frame arrives. This does not work very well with F, because in the time between frames, when channel values stay the same, F should be zero. On the other hand, when new frame with different channel value arrives, F reacts to the change and a F kick is produced. On the next iteration of the PID loop F drops to zero again because channel data once again stays the same until the next frame.

For this reason radio channel interpolation was implemented (and later a low pass filter) - the software tries to smooth out the "staircase" shape of the axis values, so that the derivative is also smooth and F kicks are avoided.

The following graph illustrates all this:

Stepped blackbox graph

It represents one channel (roll in the example). The curves are:

  • debug[0] is the raw radio data. Notice how it jumps to new values as new frames arrive.
  • RC Command is the above radio data but after the interpolation/smoothing filter has been applied.
  • Feedforward is the derivative of the above. Note that where RC Command is not changing (it is horizontal) F is zero and where RC Command is changing F has a value (the steeper the change of RC Command, the higher the value of F).

As it's visible, the step-like shape of the RC Command produces F kicks which can be quite significant. They translate to very erratic commands to the motors (they are asked very rapidly to increase speed then to reduce and so on) which decreases their effectiveness, increases heat and mechanical stress.

Although this problem affects F the most, P is not immune to it either:

P

We can see that P constantly changes direction while trying to keep the copter in sync with the stair case shaped commands.

So if the raw radio data passes through smoothing filter why is it still so step-like?

The answer lies in the way the software configures the smoothing filter. By default the amount of smoothing is determined automatically based on the interval at which channel frames arrive (the frame rate). With FS-i6X this is about 7ms and the filter is setup in such a way that it has to "connect the dots" of two frames.

Keep in mind that when using filtering the RC Command curve is about one-frame-time behind of the actual radio data. This is because in realtime the flight controller does not know if it has to smooth the current value up or down until it sees the next frame. That's why interpolation/filtering always introduces some delay.

Frames

Here with red we can see the actual frames (and because of the bug, several consecutive frames have the same value). As we can see the filter actually does pretty good job in smoothing out the curve between two frames. And here "between two frames" is the key. Consider two frames with the same value - the smoothing actually works there, they are connected with a straight line - there's no reason for the filter to make a curvy line between points of the same value!

In other words, from the filter's perspective there's no way to know that the arriving frame's data is wrong - it looks like perfectly valid channel data (maybe we are somehow really moving our sticks in such a way) and it does its best to smooth out the line between any two frames.

The fix

The firmware patch provided here fixes the software bug in the original firmware and sends the actual axes values at every frame. Here's the result:

Smooth graph

Smooth blackbox graph

Now the automatic RC filter achieves the desired effect and the F kicks are no longer present.

For more technical description of the fix see the source code

How to flash

  1. Head over to the releases section and download the bugfix updater program. Just in case, the original firmware is also provided.

  2. You need a special cable. It might be included in your box but mine, for example, came with no cable. In such a case you can either buy one or you can create one yourself. Unlike the FS-i6, which uses UART communication, the FS-i6X uses USB:

USB

  1. Connect the cable and open the System/Firmware update menu on your transmitter. Confirm that you want to enter the firmware update mode.

  2. Open the updater program. You should see the device detected:

Updater

If nothing appears in the updater you can try to put your radio in firmware updata mode by using this combination:

  1. Turn off your radio
  2. Hold simultaneously the left horizontal trimmer to the right and the left vertical trimmer down
  3. Turn on your radio

image

  1. Click Update

  2. After the transmitter is restarted you can make sure the new version is active from the System/Firmware ver. menu:

Version

  1. Enjoy!

Like it?

If having the full potential of your device brought a smile on your face, you may shine back if you feel like it: Donate
Thank you!!!

flysky-i6x_firmware_bugfix's People

Contributors

cleric-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flysky-i6x_firmware_bugfix's Issues

RSSI

Hello and greetings from Greece.
i saw your bug fix and its awesome,
curently was using a custom firmware that makes rssi osd work on channel 7,8 via the yt video https://www.youtube.com/watch?v=DxnWGq_h21o.

i flashed the bug fix firmware but rssi not working , is it a plan to the future for you to make it happen?

thank you

Hello

Good day! Flyplus firmware for i6x is old. Could you add telemetry sensor support to the new firmware?
I would be very grateful.

Updater exe is flagged as virus

Hi,

I know that you're not responsible for the original flysky updater exe's, but do you know why they are being flagged as Trojan:Win32/Occamy.C by windows defender?

That particular trojan appears to contain nc.exe so I woundered if flysky is doing some "calling home" during the update?

Anyway, I scanned the file with both ESET and Kapersky and they said the file was clear so I've updated my TX now - Cheers!

Asking for advice. How to get stared with firmware tweaks for the FS-i6X embedded processor and USB link question

Hi,
This is slightly off-topic, I apologize!
I am a technically interested person with a physics/IT background. After 40 years I am only starting again to play with the new technologies for radio control. I have a couple of questions regarding the current 2,4 GHz technology, hardware and firmware.
I understand that the embedded microcontroller is a STM32F072VBT6.
Which development environment do you use on which platform (WIN/Linux)?
Which disassembler?
How to extract the firmware from the Windows installer?
I'm impressed by Cleric-K's knowledge and presentation of the problem he solved. What is your hardware setup to produce those plots and graphs of the radio data?
Anybody with interest in these matters can reach me privately at [email protected]. I would like to start something like a public knowledge base for all iX6 or else.

I recently purchased a FS-iX6 transmitter. It came with a X6B receiver. I am still in the process of evaluating this set. One thing I would like to have a conversation about is the PS2 interface on the back of the transmitters. My transmitter came with a USB cable that seems to work fine as a simulator controller AND update link with a Windows 10 system. But I heard that some people were using adapter cables from AliExpress of Banggood. Any thoughts from the community?

Thank you!

Can you make Trainer Mode accept 8 channel from the Student?

Hi,
i6X's Trainer Mode only lets the student operate CH1~CH4, only 4 channels. Could you modify the firmware to accept all the 8 channel values from the Student PPM signal when Trainer Mode is activated?
I'm planning to make a driving cockpit for my FPV RC car, which has a drive wheel, pads, handbrake, gearbox handle... I tested some sensors and an Arduino to send out the PPM as a Student controller for I6X which worked. But 4 Channel is hard to add more interesting things like camera rotation, turning lights, NOS button...
If I6X has 8 channels of student control, it will be a great RC controller with Trainer Mode.

Hi

New version firmware for Flysky I6X 1.0.51.1440 - 20 SEP 2019. Please check this official firmware on the presence of a bug.
https://www.flysky-cn.com/fsi6x - New firmware in Download section.

Could you improve the trainer mode of the I6X firmware?

Hi,
The original firmware of I6X in trainer mode only takes CH1-CH4 of the student's PPM input. CH5-CH10 can only be operated with the switches of the trainer's controller. But the student's PPM signal carries CH1-CH8.
I reported this to Flysky a long time ago but no firmware update was given.
Could you modify the trainer mode part of the firmware to take CH1-CH8 of the student's PPM input?

hi there i have just updated my i6 radio to 10 channels and im trying to use various telemetary modules on it the only one showing is votage others are not coming on ie especially the altitude my freind who has i6x says it works on his radio is there something i could do to have all that on mine pleasesomehow imnew to allthis updating i just mananged to do my radio i have windows on my laptop thank you

          >Which development environment do you use on which platform (WIN/Linux)?

Depends on what you need. For the compilation of the patch I used Notepad++ to write the code and the standard gcc-arm toolchain for building.
If you want to write normal stm32 projects I use https://platformio.org/

Which disassembler?

IDA 7.0

How to extract the firmware from the Windows installer?

http://www.angusj.com/resourcehacker/
Although I dumped it directly from the transmitter, by connecting with ST-LINK. I used resourcehacker to replace the firmware in updater.exe with the patched.

What is your hardware setup to produce those plots and graphs of the radio data?

It's simply blackbox data from Betaflight FC. You need either RC_INTERPOLATION or RC_SMOOTHING debug mode. See https://github.com/betaflight/betaflight/wiki/Debug-Modes

One thing I would like to have a conversation about is the PS2 interface on the back of the transmitters. My transmitter came with a USB cable that seems to work fine as a simulator controller AND update link with a Windows 10 system. But I heard that some people were using adapter cables from AliExpress of Banggood. Any thoughts from the community?

FS-I6X uses USB communication. FS-I6 uses UART
image

TX and RX are for FS-I6's UART.
D+/- are for FS-I6X's USB.

Originally posted by @Cleric-K in #12 (comment)

GFX Editor

For fix firmware
1B9F3 128 48 Font
1C17A 56 36 FS AFHDS
1C292 52 14 Helicopter
1C2FA 52 14 Planer
1C362 64 12 SYSTEM
1C3E2 30 12 settings
1C459 23 7 battery
1C471 8 8 ->
1C479 76 12 FACTORY
1C511 93 12 FUNCTIONS
1C5CB 46 12 MENU
1C627 30 32 FlySky i6x
1C6A0 8 8 \/
1C6A7 82 15 AFHDS2A
1C74B 28 10 battery
1C782 16 32 switch down
1C7C2 16 32 switch up
1C803 32 32 sticks

for Original firmware
1F9F3 128 48 Font
2017A 56 36 FS AFHDS
20292 52 14 Helicopter
202FA 52 14 Planer

e.t.c

Where to connect "DIY" (seems to be a fifth switch??)

title says all
i do find a "DIY" in the setup ... seems as I could add one more switch to the i6x??
how and where ??
can we add more channels (analog) to the trx?? (i guess its doable and the case has enough room for one or two more poti)
a lot of unused pins on the stm hi hi

greetz sigi dg9bfc

update problem

hello
after updating the radio in firmware ver. shows me 1.0 Apr 05 2018
Is that how it should be?
I've also noticed that I now have 12 chanells in "display"
and it stopped working on the simulator.

Question: Binding necessary after update FlySky-i6X_Firmware_BugFix and Transmitter ID

Hi,
I upgraded a newly purchased i6X transmitter. No problem on the transmitter site. Thank you, Cleric for the good work. Is it necessary to rebind the X6B receiver after the update? I can't check this myself at the moment.
One other question is the issue of transmitter ID. In the qba667/FlyPlusI6X project it is mentioned that the transmitter ID need to be reentered after the update. Is this also a concern for the FlySky-i6X_Firmware_BugFix?

Thank you!

Merge with FlyPlusI6X

Hello,

would it be possible to release firmware with your patch which would basically include features from FlyPlusI6X? (https://github.com/qba667/FlyPlusI6X). Seems like that would be the best from both worlds. Now it seems like one has to decide whether he prefers features or the performance (quality).

Thank you in advance for thinking about it and thank you for this patch and for all your time dedicated to this stuff!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.