cancel
Showing results for 
Search instead for 
Did you mean: 

Real time changing AHB,APB1 Prescaler, Sampling frequency

davidec
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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 Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
davidec
Associate III

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.