UNO R4 ADC resolution

On
https://docs.arduino.cc/tutorials/uno-r4-minima/adc-resolution
there is a description of a way how to increase the ADC resolution. It says

which can be updated to both 12-bit (0-4096) and 14-bit (0-65355) resolutions

Well, it looks like there are two errors: 2^16-1=65535, but 2^14-1=16383.
No information given if it is done by hardware or by oversampling. I tried to check the the "arduino_build_xxx-folder" for some code, it is huge: 44 MByte, but no information given. And avr-objdump.exe does not work in this case.
Is it still too early to request some infos?

Please don't duplicate Topics it doesn't get you more help, but wastes others time.

No, the board has been released to the general public.

@Klausj

Your other topic on the same subject deleted.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

1 Like

of course it doesn't - the R4 does not use an AVR!

it had been nice if somebody had told us which tool to use instead

the standard one you'd use with an ARM Cortex-M ?

Hi @Klausj

The objdump tool to use with the binaries produced by compiling for the UNO R4 Minima is arm-none-eabi-objdump. It is located in the same folder as the other GCC tools that are used during compilation.

You can see the location of the tools by doing the following:

  1. Select File > Preferences... from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Check the box next to "Show verbose output during: ☐ compilation" in the "Preferences" dialog.
  3. Click the OK button.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to finish.
  6. Examine the contents of the "Output" panel at the bottom of the Arduino IDE window. There you will see the compilation commands, including the paths to the compiler tools.

You will also see the path to the generated binary file in the output.

For Windows users, it will currently be located at this path:

C:\Users\<username>\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-objdump.exe

(where <username> is your Windows username)

2 Likes

Hi @ptillisch, that was the most helpful reply I ever got.
Looks like I have to get used to the fact that I have to go through 2400 lines of compilation output and another 18200 lines of generated source code (containing 168 NOP instructions) produced from just two lines of Arduino code. (It was different using the R3.)
At the end of the day, Karl Söderby should correct his posting on ADC (published 29.6.23)
Most people would not find it as fascinating as a crime novel but I do.

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per

Look at the C++ source:
Arduino15/packages/arduino/hardware/renesas_uno/1.0.1/cores/arduino/analog.cpp

From the comments the ADC always is 12-bits and the result is then scaled to the requested resolution. The scaling is in done on line 495.

One can get 14 bits - having an external precision Aref of 4.096V improves matters.

This might help:

1 Like

I set my resolution at 14 bit. I am getting a fullscale of 65520 (2^16 = 65535) when 2^14 should be 16384?

I set my resolution to 12 and generated 5V with my fluke 724 temperature calibrator (it also sources upto 10V) and i now see 14000+ (0.5 V to 4.5 V sensor).

Whats interesting is my consistent noise of ~4000 steps has been reduced to an occaisional ~8 steps just by setting the resolution lower