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

DShot timing improvements #149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NightHawk32
Copy link

@NightHawk32 NightHawk32 commented Dec 18, 2024

I observed that the DShot telemetry responses of L431 are sometimes not picked up correctly by betaflight due to 2 reasons:

  • the ARR timer config was not entirely correct --> Dhshot telemetry is transmitted at 5/4 the bitrate of tha command, so for DShot 300 this is 375kBit/s --> 2.75us/bitTimer running @40MHz 2.75e-6s*40MHz = 110
  • the MSI caused siginficant temperature drift, so I switched to HSI

That's the MSI drifting when heated up witrh a heatgun:
https://github.com/user-attachments/assets/b4a752c0-762f-486b-9145-2abaf7c73def

This is wich HSI:
https://github.com/user-attachments/assets/8c232ff9-8f6b-4ace-a406-ba07d1ed5a5e

This also aligns well with this PR in the bootloader: am32-firmware/AM32-bootloader#35

@tridge
Copy link
Member

tridge commented Dec 19, 2024

thanks! I will test

LL_RCC_MSI_SetRange(LL_RCC_MSIRANGE_6);
LL_RCC_MSI_SetCalibTrimming(0);
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_MSI, LL_RCC_PLLM_DIV_1, 40, LL_RCC_PLLR_DIV_2);
LL_RCC_HSI_SetCalibTrimming(16);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 16 for the trimming? maybe this is specific to your board?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly that value comes from ST's data sheet and is mentioned there as default value. I did not do any trimming specific to my hardware.

@@ -71,17 +71,15 @@ void SystemClock_Config(void)
#endif

#else
LL_RCC_MSI_Enable();
LL_RCC_HSI_Enable();

/* Wait till MSI is ready */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment needs to be updated

Suggested change
/* Wait till MSI is ready */
/* Wait till HSI is ready */

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@Huibean
Copy link
Contributor

Huibean commented Jan 8, 2025

Do you mind merge multi commits into one?

@NightHawk32
Copy link
Author

Do you mind merge multi commits into one?
@Huibean all three into one single?

@Huibean
Copy link
Contributor

Huibean commented Jan 10, 2025

@NightHawk32 right

@NightHawk32 NightHawk32 force-pushed the dshot_timing_improvements branch from 198351d to c86212d Compare January 10, 2025 11:01
@NightHawk32
Copy link
Author

@Huibean done!

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.

4 participants