2023-03-05 12:05 PM
Hey,
I'm trying to get a STM32F767ZI (on the NUCLEO-767 board) running with TIM1, Channel 1 on Output Compare (CH1). I want to feed the CCR1 values by DMA with a circular buffer.
If I dumb down my code to the bare minimum, I have the following:
uint16_t val = 0x00;
for (int i = 0; i < sizeof(dmaValues)/sizeof(dmaValues[0]); i++) {
val += 0x100;
dmaValues[i] = val;
}
HAL_TIM_OC_Start_DMA(&htim1, TIM_CHANNEL_1, (uint32_t *) &dmaValues, sizeof(dmaValues)/sizeof(dmaValues[0]));
If I understood correctly, this should set-up TIM1 to do exactly this, feeding from the array of 'dmaValues'.
When I test this on other STM32's I have laying around (NUCLEO-F401RE for instance), this works as intended.
I use STM32CubeMX to generate code; TIM1 is set to Internal Clock, with Channel 1 to Output Compare CH1. OC1 Mode is set to 'Toggle on match'. Under DMA,I created a new DMA stream (TIM1_CH1, so DMA2 Stream 1, ch6). Direction is set to 'Memory to Peripheral' and mode is set to Circular. I have a scope connected to the TIM1_CH1 pin, (PE9, D5). The pin is just remaining 0v / in the off state.
Also, when performing more specific tests, I have noticed that the DMA transfer complete and DMA transfer half complete are working. Also, when writing to the TIM1 CCR1 register from an interrupt, the waveform works as intended. As this would imply to me that both the DMA is working as well as the TIM1 OC1, I have no clue anymore to further investigate.
I have checked the Errata and still haven't found any reason why this shouldn't work.
Am I missing something blatantly obvious? I have attached both my projects (F7OC_DMATest is for the STM32F767 which doesn't work, and F4OC_DMATest is for the STM32F401 which works correctly.)
2023-03-05 03:20 PM
Switch off data cache. Still no work?
JW
2023-03-06 08:20 AM
Hello @WarrantyVoids,
I can see that the cache is disabled. Could you be more specific about the expected behavior?
I tested your project without any issue.
Thanks
Firas
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.