cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L432 and STM32H745 DAC in DMA mode has shifted data output

GMG
Associate III

Hi, I have a problem with DAC output, same problem with STM32L4 and STM32H7. I have to continuously output a step wave (3 levels), for this purpose I use a Timer and DMA in circular mode to output an array of 3 values.

The code is very simple, I use a GPO as a sync pin to know when every DAC cycle start and end. If you look at the attached image the 1st period has 2 empty steps at the beginning and then the 1st array value at the end, from here all others periods will result in a shifted wave compared with the trigger/sync pin . What is wrong? What I don't understand? Attached there is also a simple IOC file of the project.

void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef *hdac)
{
	HAL_GPIO_TogglePin(SYNC_GPIO_Port, SYNC_Pin);
}
 
  uint16_t dac_wave[3];
  dac_wave[0] = 0x100;
  dac_wave[1] = 0x7FF;
  dac_wave[2] = 0xEFF;
 
  HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, (uint32_t *)dac_wave, 3, DAC_ALIGN_12B_R);
  HAL_TIM_Base_Start(&htim2);
 
  HAL_GPIO_TogglePin(SYNC_GPIO_Port, SYNC_Pin);

0693W00000Uo1oqQAB.png

1 REPLY 1
GMG
Associate III

Can someone from ST give a feedback about this behavior? Is it a HAL implementation bug? Is it our misunderstood? At this state we can't use STM32H7​ for our project.