cancel
Showing results for 
Search instead for 
Did you mean: 

dac+timer

nimaltd
Senior

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

3 REPLIES 3
Sarra.S
ST Employee

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.

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.

nimaltd
Senior

@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. 

nimaltd
Senior

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