AnsweredAssumed Answered

HAL Timer Triggered SPI Transfer

Question asked by ferrario.fabio.001 on Jun 27, 2016
Latest reply on Jul 2, 2016 by mccleary.patrick.001
I am trying to transfer data to spi using timer 3 as a time base.
Timer 3 works fine.
Than I am using :

DMA1 Stream2 Channel5 to trigger
memory to SPI2->DR transfers, with no joy.
 
//TIMER 3 CHANNEL 4 UPDATE
 
    hdma_tim3_ch4_up.Instance = DMA1_Stream2;
    hdma_tim3_ch4_up.Init.Channel = DMA_CHANNEL_5;
    hdma_tim3_ch4_up.Init.Direction = DMA_MEMORY_TO_PERIPH;
    hdma_tim3_ch4_up.Init.PeriphInc = DMA_PINC_DISABLE;
    hdma_tim3_ch4_up.Init.MemInc = DMA_MINC_DISABLE;
    hdma_tim3_ch4_up.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
    hdma_tim3_ch4_up.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
    hdma_tim3_ch4_up.Init.Mode = DMA_CIRCULAR;
    hdma_tim3_ch4_up.Init.Priority = DMA_PRIORITY_LOW;
    hdma_tim3_ch4_up.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
    HAL_DMA_Init(&hdma_tim3_ch4_up);
 
    /* Several peripheral DMA handle pointers point to the same DMA handle.
     Be aware that there is only one stream to perform all the requested DMAs. */
    __HAL_LINKDMA(htim_base,hdma[TIM_DMA_ID_CC4],hdma_tim3_ch4_up);
    __HAL_LINKDMA(htim_base,hdma[TIM_DMA_ID_UPDATE],hdma_tim3_ch4_up);
 
/**MAIN.c*********************/
DMA_HandleTypeDef hdma_tim3_ch4_up;
 
HAL_TIM_OC_Start(&htim3, TIM_CHANNEL_4);       //start timer 4, works
             
HAL_DMA_Start_IT(&hdma_tim3_ch4_up, (uint32_t*)&SV.fields.internal_current, (uint32_t*)(&(SPI2->DR)), 1);

__HAL_TIM_ENABLE_DMA(&htim3, TIM_DMA_UPDATE);   //TIM1 trigger DMA transfer

Still no data on the spi bus.

Outcomes