Skip to content
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

Enabled timer management for all F405 / F722 boards. #7620

Merged
merged 1 commit into from Feb 27, 2019

Conversation

mikeller
Copy link
Member

This is a proposal to, instead of only enabling timer management on unified targets, enable it for all targets with MCUs that have had full lists of all timer / pin combinations generated (stored in fullTimerHardware). Motivation for this:

  • why treat the unified targets as 'exotics' that use features not used on any other targets? 'dogfooding' the timer management support on non-unified targets will help us find and iron out problems faster;
  • this makes migration of existing targets to unified targets real easy: Once timer list output has been added to the diff/dump output, all it will take is a dump with non-hardware-related parts deleted to serve as a unified target config;
  • this will enable features that require non-standard timer / DMA configurations to be used (like bidirectional Dshot) to be tested with firmware binaries from master.

It is currently incomplete as any non-standard DMA options encoded in target definitions as part of timerHardware are ignored - supporting these will require support for configurable DMA options for timers that @jflyper is working on.

@mikeller mikeller added this to the 4.0 milestone Feb 20, 2019
@mikeller mikeller force-pushed the add_timer_management_to_all_f4 branch 2 times, most recently from 7dc4ce8 to 17ae1d0 Compare February 23, 2019 23:58
@mikeller
Copy link
Member Author

@jflyper: My last commit adds support for configurable DMA options for timers. Can you please review?

N.b.: The conversion to actually use configurable DMA options has only been done for Dshot, other consumers of timer pin resources will have to be modified as well. Also, currently CLI only prints the timer DMA options, setting them will have to be done. (Suggestion: use dmaopt pin <pin id> <option> as the format.)

@mikeller
Copy link
Member Author

Ok, I think this is pretty much ready to go in now. What it does:

  • add configurability for DMA options on timers (F4, F7, needs USE_TIMER_MGMT, USE_DMA_SPEC);
  • enables USE_TIMER_MGMT for all F405, F7x2, so that timers can be reassigned on non-unified targets as well (will make the transition a lot easier);
  • print timer DMA option (by pin) with dmaopt in CLI;
  • fix USE_DMA_SPEC on F3 (needed this for testing).

What it does not do:

  • reassign DMA option in CLI - this is more or less trivial, and can be added in another pull request;
  • generic timer to pin matrices for the less common MCU types (F411, F745, ...) still need to be loaded.

@mikeller
Copy link
Member Author

Rebased & squashed.

This is the last call for reviews. There is more work stacked up behind this, and waiting longer will jeopardise the feature freeze for the 4.0 release, so if nobody wants to review this I'll merge it.

@mikeller mikeller force-pushed the add_timer_management_to_all_f4 branch from 650e0df to 331dcbd Compare February 27, 2019 10:18
…r all F4 boards.

Converting the universal target as well.

Simplified timer management some.

Added F722 support for good measuer.

Fixed SITL, tests.

Cleanup after rebase.

Added support for all timer consumers and F7.

Fixed 'USE_DMA_SPEC' for F3, some cleanups.
@mikeller mikeller force-pushed the add_timer_management_to_all_f4 branch from 331dcbd to f8103b8 Compare February 27, 2019 11:25
@mikeller mikeller merged commit 750e7c3 into betaflight:master Feb 27, 2019
@mikeller mikeller deleted the add_timer_management_to_all_f4 branch February 27, 2019 12:21
@etracer65
Copy link
Member

One thing I'm not sure about is the dmaopt all output that also seems to be included in the dump. For example:

# dmaopt all
dmaopt SPI_TX 1 NONE
dmaopt SPI_TX 2 NONE
dmaopt SPI_TX 3 NONE
dmaopt SPI_RX 1 NONE
dmaopt SPI_RX 2 NONE
dmaopt SPI_RX 3 NONE
dmaopt ADC 1 1 # DMA2 Stream 4 Channel 0
dmaopt ADC 2 NONE
dmaopt ADC 3 NONE
dmaopt UART_TX 1 NONE
dmaopt UART_TX 2 NONE
dmaopt UART_TX 3 NONE
dmaopt UART_TX 4 NONE
dmaopt UART_TX 5 NONE
dmaopt UART_TX 6 NONE
dmaopt UART_TX 7 NONE
dmaopt UART_TX 8 NONE
dmaopt UART_RX 1 NONE
dmaopt UART_RX 2 NONE
dmaopt UART_RX 3 NONE
dmaopt UART_RX 4 NONE
dmaopt UART_RX 5 NONE
dmaopt UART_RX 6 NONE
dmaopt UART_RX 7 NONE
dmaopt UART_RX 8 NONE
dmaopt B14 NONE
dmaopt B15 NONE
dmaopt C06 0
# C06: DMA2 Stream 2 Channel 0
dmaopt C07 0
# C07: DMA2 Stream 2 Channel 0
dmaopt C08 0
# C08: DMA2 Stream 2 Channel 0
dmaopt C09 0
# C09: DMA2 Stream 7 Channel 7
dmaopt B00 0
# B00: DMA1 Stream 7 Channel 5
dmaopt B01 0
# B01: DMA1 Stream 2 Channel 5
dmaopt A03 1
# A03: DMA1 Stream 6 Channel 3
dmaopt A02 0
# A02: DMA1 Stream 1 Channel 3
dmaopt A01 0
# A01: DMA1 Stream 4 Channel 6
dmaopt A00 0
# A00: DMA1 Stream 2 Channel 6

The part at the end that lists the pins and the verbose stream/channel info seems to generate output that won't work as commands. For example:

# dmaopt a00 0
bad device a00

@etracer65
Copy link
Member

Also looks like some better handling of missing parameters is needed as it looks like we're printing a buffer overflow.

# dmaopt adc
bad index ðÿ

@mikeller
Copy link
Member Author

This is a known limitation: This pull request does not yet support reading back the pin dmaopt configs - configurability is added in #7672.

@mikeller
Copy link
Member Author

Will fix the overflow in #7672.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants