Hardware bug STM32F11 in Timer DMA mode (PWM Generation)
I wanted to generate PWM Waveforms with nucleo F411and found a severe bug in the hardware. Maybe it is described in the errata sheet, but I found nothing.
bug:
DMA is dependent on data send on DMA stream. Sometimes DMA transfer is not done. (DMA circular mode. the transfer complete interrupt rate goes down in the error case.)
It is reproducable even with a modified example of the CubeMX package.
This example I used:
Repository/STM32Cube_FW_F4_V1.24.2/Projects/STM32F411RE-Nucleo/Examples_LL/TIM/TIM_DMA/
change 4 lines in Src/main.c of the project to produce the error:
original:
1)
LL_TIM_SetAutoReload(TIM3, __LL_TIM_CALC_ARR(TimOutClock, LL_TIM_COUNTERMODE_UP, 17570));
new:
LL_TIM_SetAutoReload(TIM3, 511);
2)
aCCValue[0] = (uint32_t)(((uint32_t) 75 * (LL_TIM_GetAutoReload(TIM3) - 1)) / 100);
to: aCCValue[0] = 510;
3)
aCCValue[1]=510;// = (uint32_t)(((uint32_t) 50 * (LL_TIM_GetAutoReload(TIM3) - 1)) / 100);
to: aCCValue[1]=510;
4)
aCCValue[2] = (uint32_t)(((uint32_t) 25 * (LL_TIM_GetAutoReload(TIM3) - 1)) / 100);
to: aCCValue[2] = 0;
now the with oscilloscope monitored waveform has a period of 4 PWM cycles instead of 3. transfer complete interrupt rate goes down respectively.
If You change 4) to aCCValue[2] = 1 or another number period is 3 PWM cycles, all is ok.
cheers