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

Fix DMA conflicts on JHEF745 target #387

Merged
merged 1 commit into from
Apr 15, 2024
Merged

Conversation

ot0tot
Copy link
Contributor

@ot0tot ot0tot commented Apr 15, 2024

The DMA assignment for Motor 3 conflicts with the gyro on SPI4. This PR changes the DMA request for Motor 3 so that it does not conflict, and enables bitbanged DShot which is preferred for F745 MCUs.

Before PR:

# status
MCU F745 Clock=216MHz, Vref=3.31V, Core temp=45degC
Stack size: 2048, Stack address: 0x20010000
Configuration: CONFIGURED, size: 3696, max available: 32768
Devices detected: SPI:1, I2C:1
Gyros detected: gyro 1 locked
GYRO=MPU6000, ACC=MPU6000, BARO=DPS310
OSD: MAX7456 (30 x 13)
BUILD KEY: d88c88713ceeed37a0ca6dd06f8a4fdc (4.4.3)
System Uptime: 20 seconds, Current Time: 2024-04-15T12:31:42.186+00:00
CPU:35%, cycle time: 125, GYRO rate: 8000, RX rate: 15, System rate: 9
Voltage: 1 * 0.01V (0S battery - NOT PRESENT)
I2C Errors: 0
FLASH: JEDEC ID=0x00ef4018 16M
Arming disable flags: RXLOSS CLI MSP

# dma show

Currently active DMA:
--------------------
DMA1 Stream 0: LED_STRIP
DMA1 Stream 1: FREE
DMA1 Stream 2: MOTOR 2
DMA1 Stream 3: SPI_MISO 2
DMA1 Stream 4: SPI_MOSI 2
DMA1 Stream 5: FREE
DMA1 Stream 6: FREE
DMA1 Stream 7: MOTOR 1
DMA2 Stream 0: SPI_MISO 1
DMA2 Stream 1: SPI_MOSI 4
DMA2 Stream 2: MOTOR 4
DMA2 Stream 3: MOTOR 3
DMA2 Stream 4: ADC
DMA2 Stream 5: SPI_MOSI 1
DMA2 Stream 6: FREE
DMA2 Stream 7: FREE

# timer show

Currently active Timers:
-----------------------
TIM1:
    CH1 : MOTOR 3
    CH2 : MOTOR 4
TIM2: FREE
TIM3:
    CH3 : MOTOR 1
    CH4 : MOTOR 2
TIM4:
    CH1 : LED_STRIP
TIM5: FREE
TIM6: FREE
TIM7: FREE
TIM8: FREE
TIM9: FREE
TIM10: FREE
TIM11: FREE
TIM12: FREE
TIM13: FREE
TIM14: FREE

After PR:

# 

# status
MCU F745 Clock=216MHz, Vref=3.31V, Core temp=40degC
Stack size: 2048, Stack address: 0x20010000
Configuration: CONFIGURED, size: 3696, max available: 32768
Devices detected: SPI:1, I2C:1
Gyros detected: gyro 1 locked dma
GYRO=MPU6000, ACC=MPU6000, BARO=DPS310
OSD: MAX7456 (30 x 13)
BUILD KEY: d88c88713ceeed37a0ca6dd06f8a4fdc (4.4.3)
System Uptime: 8 seconds, Current Time: 2024-04-15T13:04:17.049+00:00
CPU:30%, cycle time: 125, GYRO rate: 8000, RX rate: 15, System rate: 9
Voltage: 1 * 0.01V (0S battery - NOT PRESENT)
I2C Errors: 0
FLASH: JEDEC ID=0x00ef4018 16M
Arming disable flags: RXLOSS ANGLE CLI MSP

# timer show

Currently active Timers:
-----------------------
TIM1: FREE
TIM2: FREE
TIM3: FREE
TIM4:
    CH1 : LED_STRIP
TIM5: FREE
TIM6: FREE
TIM7: FREE
TIM8:
    CH2 : DSHOT_BITBANG 2
    CH4 : DSHOT_BITBANG 5
TIM9: FREE
TIM10: FREE
TIM11: FREE
TIM12: FREE
TIM13: FREE
TIM14: FREE

# dma show

Currently active DMA:
--------------------
DMA1 Stream 0: LED_STRIP
DMA1 Stream 1: FREE
DMA1 Stream 2: FREE
DMA1 Stream 3: SPI_MISO 2
DMA1 Stream 4: SPI_MOSI 2
DMA1 Stream 5: FREE
DMA1 Stream 6: FREE
DMA1 Stream 7: FREE
DMA2 Stream 0: SPI_MISO 4
DMA2 Stream 1: SPI_MOSI 4
DMA2 Stream 2: SPI_MISO 1
DMA2 Stream 3: DSHOT_BITBANG 2
DMA2 Stream 4: ADC
DMA2 Stream 5: SPI_MOSI 1
DMA2 Stream 6: FREE
DMA2 Stream 7: DSHOT_BITBANG 5

Or after PR with DShot bitbang disabled:

# 

# get dshot_bitbang
###WARNING: NO CUSTOM DEFAULTS FOUND###
dshot_bitbang = OFF
Allowed values: OFF, ON, AUTO
Default value: AUTO

dshot_bitbang_timer = AUTO
Allowed values: AUTO, TIM1, TIM8

# status
MCU F745 Clock=216MHz, Vref=3.31V, Core temp=45degC
Stack size: 2048, Stack address: 0x20010000
Configuration: CONFIGURED, size: 3696, max available: 32768
Devices detected: SPI:1, I2C:1
Gyros detected: gyro 1 locked dma
GYRO=MPU6000, ACC=MPU6000, BARO=DPS310
OSD: MAX7456 (30 x 13)
BUILD KEY: d88c88713ceeed37a0ca6dd06f8a4fdc (4.4.3)
System Uptime: 17 seconds, Current Time: 2024-04-15T15:05:21.403+00:00
CPU:29%, cycle time: 125, GYRO rate: 8000, RX rate: 15, System rate: 9
Voltage: 1 * 0.01V (0S battery - NOT PRESENT)
I2C Errors: 0
FLASH: JEDEC ID=0x00ef4018 16M
Arming disable flags: RXLOSS CLI MSP

# dma show

Currently active DMA:
--------------------
DMA1 Stream 0: LED_STRIP
DMA1 Stream 1: FREE
DMA1 Stream 2: MOTOR 2
DMA1 Stream 3: SPI_MISO 2
DMA1 Stream 4: SPI_MOSI 2
DMA1 Stream 5: FREE
DMA1 Stream 6: FREE
DMA1 Stream 7: MOTOR 1
DMA2 Stream 0: SPI_MISO 1
DMA2 Stream 1: SPI_MOSI 4
DMA2 Stream 2: MOTOR 4
DMA2 Stream 3: SPI_MISO 4
DMA2 Stream 4: ADC
DMA2 Stream 5: SPI_MOSI 1
DMA2 Stream 6: MOTOR 3
DMA2 Stream 7: FREE

# timer show

Currently active Timers:
-----------------------
TIM1:
    CH1 : MOTOR 3
    CH2 : MOTOR 4
TIM2: FREE
TIM3:
    CH3 : MOTOR 1
    CH4 : MOTOR 2
TIM4:
    CH1 : LED_STRIP
TIM5: FREE
TIM6: FREE
TIM7: FREE
TIM8: FREE
TIM9: FREE
TIM10: FREE
TIM11: FREE
TIM12: FREE
TIM13: FREE
TIM14: FREE

Thanks to @mmosca for testing.

@nerdCopter
Copy link
Member

needs sync to unified-target?

@ot0tot
Copy link
Contributor Author

ot0tot commented Apr 15, 2024

needs sync to unified-target?

Looks like @haslinghuis took care of it. 👍
betaflight/unified-targets#1301

@haslinghuis haslinghuis merged commit a826bbb into betaflight:master Apr 15, 2024
@ot0tot ot0tot deleted the patch-5 branch April 15, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants