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

AP_HAL_ChibiOS: disable DMA on Kakute F7 Mini ESC telemetry pin #12545

Closed
wants to merge 1 commit into from

Conversation

@andyp1per
Copy link
Contributor

andyp1per commented Oct 12, 2019

Having DMA enabled on the telemetry RX pin causes lockups, BLHeli issues and logging issues. Disabling it makes all these problems go away.

@andyp1per andyp1per requested a review from tridge Oct 12, 2019
@tridge

This comment has been minimized.

Copy link
Contributor

tridge commented Oct 12, 2019

I'm happy to change it, but if you're getting lockups I'd like to know why. Can you reproduce the lockups on the KakuteF7? If so, can you tell me how to reproduce?

@andyp1per

This comment has been minimized.

Copy link
Contributor Author

andyp1per commented Oct 12, 2019

I suspect it's the same on the Kakute F7. Enable ESC telemetry on SERIAL5 for that board - I'm guessing you need to have ESC's that output telemetry connected - you should then see all manner of problems.

@andyp1per

This comment has been minimized.

Copy link
Contributor Author

andyp1per commented Oct 12, 2019

Paul Atkin was saying that he had a lot of problems with early Kakute boards and DMA and used to disable DMA on all the UARTs. I don't know whether they made some hardware changes to address this.

Although that said Paul had telemetry working fine on his Kakute F7, so maybe it's just the mini that's a problem.

@andyp1per

This comment has been minimized.

Copy link
Contributor Author

andyp1per commented Oct 12, 2019

The only ESC I have that supports this is soldered into a frame, so I don't think I'm going to be able to reproduce.

@vierfuffzig

This comment has been minimized.

Copy link
Contributor

vierfuffzig commented Oct 12, 2019

i can reliably trigger internal error 0x8000 on copter firmware just by doing a BLH_TEST. this might only be partially related, it doesn‘t involve a UART being used and it isn‘t restricted to this board type though.

#12542

@andyp1per

This comment has been minimized.

Copy link
Contributor Author

andyp1per commented Oct 13, 2019

Even with this change I still get the "Internal errors 0x8000" if I use BLHeli pass through - so I think the two are unrelated.

@tridge could you possibly merge this so that we have a known working config in master and then I'm happy to work with you to debug - remote access to my aircraft if that would help?

@andyp1per

This comment has been minimized.

Copy link
Contributor Author

andyp1per commented Oct 13, 2019

@tridge Paul also observed that the DMA interference was with Dshot on some of his boards, so maybe the two are related.

@andyp1per

This comment has been minimized.

Copy link
Contributor Author

andyp1per commented Dec 3, 2019

@tridge @rmackay9 I can't see any material difference in hwdef.h between this and regular master apart from the missing TX definition. I'll have to try it on my actual board to verify.:

DB0837:ardupilot-released andypiper$ diff -u build/KakuteF7Mini-/hwdef.h build/KakuteF7Mini/hwdef.h 
--- build/KakuteF7Mini-/hwdef.h	2019-12-03 21:49:00.000000000 +0000
+++ build/KakuteF7Mini/hwdef.h	2019-12-03 21:55:05.000000000 +0000
@@ -147,7 +147,6 @@
 #define HAL_GPIO_PIN_UART4_RX             PAL_LINE(GPIOA,1U)
 #define HAL_GPIO_PIN_UART4_TX             PAL_LINE(GPIOA,0U)
 #define HAL_GPIO_PIN_UART7_RX             PAL_LINE(GPIOE,7U)
-#define HAL_GPIO_PIN_UART7_TX             PAL_LINE(GPIOE,8U)
 #define HAL_GPIO_PIN_USART1_RX            PAL_LINE(GPIOA,10U)
 #define HAL_GPIO_PIN_USART1_TX            PAL_LINE(GPIOA,9U)
 #define HAL_GPIO_PIN_USART2_RX            PAL_LINE(GPIOD,6U)
@@ -189,9 +188,6 @@
 
 
 // auto-generated DMA mapping from dma_resolver.py
-
-// Note: The following peripherals can't be resolved for DMA: ['UART7_RX']
-
 #define STM32_ADC_ADC1_DMA_STREAM      STM32_DMA_STREAM_ID(2, 4)
 #define STM32_ADC_ADC1_DMA_CHAN        0
 #define STM32_I2C_I2C1_RX_DMA_STREAM   STM32_DMA_STREAM_ID(1, 0)
@@ -386,6 +382,7 @@
 #define HAL_UART7_CONFIG { (BaseSequentialStream*) &SD7, false, STM32_UART7_RX_DMA_CONFIG, STM32_UART7_TX_DMA_CONFIG, 0, -1, 0, -1, 0}
 #define HAL_UART_DEVICE_LIST HAL_OTG1_CONFIG,HAL_USART3_CONFIG,HAL_USART1_CONFIG,HAL_USART2_CONFIG,HAL_UART4_CONFIG,HAL_USART6_CONFIG,HAL_UART7_CONFIG
 
+#define HAL_UART_NUM_SERIAL_PORTS 7
 #define HAL_HAVE_AP_ROMFS_EMBEDDED_H 1
 
 /*
@@ -873,7 +870,6 @@
  PE5 SPI4_MISO SPI4 AF5
  PE6 SPI4_MOSI SPI4 AF5
  PE7 UART7_RX UART7 AF8
- PE8 UART7_TX UART7 AF8
  PE9 TIM1_CH1 TIM1 AF1 PWM2
  PE11 TIM1_CH2 TIM1 AF1 PWM3
 */
@@ -886,7 +882,7 @@
                            PIN_MODE_ALTERNATE(5U) | \
                            PIN_MODE_ALTERNATE(6U) | \
                            PIN_MODE_ALTERNATE(7U) | \
-                           PIN_MODE_ALTERNATE(8U) | \
+                           PIN_MODE_INPUT(8U) | \
                            PIN_MODE_ALTERNATE(9U) | \
                            PIN_MODE_INPUT(10U) | \
                            PIN_MODE_ALTERNATE(11U) | \
@@ -937,7 +933,7 @@
                            PIN_PUPDR_FLOATING(5U) | \
                            PIN_PUPDR_FLOATING(6U) | \
                            PIN_PUPDR_PULLUP(7U) | \
-                           PIN_PUPDR_PULLUP(8U) | \
+                           PIN_PUPDR_FLOATING(8U) | \
                            PIN_PUPDR_FLOATING(9U) | \
                            PIN_PUPDR_FLOATING(10U) | \
                            PIN_PUPDR_FLOATING(11U) | \
@@ -954,7 +950,7 @@
                            PIN_ODR_HIGH(5U) | \
                            PIN_ODR_HIGH(6U) | \
                            PIN_ODR_HIGH(7U) | \
-                           PIN_ODR_LOW(8U) | \
+                           PIN_ODR_HIGH(8U) | \
                            PIN_ODR_HIGH(9U) | \
                            PIN_ODR_HIGH(10U) | \
                            PIN_ODR_HIGH(11U) | \
@@ -972,7 +968,7 @@
                            PIN_AFIO_AF(6U, 5U) | \
                            PIN_AFIO_AF(7U, 8U))
 
-#define VAL_GPIOE_AFRH    (PIN_AFIO_AF(8U, 8U) | \
+#define VAL_GPIOE_AFRH    (PIN_AFIO_AF(8U, 0U) | \
                            PIN_AFIO_AF(9U, 1U) | \
                            PIN_AFIO_AF(10U, 0U) | \
                            PIN_AFIO_AF(11U, 1U) | \
@andyp1per

This comment has been minimized.

Copy link
Contributor Author

andyp1per commented Dec 7, 2019

I can't reproduce this on current 4.0rc2 on my KakuteF7 Mini - so as always @tridge is correct and this would be a no-op 😄

@andyp1per andyp1per closed this Dec 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
6 participants
You can’t perform that action at this time.