cancel
Showing results for 
Search instead for 
Did you mean: 

SPI transfer using dma request from timer

DK1
Associate

Hi,

I want to do SPI transfer every 1ms without wakeing up CPU.

In one SPI transfer, I want to send 10 Half words.

It was possible to send SPI every 1ms with dma.

But I can transfer only a half word in one transfer.

What should I do ?

Best regards.

(Below is part of the source code)

  HAL_DMA_Start_IT(&hdma_tim17_ch1_up, (uint32_t)(tx_data), (uint32_t)&(&hspi1)->Instance->DR, 10);

  __HAL_TIM_ENABLE_DMA(&htim17, TIM_DMA_UPDATE);

  __HAL_TIM_ENABLE(&htim17);

3 REPLIES 3

Which STM32?

In models with DMAMUX, it should be possible to generate the repeated requests using DMAMUX.

Otherwise, use two timers - one, which triggers DMA, at a rate equivalent to back-to-back SPI transfers or slightly slower; other, which through internal TRGO-TRGI mechanism gates the first timer so that it generates 10 pulses (=triggers) every 1ms.

JW

Thank you for your reply.

>Which STM32?

STM32L496ZG.

Dose not this have DMAMUX ?

Best regards.

> STM32L496ZG.

> Dose not this have DMAMUX ?

No.

JW