DAC module: request for clarification on RM

cancel
Showing results for 
Search instead for 
Did you mean: 

DAC module: request for clarification on RM

Jump to solution
593 Views
Contributor III

Hello,

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.

Thanks.

Tags (1)
0 Kudos
1 Solution
106 Views
Contributor III

Dear Naoum,

I’ve been able to get the DAC module working. My primary mistake was not enabling the CCM clock controlling the power to the DAC.

Thanks.

View solution in original post

0 Kudos
12 Replies
106 Views
Senior Contributor V

Dear n00b1024,

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:

MQX: http://www.freescale.com/webapp/sps/site/overview.jsp?code=MQXSWDW

Linux: https://linuxlink.timesys.com/register/freescale.)

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.

106 Views
NXP Apps Support
NXP Apps Support

ioseph_martinez  can you  check/confirm  if our Linux: https://linuxlink.timesys.com/register/freescale contains a DAC driver, please?

0 Kudos
106 Views
NXP Apps Support
NXP Apps Support

Appears  DAC driver is not supported in linux.

Please refer to   below link:

http://www.timesys.com/sites/default/modules/factory/kernelInfo.php?pkgid=6361

0 Kudos
106 Views
Contributor III

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.

0 Kudos
106 Views
Senior Contributor V

Dear n00b1024,

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.

0 Kudos
107 Views
Contributor III

Dear Naoum,

I’ve been able to get the DAC module working. My primary mistake was not enabling the CCM clock controlling the power to the DAC.

Thanks.

View solution in original post

0 Kudos
106 Views
Contributor I

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;
0 Kudos
106 Views
Contributor III

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?

0 Kudos
106 Views
Contributor I

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.

0 Kudos
106 Views
Contributor III

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.

0 Kudos
106 Views
Senior Contributor V

Thanks a lot for your update, n00b1024!

Sincerely, Naoum.

0 Kudos
106 Views
Contributor III

Dear Naoum,

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)

     //data!

  DAC0->DAT[0] = 0x0FFF0FFF;   /*d'2048 in lowest two half-words in the buffer. Since the buffer is disabled, only the 16 lsb of DAT[0] should matter */

  DAC0->DAT[7] = 0x0FFF0FFF;   //d'2048

0 Kudos