FRDM-K64F : No output on DAC0_OUT with Processor Expert

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM-K64F : No output on DAC0_OUT with Processor Expert

2,286 Views
isaacleung
Contributor I

I'm just getting familiar with the FRDM-K64F board and have gotten a bunch of things working, ADC, GPIO, etc. What's not going so well is getting the DAC to work. Specifically nothing comes out on the DAC0_OUT pin when trying to configure it with Processor Expert (as Eclipse plugin).

When I try the online compiler at mbed.org, there is no problem, I get what I expect so I'm probing the right pin.

With  my Processor Expert code, I don't see any obvious errors, but nothing comes out, even following exactly the "typical usage" code in the help.

I've checked the return from DAC_Enable() and it is okay. I've checked DAC_SetValue(), DAC_SetValue8(), DAC_SetValue16() and these also return ERR_OK. In fact, I specifically set DAC_Disable() as well to test to make sure I read back an error in this case, and it does.

I saw a similar thread No output DAC0 or 1 using CW10.5 using PE DAC_LDD component on K70 tower board so I tried those suggested tricks, but still nothing. I added & configured VREF component, no luck.

Any other things I need to try?

=======================================================

// This is the typical usage example in the Help. It doesn't work

  byte i = 128;

  DA1_Enable();

  for(;;) {

   if (i == 255) {

   i = 0;

   }

   else {

   i++;

   }

   DA1_SetValue8(&i);

  }

=======================================================

Another odd thing I noticed is that if I try a low level write to the register, e.g.

=======================================================

volatile char *DAC_BASE_ADDR;

DAC_BASE_ADDR = (char *) 0x400CC000;

*(DACBASEADDR + 0x21) =  0xC0;

=======================================================

it doesn't seem to do anything. If I use DAC_Enable() first, this doesn't disable it if I write 0x00 and if I use DAC_Disable(), this fails to enable it. I use the same technique to do low level GPIO toggle and it works as expected.

0 Kudos
3 Replies

783 Views
Petr_H
NXP Employee
NXP Employee

Hi,

We have reproduced the problem with DAC component and it is a defect related to the internal value computation which we will fix for next release.  We are sorry for the inconvenience.

However, for Kinetis processors family, we recommend to use LDD components (in this case DAC_LDD) instead of “High level components”. The DAC component is interally using DAC_LDD anyway.

We have created simple example for you to use of the DAC_LDD component. Please find it attached.

In the code you can use setValue method to put the value to the DAC converter, like this:

DA1_SetValue(DA1_DeviceData, 2047)

Please note the first parameter of SetValue method- it is a pointer to DAC device data structure that holds the internal status of the device.

If you have enabled auto-initialization, this structure is created automatically and accessible using {componentName}_DeviceData macro so in this case there is DA1_DeviceData.

Best regards

Petr Hradsky

0 Kudos

783 Views
viniciuscarvalho
Contributor II

2016 and the problem stands.

But,

the solution of use DAC_LDD and change to external reference (Vdda) works.

0 Kudos

783 Views
bobapplonie
Contributor II

I had the same problem, but referring to the thread you referenced (No output DAC0 or 1 using CW10.5 using PE DAC_LDD component on K70 tower board), set the voltage reference source to External (Vdda) and it worked for me. My suspicion is that the VREF component is not available.

Good luck,

Bob

0 Kudos