1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

DMA bit banging Dshot, first cut

F405 working (OMNIBUSF4SD target)
F411 not tested
F722 working, needs testing (OMNINXT7 target)
F74x not working

NOX target (temporary)

bb_dshot with telemetry on f4
bbshot f7 targets and fix crash due to missing debug pins

remove empty line

add empty lines

remove OMNIBUSF4 specific debug pins

add missing comma

add missing comma

Use separate bbTimerHardware array to fix unified targets

eliminate now unneeded timerGetByUsage

don't duplicate timer1 def

Add auto mode, rename dshot_bbshot to dshot_bitbang

remove newline

renamve various files

various changes to address feedback

address feedback

address feedback

add pacer timers to timer show

don't disable telemetry if dshot_bitbang is on or auto

Address feedback, add faster decode implementation based on bit banding, modify dma parameters to reduce required memory bandwidth on half

remove debug output

remove NOINLINE

Protect gpio direction change with critical sections

FIXWS_SAVE_INDEX

add static back in

no forward typedef

address review feedback

disallow proshot1000 with dshot bitbang

Extracted and plumbed up 'dbgPin'.
This commit is contained in:
jflyper 2019-08-13 08:54:16 +09:00 committed by Michael Keller
parent 37b059532f
commit adf6fd1764
33 changed files with 2065 additions and 77 deletions

View file

@ -5616,12 +5616,28 @@ static void showTimers(void)
cliRepeat('-', 23);
#endif
#ifdef USE_DSHOT_BITBANG
resourceOwner_t bitbangOwner = { OWNER_DSHOT_BITBANG, 0 };
#endif
int8_t timerNumber;
for (int i = 0; (timerNumber = timerGetNumberByIndex(i)); i++) {
cliPrintf("TIM%d:", timerNumber);
bool timerUsed = false;
for (unsigned timerIndex = 0; timerIndex < CC_CHANNELS_PER_TIMER; timerIndex++) {
const resourceOwner_t *timerOwner = timerGetOwner(timerNumber, CC_CHANNEL_FROM_INDEX(timerIndex));
#ifdef USE_DSHOT_BITBANG
if (!timerOwner->owner) {
const timerHardware_t* timer;
int pacerIndex = 0;
while ((timer = dshotBitbangGetPacerTimer(pacerIndex++))) {
if (timerGetTIMNumber(timer->tim) == timerNumber && timer->channel == CC_CHANNEL_FROM_INDEX(timerIndex)) {
timerOwner = &bitbangOwner;
bitbangOwner.resourceIndex++;
break;
}
}
}
#endif
if (timerOwner->owner) {
if (!timerUsed) {
timerUsed = true;
@ -5879,12 +5895,11 @@ static void cliDshotTelemetryInfo(char *cmdline)
UNUSED(cmdline);
if (useDshotTelemetry) {
cliPrintLinef("Dshot reads: %u", readDoneCount);
cliPrintLinef("Dshot invalid pkts: %u", dshotInvalidPacketCount);
cliPrintLinef("Dshot reads: %u", dshotTelemetryState.readCount);
cliPrintLinef("Dshot invalid pkts: %u", dshotTelemetryState.invalidPacketCount);
uint32_t directionChangeCycles = dshotDMAHandlerCycleCounters.changeDirectionCompletedAt - dshotDMAHandlerCycleCounters.irqAt;
uint32_t directionChangeDurationUs = clockCyclesToMicros(directionChangeCycles);
cliPrintLinef("Dshot directionChange cycles: %u, micros: %u", directionChangeCycles, directionChangeDurationUs);
cliPrintLinef("Dshot packet decode micros: %u", decodePacketDurationUs);
cliPrintLinefeed();
#ifdef USE_DSHOT_TELEMETRY_STATS
@ -5913,12 +5928,19 @@ static void cliDshotTelemetryInfo(char *cmdline)
cliPrintLinefeed();
const int len = MAX_GCR_EDGES;
#ifdef DEBUG_BBDECODE
extern uint16_t bbBuffer[134];
for (int i = 0; i < 134; i++) {
cliPrintf("%u ", (int)bbBuffer[i]);
}
cliPrintLinefeed();
#endif
for (int i = 0; i < len; i++) {
cliPrintf("%u ", (int)inputBuffer[i]);
cliPrintf("%u ", (int)dshotTelemetryState.inputBuffer[i]);
}
cliPrintLinefeed();
for (int i = 1; i < len; i++) {
cliPrintf("%u ", (int)(inputBuffer[i] - inputBuffer[i-1]));
cliPrintf("%u ", (int)(dshotTelemetryState.inputBuffer[i] - dshotTelemetryState.inputBuffer[i-1]));
}
cliPrintLinefeed();
} else {
@ -6566,4 +6588,5 @@ void cliEnter(serialPort_t *serialPort)
resetCommandBatch();
#endif
}
#endif // USE_CLI