Skip to main content
Associate III
October 29, 2023
Solved

Real time changing AHB,APB1 Prescaler, Sampling frequency

  • October 29, 2023
  • 2 replies
  • 1395 views

Good evening,
I am trying to sample various signals at different frequencies with adc in dma. Changing the size of the acquisition buffer seems inefficient, so I opted to change the clock prescalers, but it's giving me problems (I guess on changing the baud rate). Do you have any advice on how to change the input signal sampling rate without possibly affecting the UART?

This topic has been closed for replies.
Best answer by Tesla DeLorean

Some of the newer parts allow for secondary sources of peripheral clocks.

On a generic F4 part you'll need to briefly disable the UART (UE) and shift the BRR to maintain the ratios, then re-enable. Use USART on a different APB than you're changing frequency on.

Of the ADC + DMA, drive with a TIM trigger, and change the TIM to pace the acquisition.

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
October 29, 2023

Some of the newer parts allow for secondary sources of peripheral clocks.

On a generic F4 part you'll need to briefly disable the UART (UE) and shift the BRR to maintain the ratios, then re-enable. Use USART on a different APB than you're changing frequency on.

Of the ADC + DMA, drive with a TIM trigger, and change the TIM to pace the acquisition.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
davidecAuthor
Associate III
November 9, 2023

I solved this in a different way to the one you proposed, i.e. by changing the prescaler by modifying the clock configuration function for adc acquisition in dma and then putting it back to the initial settings for serial communication.