PmReturn_t _init_dac(uint32_t DAC_Channel){
PmReturn_t retval = PM_RET_OK;
if(NATIVE_GET_NUM_ARGS() != 1)
{
PM_RAISE(retval, PM_RET_EX_TYPE);
return retval;
}
DAC_InitTypeDef DAC_InitStruct;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //also tried with GPIO_Mode_AIN like the suggestion in the datasheet too
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
DAC_InitStruct.DAC_Trigger = DAC_Trigger_None;
DAC_InitStruct.DAC_WaveGeneration = DAC_WaveGeneration_None;
DAC_InitStruct.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
DAC_Init(DAC_Channel_1, &DAC_InitStruct);
DAC_Cmd(DAC_Channel_1, ENABLE);
DAC_SetChannel1Data(DAC_Align_12b_R, 1000);
return retval;
}
I expect, that i can measure the a voltage with 1000 counts value at pin PA4. But i can not measure anything ( ~ 0V)
Thank you for the help in advance
best regards
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;