I'm evaluating the Renesas RX65N MCU EV Kit. In this post, I'm reviewing the Digital Analog Converter |
Adapt the Envision Kit
The RX65N has two DAC channels. On the controller, they are PO3 and P05.
source: Renesas datasheet
These pins are both in use in the Envision kit. P03 is joystick pin 5, P05 is used for SW2, the user button.
These aren't broken out to any of the connectors, so some modification is needed.
The easiest is to tap DA1 off from the joystick. That isn't populated and the pcb pad is big enough to solder something to.
The 10nF capacitor C52 will slightly influence the edges and speed of the DAC.
The pull-up influences the lowest measurement. I'm going to remove the 2 components.
Edit: I did the original measurements with the pull-up and cap in place. You'll find the measurements without these components at the end of the blog.
I've cut off one position of a female pin header with long lead.
I bent the lead so that it touches the pad with little force.
I glued down the connector with Loctite to avoid any mechanical stress. These pads rip off easily.
DAC Firmware
I used the Renesas dac_demo_rskrx65n_2m example as base.
/* The RX65N_2MB has a 12-bit DAC so initiate low/med/high data value accordingly. */ uint16_t data_low = 0x0; uint16_t data_med = 0x7FF; uint16_t data_high = 0xFFF;
I didn't change any DAC functionality. I only simplified the LED animation scheme.
The original code uses 3 LEDs to indicate the ADC levels.
The Envision board has a single led, so I used that to change state after each level change.
while (1) { R_DAC_Write (DAC_CH0, data_low); LED2 = LED_ON; R_BSP_SoftwareDelay (1, BSP_DELAY_SECS); R_DAC_Write (DAC_CH0, data_med); LED2 = LED_OFF; R_BSP_SoftwareDelay (1, BSP_DELAY_SECS); R_DAC_Write (DAC_CH0, data_high); LED2 = LED_ON; R_BSP_SoftwareDelay (1, BSP_DELAY_SECS); LED2 = LED_OFF; }
In rskrx65n_2mb.h, I changed the definition of LED2 to match the board:
#define LED2 PORT7.PODR.BIT.B0 // ... #define LED2_PDR PORT7.PDR.BIT.B0
The e2 studio project is attached.
Measurements
These measurements were done when the 22K joystick pull-up resistor R50 was still in place.
This resistor has a significant impact on the measurements. See the last section for measurements with an unloaded DAC output.
The 3 first captures show the DAC output on a DMM.
I've captured 1000s of samples on a digitising meter and saved them to a spreadsheet (attached).
You can download it and validate the stability.
Ramp Behaviour
The first image shows a rising edge as measured by a digitising meter. The same data as above is used.
The 2 scaptures below are a rising and falling edge.
Edit: After Removing the Joystick Pull-up Resistor and Debounce Capacitor
Removing these two is slightly tricky. They are very close to the touch screen flatflex and C38.
Be very careful not to heat the flatflex connector. It's easy to deform it with a hot air gun. Don't blow away C38 (although no harm done when it flies).
The DAC works as expected now:
I measure 0V at 0x00, half scale at 0x7FF, full scale when all twelve bits are set, 0xFFF.
Top Comments