I've been looking at 36.4.1 DAC Data Register (DACx_DATn) in Reference Manual v.4 for the Vybrid. In particular, I'm trying to write data to the DAC output without enabling the buffer. The 12-bit fields DATA1 and DATA2 both state that they control the output voltage, although it seems that only the 12 LSB of DACx_DAT0 should control the output of DACx if the buffer is disabled.
Solved! Go to Solution.
The company policy is that our applications software engineers develop code (called BSP - Board Support Platform) running on the hardware platform board (Vybrid Tower Board in this case), which contains all the information required to develop software for our customers. This is done to "answer in advance" all the possible future specific questions similar to those you are asking.
(Please take a look at the below links for the 2 supported OSs:
What is the difference between your approach and the way implemented in our BSP, please? - I hope it will help me to better understand your request.
Sincerelty yours, Naoum Gitnik.
I'm working with the new beta of MQX 4.0.1 for the Vybrid. MQX 4.0 doesn't have any support for the DAC module, so I'm coding that bit without an OS. I haven't checked Linux support for the DAC driver yet.
I am sorry that it is taking that long in the summer time due to that a lot of relevant people are on vacation.
Please let me know if your request regarding the "36.4.1 DAC Data Register (DACx_DATn)" is still relevant or you already got results by experimenting with it.
Sincerely yours, Naoum Gitnik.
n00b1024, can you post the specifics about configuring the CCM? From my read of the docs I think I need this, but is there more to it.. (CG140)
|CCM_CCGR8 |= 3 << 24;|
That should be correct, for getting power to the DAC. Mine looked more like CCM_CCGR8 |= 1 << 24;. Can you tell if you are able to write to the registers inside the DAC module after turning on CG140?
Have you written code for any of the other modules on your board -- if so, are they working?
What debugger/RTOS are you working in?
This is on an Emcraft Vybrid SOM -> http://www.emcraft.com/products/259
Environment is Linux on the A5 and MQX on the M4. I'm just starting from their barebones "networking" sample which boots Linux and then starts up an MQX image on the M4. I'm trying to set up the DAC from M4/MQX.
Debugger? UART printf...
Haven't really had something successful yet, the addresses for the CCGR and the DAC_STATCTRL registers seem to come out right in the C code, I'm printing those out before trying to write to them. More often than not the M4 hangs (though the A5/Linux side is still running).
This seems like it should be 5-6 lines of code, tops. I really don't want to be told "use Processor Expert" to turn on the DAC that MQX has no support for. Will keep trying things.
There are three main things that you need to do for the DAC module:
-turn on CCGR bit in order to power up the DAC module so that you can write to the DAC control registers
-set up the appropriate pins as outputs with IOMUXC
-set up the DAC control registers. Use DACREF_2 as the reference voltage.
Thank you for your message. I'm fairly certain that the part in the manual that I was asking about was merely a typo. However, I've been having trouble getting the DAC up and running on the Vybrid, and neither MQX nor Linux support a DAC driver for the Vybrid. I've been using the code below, leaving the buffer disabled. Currently, I'm not getting any output (testing DAC0 at pin A32).
DAC0->STATCTRL = 0x0; //resetting the control register
DAC0->STATCTRL |= 0x4000; //setting DACREF_2 as the reference voltage (DACRFS bit)
DAC0->STATCTRL |= 0x8000; //enables the DAC (DACEN bit)
DAC0->DAT = 0x0FFF0FFF; /*d'2048 in lowest two half-words in the buffer. Since the buffer is disabled, only the 16 lsb of DAT should matter */
DAC0->DAT = 0x0FFF0FFF; //d'2048