If you want to have a custom OSD, my advice is don’t start from scratch, hack one. OSDs are useful because they let you display information over a video feed. Most come pre-configured to interface with a flight controller but only display pre-determined information. To make an OSD from scratch you have to solve some complex video detection and syncing issues. Next, you will need a large high-speed memory buffer that can refresh 200K pixels at 60Hz. Plus plenty of memory for fonts and special characters.
So if you want an OSD and don’t want to re-invent the wheel, use one that already exists. Luckily the FrSky OSD has a protocol that is somewhat easy to implement. Not only that, they have a desktop simulator that lets you do development before running on actual hardware. Bang Bang.
The github has good documentation, but here is a basic example you can build on.
Step 1 – Go to Github and download the simulator
Check out docs on all the different commands that the FrSky OSD recognizes.
Step 2 – Launch the Simulator from the CMD prompt
C:\Users\JCM\Desktop>osd-simulator.exe --serial-port com8
Change the com8 port for your system
Step 3 – Send the following string of bytes at 115200 baud
serial.tx($24) '$ 1st byte header
serial.tx($41) 'A 2nd byte header
serial.tx(12) 'number of bytes following not including the CRC
serial.tx(48) 'send the string command
serial.tx( %0001_1011) ' point osd_point_t 12 bits format for x and y
serial.tx( %0000_0001) ' Point int x: 283; y: 32
serial.tx( %0000_0010)
serial.tx( %0000_0000) ' BITMAP_OPT_INVERSE = 1 << 0: Invert black and white colors
serial.tx(6) ' String size in bytes
serial.tx("W")
serial.tx( "I" )
serial.tx( "N")
serial.tx( "G" )
serial.tx( "S" )
serial.tx( 0 ) 'zero
serial.tx($0F) 'CRC
As a sanity check here is the hex string used to get the CRC with the DVB-S2 algorithm.
0x0c 0x30 0x1b 0x01 0x02 0x00 0x06 0x57 0x49 0x4e 0x47 0x53 0x00
Generating the CRC codes was the hardest part for me. I relied heavily on these two calculators to figure out CRC.
And if everything goes well you will have “WINGS” on the screen. With a bit more coding you can replicate this Pitch and Roll AHI.
Side Note – I’m using the Parallax Propeller chip, its an 8 core micro-controller, with no interrupts, deterministic timing, and runs at 80Mhz. I like it for MANY reasons, but unfortunately, it's often overlooked for the less powerful Arduino. More on the chip another day, but fair warning the syntax is totally unique. Here is a block diagram of the guts.
Here is the .spin code snipit to run the AHI.
Next month, the IMU code....
Hi Jon, Do you have a clone or archive of the FrSky OSD repo that includes the commit you reference? FrSky have deleted their repo for some reason. If you do please can you give me a url to it please so I can tag it in my fork. I run a fork of the FrSkyPixelOSD documentation and firmware here, which includes the tool: https://github.com/hydra/FrSkyPixelOSD In related news, I also published my SPRacingPixelOSD system including schematics and source, it's here: https://github.com/spracing/spracingpixelosd