-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Reduce ADC noise #3652
base: main
Are you sure you want to change the base?
Reduce ADC noise #3652
Conversation
Why did you disable FLASH_PrefetchBufferCmd only for TX16S and Taranis? Why not enable it for Horus also? TX16S and Horus radios actually share the same MCU, as all color radios do |
Hi, sorry I have little development experience, I am not a professional developer, I just try to submit this PR. because this is experimental, there is a little effect in the actual test. But I haven't tested on other radios, so I don't know if this PR can be merged. I hope more developers will see more tests of different hardware. I don't want to make any changes to other Radio hardware type that I haven't tested. I'm afraid my changes will mislead others. In addition, I'm not sure if the major developers have specifically turned on this feature for essential functionality. |
Other radios are very similar in terms of hardware, X12S and TX16S for example have the same MCU and same board layout, I think there won't be any problems if FLASH_PrefetchBufferCmd will be disabled for all color radios |
I think it should be disabled for all radios that use the internal ADC of the MCU, if the performance input is not too bad |
6b38171
to
4a9e943
Compare
Just asked ChatGPT about this... seems to be able to regurtigate the same sort of information from somewhere Google won't readily tell me about 🤷 ... edit: welp... no longer a valid command command 😢 Should we be turning the
|
Maybe something to consider: we do use oversampling & decimation, which relies on noise to enhance the precision. Before disabling flash prefetch, we should have extensive tests showing the tradeoffs with tangible numbers. |
Yeah, that was why wanted to resurrect this, so we could put it to rest one
way or the other ;) is via the stm...hal.h file the right way to do this
now?
…On Mon, 8 July 2024, 4:52 pm Raphael Coeffic, ***@***.***> wrote:
Maybe something to consider: we do use oversampling & decimation, which
relies on noise to enhance the precision. Before disabling flash prefetch,
we should have extensive tests showing the tradeoffs with tangible numbers.
—
Reply to this email directly, view it on GitHub
<#3652 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ66KLIE4D7VUTGHZZOAEDZLIZLJAVCNFSM6AAAAABKPIUPH2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJTGE3TQOBUHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
And of course things might be very different for new H7/H5 based radio |
For reference: HAL_StatusTypeDef HAL_Init(void)
{
/* Configure Flash prefetch, Instruction cache, Data cache */
#if (INSTRUCTION_CACHE_ENABLE != 0U)
__HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
#endif /* INSTRUCTION_CACHE_ENABLE */
#if (DATA_CACHE_ENABLE != 0U)
__HAL_FLASH_DATA_CACHE_ENABLE();
#endif /* DATA_CACHE_ENABLE */
#if (PREFETCH_ENABLE != 0U)
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
#endif /* PREFETCH_ENABLE */
/* Set Interrupt Group Priority */
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
/* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */
HAL_InitTick(TICK_INT_PRIORITY);
/* Init the low level hardware */
HAL_MspInit();
/* Return function status */
return HAL_OK;
}
Caches and prefetch buffer are enabled directly in
/* Configure Flash prefetch, Instruction cache, Data cache and wait state */
FLASH->ACR = FLASH_ACR_PRFTEN | FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_LATENCY_5WS;
/* Configure Flash prefetch, Instruction cache, Data cache and wait state */
FLASH->ACR = FLASH_ACR_PRFTEN |FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_3WS; |
This is an experimental pull request. Another engineer told me: After he consulted a lot of relevant information, including ST official information, he obtained a description of FLASH_PrefetchBufferCmd. Try turning it off with FLASH_PrefetchBufferCmd(DISABLE), and by observation, it does reduce the magnitude of the joystick noise.
The indirect influence factors of FLASH_PrefetchBufferCmd on ADC noise are as follows:
When FLASH_PrefetchBufferCmd is enabled, the noise of the ADC increases, which may suggest some indirect effects.