Skip to main content
Senior
April 26, 2024
Question

dac+timer

  • April 26, 2024
  • 3 replies
  • 1229 views

void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef *hdac)
{
 HAL_GPIO_TogglePin(START_OF_FRAME_GPIO_Port , START_OF_FRAME_Pin);
}

 

uint32_t val[] = { 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400};

 

HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, val, 10, DAC_ALIGN_12B_R);

HAL_TIM_Base_Start(&htim2);

 

this is my simple code. why transfer complete interrupt is not on last data?

msg-1001059758846-54432.jpg

This topic has been closed for replies.

3 replies

ST Employee
April 26, 2024

Hello @nimaltd

Please share your DMA configuration  

If you're configuring DMA in circular mode, it will automatically wrap around and start again from the beginning of the array once it reaches the end. This means the HAL_DAC_ConvCpltCallbackCh1 will be called not after the last data is transferred, but after each time the DMA completes a cycle through the array.

In your case, I think you want the interrupt to be triggered after the last data has been transferred, so, you need to configure the DMA in normal mode.

nimaltdAuthor
Senior
April 26, 2024

@Sarra.S thanks for answer. yes it is in circular mode. but starting again take lots of time, i need doing in circular mode and a callback for finishing the buffer. 

nimaltdAuthor
Senior
April 29, 2024

Dear @Sarra.S .  This is normal mode. but still has the same problem. 

i have attached my project. please have a look. thanks

msg89464043-594169.jpg