I need more information on the DAC in the R4 Minima

There is very little detail on the operation of the DAC. All I could find was that it has a resolution of 12 bits, and that its output is via the A0 pin. Yet after a fair bit of searching I found that the DAC has a default resolution of only 8 bits -- and can only be changed to 12 bits by using the command 'analogWriteResolution(12)'. But this command is not accepted by my Arduino IDE!
There is also no information on the DAC's reference voltage, and whether its output swing is simply between 0V and the reference voltage, or it swings in bipolar fashion about the midpoint.
Frankly I find this a bit disappointing. Can anyone help?

...I don't have an R4.

Does the IDE have an Uno R4 selection? Are you using the latest IDE? (I assume the older IDE versions don't work at all, since the R4 has a different processor.)

There is no negative power supply connection, so no negative voltage available. That's true of most DACs.

For audio (or other AC applications) you add bias to the data and use a "DC blocking capacitor" to take-out the DC bias (essentially a high-pass filter).

Or you can use a summing amplifier and sum the DAC output with a negative voltage, or you can make an inverting amplifier to get negative voltages, etc.

Read the data sheet. It has more information than you care to know :slightly_smiling_face:.
https://www.renesas.com/us/en/document/dst/renesas-ra4m1-group-datasheet

1 Like

If it's information on the internal operation of the DAC you're after, start reading at page 1149 of the Renesas RA4M1 Group User's Manual: Hardware.

And analogWriteResolution(12) compiled just fine for me with the R4 Minima selected. Do you have the latest version of the Arduino UNO R4 Boards package installed from the boards manager?

1 Like

What do you want to do with the D/A?
I sorted out the basics here

This talks about the reference voltage and synthesizing a wave shape from a look up table

This is my latest video with a link to the code for playing the game of Life and turning each lit pixel into a note.

Yes the documentation on the R4 boards is very poor, and it is very disappointing, and it has been left to members to work it out themselves.

That is the things that can be worked out. Basically there are things that we just can't work out, like how the boot loader actually works, and how to send MIDI messages through the USB port. But we are not getting much help about these questions from the people who actually wrote the code, let alone document it.

Hi DVDdoug,

Well, I am now using the latest IDE (2.2.1), which does have a selection for the Uno R4.
But I realised that there wouldn't be a true negative output from the DAC -- I simply wanted information regarding whether the firmware in the R4 simply changed the digital input to a DC output in linear fashion (i.e., 0 in > 0V and 255 in > maximum voltage) or interpreted a 0 input to produce a half-supply voltage, with higher positive input giving higher output voltages and negative inputs giving a lower output voltage. There seems to be very little about this explained...

Hi Grumpy_Mike,

Thanks for your info. Yes, I have seen that post of the Hairy output on R4 DAC, and also the sample sketches in the Arduino UNO R4 Minima DAC 'tutorial'. But the latter use a special library, and I couldn't find much help when I looked through the analogWave.h and analogWave.cpp files in the library. As you said, we seem to be left to work a lot of this out for ourselves!

Yes that is what it does in the 8 bit default mode.

Yes, I came to the conclusion that these two files are not much use in outputting audio. While you can use them to do so, changing the sampling frequency is not the correct way of doing it. You are also very limited in the output rate you can achieve, less than 44K samples per second. With my way of doing things you can output data from the ADC at a rate of about 1M samples per second if you want to.

There is a github page for flagging up corrections
Corrections
However, it seems to me very bureaucratic.

Look through the open items to see what is still to do. Look through the closed items to see what has been done.

TriodeGirl has a couple of nice examples for the Uno R4 DAC. See