Thread Tools
Aug 23, 2019, 11:00 AM
ErskyTx Developer
Mike Blandford's Avatar
Thread OP
Mini-HowTo

FrSky D16 firmware for D8 receivers


With FrSky phasing out support for the "old" D8 receivers, I have taken some code from "midelic" to get the D16 protocol running on D8 receivers.
This post will be updated to contain the details of how to carry out the flashing.

Instructions for Flashing (also see below for flashing once the bootloader is flashed).

The (first) image shows where there are two pads on a D8R-II that need to be shorted together to make the processor start in STM bootloader mode.
Flashing needs the STM Flash Loader Demonstartion program, downloadable from here: https://www.st.com/en/development-to...her-stm32.html.

The next image shows the first screen of the Flash Loader Demonstration program.

To flash a D8R-II, D8R-IIplus or a D8R-XP, you need a standard serial port (not a FTDI with a non-inverted output). I used a fdd_lite device from FrSky.
To put the receiver into STM bootloader mode, temporarily short the two pads shown in the first image.
Connect the ground signal from the serial device to GND, the transmit signal to Rx and the receive signal to Tx in the receiver, so crossing Tx and Rx between them.

Supply power to the receiver.
Run the Flash Loader program, select the COM port you serial device is using, then click the Next button. The first time you do this, it will indicate the chip is protected and ask if you wish to erase the entire chip. Confirm this (it will completely remove the FrSky firmware and bootloader so this is when you can't go back!). The next screen should indicate "Target is readable", and also show the Flash size. I see 16KB for a D8R-II, although it actually has 32K, this may be changed in the next screen. At present the firmware to flash fits in 16K.
Go to the next screen, then the one after that.
Select "Download to Device" and select the file to write. Also select "Erase necessary pages" and "Verify after download". The box labelled "@ (h)" should contain 8000000.
Click "Next" to write to the device.

After flashing, remove power, disconnect the serial device and remove the short on the pads. (For my testing I've wired a switch on the pads so I can quickly re-flash!).

The receiver is now ready for testing.

To use SPort sensors, you need to combine the Tx and Rx signals together with a diode or transistor, to provide the SPort signal, then get the positive supply from a servo connection (using a 'Y' lead if you need the servo output as well). The wiring, using a diode, is shown in the fifth image, and using a transistor is shown in the sixth image. I used a 1N4001 didoe (as used by FrSky for this purpose). Other diodes should also work, but make sure they are rated for at least 200mA forward current. The diode version works fine with standard FrSky sensors, but you may need the transistor version if you are using third party sensors or the openXsensor. The transistor version is also fine with FrSky sensors.

I've also added the script I'm using with erskyTx that allows "over the air" configuration and reporting. It should be fairly easy to translate this to a LUA script for openTx.
(Link to LUA version for the FrSky transmitters: https://www.rcgroups.com/forums/show...&postcount=224)
Seventh version also works with a second script that allows setting the output channel mapping.

Flashing with the bootloader
From the 211219 version onwards, a bootloader is included. To use this, link channel outputs 2 and 3 together, then power the Rx on. The red LED will flash on for a quarter of a second every second. Flash any update using the Tx and Rx (and ground!) connections using AVRDUDE. Then flash using the command:
-c arduino -p m328 -P COM4 -b 57600 -F -D -U flash:w:"Path\d8rii_rom.bin":r
where "Path" is the path to the file to flash, and change "COM4" to the COM port you are using. You need the -F option as the signature ID returned is not the correct one for an ATMEGA328.

First test version of the firmware now posted.
Second test version of the firmware added (30-Aug-2019).
Fix SBUS range, fix SBUS failsafe bit, add "lost frame" bit to the SBUS packet, fix errors when reading option links at end of binding.
Third test version of the firmware added (31-Aug-2019).
Fix 100 jump in lost packets. Fix errors in telemetry packet sequencing.
Fourth test version of the firmware added (02-Sep-2019).
Add SBUS output on channel 4 option (for D4R-II).
Fifth test version of the firmware added (03-Sep-2019).
Fix telemetry bug when using EU-LBT and channel is occupied.
Sixth test version of the firmware added (21-Dec-2019).
Add bootloader, Bind link on channels 1-2 selects SPort operation, Tx pin no longer supports SBUS (telemetry wouldn't work if it is enabled), 9mS servo pulse rate supported, tuning made optional.
Seventh test version of the firmware added (05-Feb-2020). Zip file includes updated D8rD16.bas script and a new D8rD16map.bas script.
Add code to prevent 0.9S lock out. Add option to invert the SBUS output(s). Add option to allow free allocation of channel outputs (these settings are not currently saved in the EEPROM!).
Eighth test version added (27-Mar-2020). Zip file includes updated D8rD16.bas script.
Channel output allocation now saved in EEPROM. Bind auto detects mode. Initial support for V2.1.0 protocol included.
Ninth test version added (31-Mar-2020). Update V2 protocol hopping table exceptions. Note that a rebind is needed to use the updated hopping table.
Tenth test version added (11-Apr-2020). Fix the V2 dual bind problem and the failure to restart telemetry after Tx power off.

Please test very carefully before using to control any aircraft.

Disclaimer: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This firmware is used at your own risk.

Mike
Last edited by Mike Blandford; Oct 20, 2020 at 11:02 AM.
Sign up now
to remove ads between posts
Aug 23, 2019, 11:27 AM
ErskyTx Developer
Mike Blandford's Avatar
Thread OP
Instructions for Use.

The receiver should behave similarly to before, but responding to D16 protocol.
To bind, power on with the bind button pressed, the red LED should be on solid and the green LED off.
Power on the Tx and select bind mode. After a short while the red LED should start to flash indicating the bind has completed. Note that the Rx is able to bind in both FCC and EU-LBT modes. To switch between these, press the bind button briefly. The red LED will blink off once for FCC mode and twice for EU-LBT mode. From version 270320 onwards, V2 protocol is also supported and you get three flashes for V2 FCC and four for V2 LBT. However this operation should be unnecessary as binding auto scans for the protocol to use. If bind doesn't take place, check you are operating in the correct mode. After a successful bind, the receiver will "remember" the mode used and continue to use the same mode unless you press the bind button.
After binding, power the receiver off then back on, and take the Tx out of bind mode. You should now have normal control operation.

The Rx sends some information back over the SPort:
AppId 0x52E0 - The percentage of dropped packets, sent every 300mS.
0x52F0 - The total number of dropped packets, sent once per second.

From the 211219 version onwards:
Due to a small change in the internal EEPROM allocation, you may need to rebind/reset options if upgrading from a previous version.
Channel 8 may optionally be configured to output SBUS instead of a servo signal. To select this, place a shorting link between the channel 8 and channel 7 outputs while binding.
Channel 4 may optionally be configured to output SBUS instead of a servo signal. To select this, place a shorting link between the channel 4 and channel 3 outputs while binding.
The Tx signal may optionally be configured to output SPort. To select this, place a shorting link between the channel 2 and channel 1 outputs while binding. Note that the hub telemetry input will no longer work (I may be able to fix this but needs a work around due to hardware restrictions in the processor). You may have 0, 1, both SBUS outputs enabled at any time.
During bind, the receiver attempts to "tune" itself to the transmitter carrier frequency.
Tuning in operation is optional, enable the use by placing a shorting link between the channel 6 and channel 5 outputs while binding.

The firmware also supports "Dual Bind". Once you have bound one transmitter, you may bind to a second transmitter. When this bind takes place, the information for the first transmitter is saved.
If you now power the first transmitter on and enter bind mode (second Tx off), then when you power the Rx on (no need to press the bind button) it will bind back to the first transmitter, now keeping the second transmitter details ready to rebind to that one.
Only one transmitter is actually bound at any one time and so able to operate servos etc.
At the end of binding, if you press the bind button, any saved details for a different transmitter are discarded.

The Rx sends some information back over the SPort:
AppId 0x52E0 - The percentage of dropped packets, sent every 300mS.
0x52F0 - The total number of dropped packets, sent once per second.

Configuration parameters that may be accessed:
Prim = 0x30 (read)
AppId 0x0C20 (same as X8R)
First byte of data E0 - channels 1-8 or channels 9-16
First byte of data E1 - SBUS output on ch 8
First byte of data E2 - SBUS output on ch 4
First byte of data E3 - SPort or hub telemetry
First byte of data E5 - Tuning enable
First byte of data E6 - Enable 9mS servo pulse period
First byte of data E7 - Individual channel 9mS setting
Value returned with Prim = 0x32 (response)
First byte of data E0 - second byte of data 0 = channels 1-8, 1 = channels 9-16
First byte of data E1 - second byte of data set if SBUS output on ch 8
First byte of data E2 - second byte of data set if SBUS output on ch 4
First byte of data E3 - second byte of data set if Tx/Rx used as SPort, otherwise Rx is hub telemetry input
First byte of data E5 - second byte of data set to enable tuning
First byte of data E6 - second byte of data set to enable 9mS servo pulse period
First byte of data E7 - second byte of data is a bit field, bit 0 set for channel 1 output to be 9mS, bit 1 for channel 2 etc. to bit 7 for channel 8
These may also be set using a Prim of 0x31. If a parameter is changed, the function affected should be actioned immediately.

From the 050220 version onwards:
First byte of data E8 - second byte of data is a bit field, bit 0 set for servo output mapping enable and bit 1 set for SBUS output mapping enabled
First byte of data E9 - second byte of data, output index, third byte of data actual channel for this output
First byte of data EA - second byte of data 0 for SBUS output(s) are inverted (standard setting), set to 1 for SBUS non-inverted

Up to the 030919 version:
Channel 8 may optionally be configured to output SBUS instead of a servo signal. To select this, place a shorting link between the channel 8 and channel 7 outputs while binding.
Channel 4 may optionally be configured to output SBUS instead of a servo signal. To select this, place a shorting link between the channel 4 and channel 3 outputs while binding.
The Tx signal may optionally be configured to output SBUS instead of a servo signal. To select this, place a shorting link between the channel 2 and channel 1 outputs while binding. Note that the hub telemetry input will no longer work (I may be able to fix this but needs a work around due to hardware restrictions in the processor).
You may have 0, 1, 2 or all 3 SBUS outputs enabled at any time.

During bind, the receiver attempts to "tune" itself to the transmitter carrier frequency.

The firmware also supports "Dual BInd". Once you have bound one transmitter, you may bind to a second transmitter. When this bind takes place, the information for the first transmitter is saved.
If you now power the first transmitter on and enter bind mode (second Tx off), then when you power the Rx on (no need to press the bind button) it will bind back to the first transmitter, now keeping the second transmitter details ready to rebind to that one.
Only one transmitter is actually bound at any one time and so able to operate servos etc.
At the end of binding, if you press the bind button, any saved details for a different transmitter are discarded.

Configuration parameters that may be accessed:
Prim = 0x30 (read)
AppId 0x0C20 (same as X8R)
First byte of data E0 - channels 1-8 or channels 9-16
First byte of data E1 - SBUS output on ch 8
First byte of data E2 - SBUS output on ch 4
First byte of data E3- SPort or hub telemetry
Value returned with Prim = 0x32 (response)
First byte of data E0 - second byte of data 0 = channels 1-8, 1 = channels 9-16
First byte of data E1 - second byte of data set if SBUS output on ch 8
First byte of data E2 - second byte of data set if SBUS output on ch 4
First byte of data E3- second byte of data set if Tx/Rx used as SPort, otherwise Rx is hub telemetry input
These may also be set using a Prim of 0x31
If a parameter is changed, the function affected will only be actioned after a power cycle to the Rx.

Statistics available (may be changed in future as these are for testing
Prim = 0x30 (read)
AppId 0x0C20 (same as X8R)
First byte of data FF - second byte of data 0 Total Dropped Pkts
First byte of data FF - second byte of data 1 Crc Errors
First byte of data FF - second byte of data 2 Drop Percent
First byte of data FF - second byte of data 3 Ave. Pkt Time
First byte of data FF - second byte of data 4 Backg time
First byte of data FF - second byte of data 5 Antenna Swaps
First byte of data FF - second byte of data 6 Total times telemetry not sent due to channel busy (LBT)
Value returned with Prim = 0x32 (response)
The values are returned as 16-bit values in the third and fourth bytes (least significant byte in the third byte).

MIke
Last edited by Mike Blandford; Mar 30, 2020 at 08:50 AM.
Aug 23, 2019, 04:40 PM
ErskyTx Developer
Mike Blandford's Avatar
Thread OP
The initial configuration available willbe:
8 servo outputs, Hub telemetry on Rx, and the option of SBUS on channel 8 instead of a servo pulse.

I believe I have diversity working as well, but that needs some careful testing. I also need to remove my debug, I'm currently using the A2 analog signal as a debug output (non-inverted serial data at 115200 baud).

This is a "one way" change. Once you put this firmware on your Rx, you can't go back to the original!

While binding (power on holding the bind button pressed), if you press the bind button it swaps mode between FCC and EU-LBT, flashing the red LED once for FCC and twice for LBT. Once bound, it remembers the last mode used and starts bind in the same mode.

Mike
Aug 23, 2019, 06:23 PM
Have Fun and Just Fly!
l shems's Avatar
Quote:
Originally Posted by Mike Blandford
The initial configuration available willbe:
8 servo outputs, Hub telemetry on Rx, and the option of SBUS on channel 8 instead of a servo pulse.

I believe I have diversity working as well, but that needs some careful testing. I also need to remove my debug, I'm currently using the A2 analog signal as a debug output (non-inverted serial data at 115200 baud).

This is a "one way" change. Once you put this firmware on your Rx, you can't go back to the original!

While binding (power on holding the bind button pressed), if you press the bind button it swaps mode between FCC and EU-LBT, flashing the red LED once for FCC and twice for LBT. Once bound, it remembers the last mode used and starts bind in the same mode.

Mike
Hi Mike,

Did you ever follow the double radio bind discussion?

Would it be possible to bind to two radios?
Aug 23, 2019, 07:26 PM
Registered User
You are relentless Mike! Thanks for sharing.
Midelic has announced to release a Frsky D16 DIY receiver a couple of years ago (I guess it was based on STM32 chip), but for whatever reason it has never happened.
Will your project include a DIY option?
Aug 23, 2019, 11:51 PM
Registered User
Why one-way ?
I can flash D8 into XP and reverse, why not this feature can't be preserved for this "D16"
Aug 24, 2019, 03:33 AM
ErskyTx Developer
Mike Blandford's Avatar
Thread OP
Quote:
Originally Posted by l shems
Hi Mike,

Did you ever follow the double radio bind discussion?

Would it be possible to bind to two radios?
It may be possible later but first I need to get the basics fully fuctional. It would also need careful consideration to ensure safety and only one Rx bound at a time.

Quote:
Originally Posted by JanRy
You are relentless Mike! Thanks for sharing.
Midelic has announced to release a Frsky D16 DIY receiver a couple of years ago (I guess it was based on STM32 chip), but for whatever reason it has never happened.
Will your project include a DIY option?
Not at present, I'm concentrating on FrSky D8 receivers.

Quote:
Originally Posted by renatoa
Why one-way ?
I can flash D8 into XP and reverse, why not this feature can't be preserved for this "D16"
The FrSky bootloader uses encrypted files and I don't know the encryption method so the only way to flash this new firmware is to erase the whole chip, so losing the FrSky bootloader.

Mike
Aug 24, 2019, 03:57 AM
Have Fun and Just Fly!
l shems's Avatar
Quote:
Originally Posted by Mike Blandford
It may be possible later but first I need to get the basics fully fuctional. It would also need careful consideration to ensure safety and only one Rx bound at a time....
If you ever find the time and feel to it, check this guide on dual bind and how it could work safely. It is a user guide for a nonexistent dual bind receiver.

https://www.rcgroups.com/forums/show...php?p=40623565
Aug 24, 2019, 12:05 PM
Registered User
pierrotm777's Avatar
Nice project than I shall follow.
Aug 24, 2019, 05:50 PM
ErskyTx Developer
Mike Blandford's Avatar
Thread OP
After some careful testing using various transmitters I noticed a X9Lite was slightly less "solid" than others. I think the D8 receiver RF circuitry is sufficiently different to a X8R that it upsets the received signal a bit. I found an adjustment to the RF chip settings that sorts this and the X9Lite is now as "solid" as the other radios.

Even before this change, I did a range test with a X9Lite and easily got 45 paces in range check mode with a servo responding all the time. I couldn't get any further away testing at home as I had already crossed to the other side of the road!

I'm using a SPort telemetry value (user application ID of 52F0) to return the number of "lost packets". as long as this stays at zero, or only changes occasionally then the RF link is good.

Having just checked a X8R with a logic analyser, I see I need to actually do a listen before sending telemetry data and not send it if the channel is occupied. That is the next thing to add.
I think I have everything else working.

Mike
Aug 25, 2019, 03:38 AM
Registered User
Great, I follow this thread now.

I have also a v8fr-2 rx is this rx also flashable with your version?
Aug 25, 2019, 10:00 AM
ErskyTx Developer
Mike Blandford's Avatar
Thread OP
I have no idea, I don't have any V8FR-II receivers so I don't know what processor is on them.

Mike
Aug 25, 2019, 10:28 AM
Registered User
pierrotm777's Avatar
Do you think adapt your code to rx-f802 receiver ?
Aug 25, 2019, 11:46 AM
ErskyTx Developer
Mike Blandford's Avatar
Thread OP
Again I don't have any rx-f802 receivers so I would need details about them and I wouldn't be able to test it.

Mike
Aug 25, 2019, 01:34 PM
Have Fun and Just Fly!
l shems's Avatar
Quote:
Originally Posted by Mike Blandford
After some careful testing using various transmitters I noticed a X9Lite was slightly less "solid" than others. I think the D8 receiver RF circuitry is sufficiently different to a X8R that it upsets the received signal a bit. I found an adjustment to the RF chip settings that sorts this and the X9Lite is now as "solid" as the other radios.

Even before this change, I did a range test with a X9Lite and easily got 45 paces in range check mode with a servo responding all the time. I couldn't get any further away testing at home as I had already crossed to the other side of the road!

I'm using a SPort telemetry value (user application ID of 52F0) to return the number of "lost packets". as long as this stays at zero, or only changes occasionally then the RF link is good.

Having just checked a X8R with a logic analyser, I see I need to actually do a listen before sending telemetry data and not send it if the channel is occupied. That is the next thing to add.
I think I have everything else working.

Mike
How well is this receiver compared to X8R regarding range?

Are there other receivers that can run this firmware, even existing D16 receivers?

Dual bind is really nice to have on D16.


Quick Reply
Message:

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Help! Noob trying to bind! Taranis mode D16, no D8 for D4R-ii! Freshage Radios 4 Mar 23, 2020 09:05 AM
Help! Snapper7 Firmware Flash or Change D16 to D8 hootsmin Micro Multirotor Drones 4 Jul 18, 2018 04:33 PM
Discussion Frsky D8 or D16 iwchris Radios 1 May 19, 2017 12:18 PM
Question From Taranis EU to having D8, D16 and LR12? Hobgoblin76 Radios 42 Apr 26, 2017 11:14 AM
Question FrSky X8R will only bind in D8, I want D16 Dutch RC Beginner Multirotor Drones 4 Apr 08, 2017 05:39 AM