AnsweredAssumed Answered

cubef4 STM32F4-Discovery dac example problem?

Question asked by osamu fujiwara on Apr 27, 2018

hi

i  want use DAC_SignalsGeneration example for Making waveforms in my stm32f407 discovery eval board

redefine

const uint8_t aEscalator8bit[6] = {0x0, 0x33, 0x66, 0x99, 0xCC, 0xFF};

to

const uint16_t aEscalator16bit[100]={82,164,246,328,410,492,573,655,
737,819,901,983,1065,1147,1229,1311,
1393,1475,1556,1638,1720,1802,1884,1966,
2048,2130,2212,2294,2376,2458,2540,2621,
2703,2785,2867,2949,3031,3113,3195,3277,
3359,3441,3523,3604,3686,3768,3850,3932,
4014,4096,4014,3932,3850,3768,3686,3604,
3523,3441,3359,3277,3195,3113,3031,2949,
2867,2785,2703,2621,2540,2458,2376,2294,
2212,2130,2048,1966,1884,1802,1720,1638,
1556,1475,1393,1311,1229,1147,1065,983,
901,819,737,655,573,492,410,328,
246,164,82,0};

 

and change DAC_ALIGN_8B_R to DAC_ALIGN_12B_R in this line

 

/*##-2- Enable DAC Channel1 and associated DMA #############################*/
if(HAL_DAC_Start_DMA(&DacHandle, DACx_CHANNEL1, (uint32_t*)aEscalator16bit, 100, DAC_ALIGN_12B_R) != HAL_OK)
{
/* Start DMA Error */
Error_Handler();
}
}

 

 but my Generated waveform is disordered in the oscilloscope.i need to 12bit dac.where is my problem?

Outcomes