AnsweredAssumed Answered

STM8AL3136: How to get DAC1 on PB4

Question asked by Davy Straetemans on Feb 8, 2018
Latest reply on Feb 9, 2018 by Davy Straetemans

I'm using the example code from STM8L15x-16x-05x-AL31-L_StdPeriph_Lib as a starting point.

I'm able to get GPIO and I2C working but the configuration to get the DAC1 on pin PB4 not working.


I have the following configuration:


SYSCFG_RIIOSwitchConfig(RI_IOSwitch_15, ENABLE); //get DAC1 on PB4 pin


CLK_PeripheralClockConfig(CLK_Peripheral_DAC, ENABLE);



DAC_Init(DAC_Channel_1, DAC_Trigger_None, DAC_OutputBuffer_Enable);

DAC_SetChannel1Data(DAC_Align_12b_R, 2000);


but the output on PB4 stay's zero.


Also tried adding a check to be sure the DAC value is set correctly with:

while(4000 != DAC_GetDataOutputValue(DAC_Channel_1));

and the loop is just exited.


The problem must be in the IO switch configuration, but i have no clue what it could be.


Any idea's?