betaflight / config

Betaflight target definitions
GNU General Public License v3.0
30 stars 105 forks source link

CUST-CKFLIGHTF4 Custom Design config #431

Closed ckflight closed 4 months ago

ckflight commented 4 months ago

I have created config.h file after completing the CUST-CKFLIGHTF4.config file. reference: https://github.com/betaflight/unified-targets/pull/1326

However, I do not fully understand the timer mapping and ADC_DMA_OPT line:

B5, B6, B7 and A2 are motor dshot pins which requires timer and dma. C8 is RGB Led strip pin which requires dshot like protocol so timer and dma is needed as well. B0 is buzzer pin which requires timer for 4KHz pwm but dma might not be needed (i did not add dma line for this)

# timer
timer B05 AF2
# pin B05: TIM3 CH2 (AF2)
timer B06 AF2
# pin B06: TIM4 CH1 (AF2)
timer B07 AF2
# pin B07: TIM4 CH2 (AF2)
timer A02 AF1
# pin A02: TIM2 CH3 (AF1)
timer C08 AF3
# pin C08: TIM8 CH3 (AF3)
timer B00 AF1
# pin B00: TIM1 CH2N (AF1)

# dma
dma ADC 1 1
# ADC 1: DMA2 Stream 4 Channel 0
dma ADC 2 1
# ADC 2: DMA2 Stream 3 Channel 1

dma pin A02 0
# pin A02: DMA1 Stream 1 Channel 3
dma pin B05 0
# pin B05: DMA1 Stream 5 Channel 5
dma pin B06 0
# pin B06: DMA1 Stream 0 Channel 2
dma pin B07 0
# pin B07: DMA1 Stream 3 Channel 2
dma pin C08 0
# pin C08: DMA2 Stream 2 Channel 0

As a result how should i set timer mapping lines for config.h file. 4th is the same number of dma pin "pin number" "number". 2nd column is the pin numbe and 1st is for indexing. 3rd column is the part i do not understand.

#define TIMER_PIN_MAPPING \
    TIMER_PIN_MAP( 0, PA2, 1,  0) \
    TIMER_PIN_MAP( 1, PB5, 1,  0) \
    TIMER_PIN_MAP( 2, PB6, 1,  0) \
    TIMER_PIN_MAP( 3, PB7, 1,  0) \
    TIMER_PIN_MAP( 4, PC8, 2,  0)

Also Battery and Current adc is available on board how should i set this line:

#define ADC1_DMA_OPT        1
nerdCopter commented 4 months ago

recommend inspecting some other config.h files. someone with deeper understanding will have to reply with more specifics, as i do not know all the technicals.

haslinghuis commented 4 months ago

Check https://betaflight.com/docs/development/manufacturer/creating-configuration

Can do it manually or use

image

haslinghuis commented 4 months ago

make CKFLIGHF4 EXTRA_FLAGS="-DUSE_TIMER_MAP_PRINT"

ckflight commented 4 months ago

Thank you so much for your help, contributions and corrections.