Can the Kinetis DAC0_OUT Pin be used as a Digital Output?

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

Can the Kinetis DAC0_OUT Pin be used as a Digital Output?

722 Views
myke_predko
Senior Contributor III

I'm just putting together a list of pin resources for my product and, no surprises, I'm running out of IO. 

Is it possible to use DAC0_OUT as an Digital Output?  For the application, the operation does not need to be particularly fast nor high current (1mA max). 

Any example code (I will be working with KSDK2) would be very much appreciated. 

Thanx,

myke

0 Kudos
2 Replies

477 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Myke:

Please always mention the full part number so we can provide better assistance.

Regarding DAC0_OUT, you need to check the pinout table in the corresponding Reference Manual to see if the pin has a GPIO function assigned under ALT0.

- For example the KL25 manual shows this:

pastedImage_0.png

Then you can configure the pin as PTE30 and use it as GPIO. It can also be used for TPM module.

- On the other hand if you see the K64 manual then you would find this:

pastedImage_1.png

Then you can see that the pin does not have any digital function, only analog (DAC, Comparator and ADC).

- Now if you intend to use the DAC low and high digital values conversion to emulate a digital output then I guess it is possible but not an efficient approach. Also as you mentioned pay attention not to exceed the max output load current as specified in the datasheet. Below an example for K64:

K64_DAC.png


Best regards,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

477 Views
myke_predko
Senior Contributor III

HI Jorge,

Thank you for the reply - sorry about that, the part number I'm interested in is the MK22FN128VLH10

If I look at the datasheet, the DAC0_OUT pin is the same as the K64 example you quoted.

Going a bit further and looking at the KSDK2 API Reference, I see

Working as a basic DAC without the hardware buffer feature.

// ...

// Configures the DAC.

DAC_GetDefaultConfig(&dacConfigStruct);

DAC_Init(DEMO_DAC_INSTANCE, &dacConfigStruct);

DAC_SetBufferReadPointer(DEMO_DAC_INSTANCE, 0U);

// ...

DAC_SetBufferValue(DEMO_DAC_INSTANCE, 0U, dacValue);

Which should give me the capability to set DAC0_OUT to the output that is required (by calling "DAC_SETBufferValue" as needed)?

myke

0 Kudos