Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 1 month ago.
This board doesn't support AnalogOut, why ?
Hi, I need the DAC (AnalogOut) function for reference voltage, why does this board not implement ? Thanks.
Update 171017
So far, I implemented my own version as following code, but I think is not a good way.
DAC output
void dac_output(uint32_t mv) { PlatformMutex mutex; mutex.lock(); /* Enable DAC clock */ CLK_EnableModuleClock(DAC_MODULE); /* Config PB0 as DAC output */ SYS->GPB_MFPL &= ~SYS_GPB_MFPL_PB0MFP_Msk; SYS->GPB_MFPL |= SYS_GPB_MFPL_PB0MFP_DAC ; /* Internal Vref 3.072V */ SYS_UnlockReg(); SYS->VREFCTL = (SYS->VREFCTL & ~SYS_VREFCTL_VREFCTL_Msk) | SYS_VREFCTL_VREF_3_072V; SYS_LockReg(); /* DAC output */ DAC_T *dac_base = (DAC_T *) DAC_BASE; DAC_Open(dac_base, 0, DAC_WRITE_DAT_TRIGGER); DAC_SetDelayTime(dac_base, 8); DAC_WRITE_DATA(dac_base, 0, ((4096UL * mv) / 3072)); mutex.unlock(); }
Question relating to:
2 Answers
6 years ago.
Easily the mapping you expect (digital pins) this must be called prior to any I2C reads or writes before the program can operate be transformed into e difference is that analog write with pin D5. Or use to many different platforms.