-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FSK DAC: 1200bps telemetry over audio (similar to Bel202 encoding) #2202
Conversation
This will be a pios_com interface that generates Bell202 encoded data on the DAC DMA channel.
Because MARK is 1200Hz and SPACE is 2200Hz at 1200bps there will not be an integer number of cycles for a space. Thus we have to work out the phase we end each symbol at and make sure to start the next one at that phase. This also drops the code that sends a mid-voltage between symbols and it constantly outputs MARK when awaiting a new byte.
This is required for FSKDAC since we use the middle of a DMA to schedule what the next symbol should be, rather than waiting to the end.
This makes sure we are prepared to send the next symbol when the buffer swaps.
For some reason, disabling the DMA HT flag, which should reduce the CPU utilization, ultimately results in some of the start symbols being dropped. There doesn't appear to be a clear software bug, so perhaps this is some kind of hardware erata when rapidly toggling IRQ enables.
This is enough to hold the largest packet but too small to hold two packets. This prevents them stacking up in the COM buffer and introducing latency.
}; | ||
|
||
struct pios_fskdac_dev { | ||
enum pios_fskdac_dev_magic magic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra whitespace.
This provides the smoothed altitude and climb rate
For such a low bandwidth link we should send the smoothed altitude rather than raw baro samples to reduce noise.
#include "manualcontrolcommand.h" | ||
#include "flightstatus.h" | ||
#include "positionactual.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alphabetization, my favorite!
Good stuff. I'm trusting that the modem math works, I haven't vetted it very closely. The only remaining question before merging is whether you'd like to move the |
Yeah the math works. If you have a clever thought about converting the phase alignment calculation |
PS comments from review should be addressed now. |
Nothing instantly occurs to me, but I'm not sure the |
FSK DAC: 1200bps telemetry over audio
There's a bit more to it than that-- you burn significant precision with those operations. https://github.com/eblot/newlib/blob/master/newlib/libm/math/ef_fmod.c |
@kubark42 not much precision since it just determines an integer offset into the next buffer |
* Schedule the next bit to be written by setting the address of the | ||
* double buffer | ||
*/ | ||
static void pios_fskdac_set_symbol(struct pios_fskdac_dev * fskdac_dev, uint8_t sym) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked at this section a little more. If you have a moment, a future PR which expanded the theoretic justification for this section would be most welcome. Perhaps just links to the documents you used to develop this would be enough to maintain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Probably best for me to just explain here since I created this based on just tying to achieve continuous phase while transitioning between symbols.
Unfortunately good sources on Bell 202 are lacking, so I can't be sure this is fully compatible with hardware implementations. That would be reflected in the state system below as it reflects more on how you map a byte into a sequence of mark/space symbols.
BTW @kubark42 check out https://www.instagram.com/p/BCRgrnjFquF/ so now any FPV recording has a data log (slow). |
Also @KipK not sure if you are still active but thought you might like this. I'd love to know if this is actually compatible with the chip you use in ghettostation. |
That's pretty neat stuff. Are you exporting it to KML? |
@kubark42 yeah. And there is a neat gx:Track type that Google earth supports animates the flight path too, which is kind of fun |
} | ||
|
||
#if defined(PIOS_INCLUDE_FREERTOS) | ||
portEND_SWITCHING_ISR((rx_need_yield || tx_need_yield) ? pdTRUE : pdFALSE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When compiling with FreeRTOS, this fails with unknown variables.
This creates a PIOS_COM interace to the DAC output that creates
a 1200bps audio modem. The stream is modulated similarly to V.23
encoding using 1 start and 1 stop bits, 1 parity bit. The two symbols
are centered at 1200 and 2200 Hz.
The data source tested with this is the light telemetry module that was
developed for this purpose of low bandwidth telemetry, previously using
a hardware serial stream to audio modem chip.