I am using ADC with DMA on STM32L051. Conversion time is 50us (20 000 conv. per second). When I read RTC-registers (RTC_SSR, RTC_TR, RTC_DR) sometimes the CPU freezes for approx. 113 us causing ADC overrun and loss of one conversion result (113 us > 50 us * 2).
I have found the only way to solve this problem:
1) Put RTC read commands inside of interrupt handler.
2) Read only one RTC-register at a time.
I am completely unsatisfied by this solution. Is there any better way to read RTC-registers without ADC result loss?
1) CPU: STM32L051R8T6
2) System clock is 1.048 MHz (MSI).
3) AHB and APB2 clocks are the same, APB1 clock is 1.048/4 MHz.
4) RTC clock source is external 32.768 kHz crystal.
5) ADC sequence (2 conversions) started by TIM6, DMA-interrupt after 100 conversions is used.
Thanks for any help!