element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Blog Renesas Solution Starter Kit for RX23E-A: little voltmeter project
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 24 Jul 2023 6:06 PM Date Created
  • Views 1505 views
  • Likes 10 likes
  • Comments 7 comments
  • RoadTest
  • RX23e-a
  • renesas
  • d2a28d6e-11d8-11ee-be56-0242ac120002
Related
Recommended

Renesas Solution Starter Kit for RX23E-A: little voltmeter project

Jan Cumps
Jan Cumps
24 Jul 2023

I'm closing the Road test: Renesas Solution Starter Kit for RX23E-A with a little project: a 0 - 3.3V 24 bit volt meter with 512x oversampling. It's the most simple example possible, with just 1 channel on one ADC configured, and no input processing (nor protection !!).

image

The ADC 0 is configured exactly as the out-of-box firmware startup conditions.  I tested that in  Renesas Solution Starter Kit for RX23E-A: ADC Measurement . I added the code to convert the raw DAC measurement into its voltage representation.
image

inline float DsadToVoltage (int32_t dsad) {
	// VID = (2.5 * 2) / 1 * dsad / 2^24 (V)
	return (5) * (((float)dsad)/16777216);

}

Project

I only used one module: DSAD0:

image

image

I used the same user extensions for the ADC trigger as all the Renesas examples:

Config_DSAD0.h

/* Start user code for function. Do not edit comment generated here */
/**********************************************************************************************************************
 * Function Name: R_DSAD0_IsConversionEnd
 * Description  : This function returns the Conversion status of DSAD0.
 * Arguments    : None
 * Return Value : bool
 *                    false:Conversion, true:Conversion end
 *********************************************************************************************************************/
bool R_DSAD0_IsConversionEnd (void);

/**********************************************************************************************************************
 * Function Name: R_DSAD0_ClearIrFlag
 * Description  : This function clears the IR flag
 * Arguments    : None
 * Return Value : None
 *********************************************************************************************************************/
void R_DSAD0_ClearIrFlag (void);

/* End user code. Do not edit comment generated here */

Config_DSAD0.cpp

/* Start user code for adding. Do not edit comment generated here */

/**********************************************************************************************************************
 * Function Name: R_DSAD0_IsConversionEnd
 * Description  : This function returns the Conversion status of DSAD0.
 * Arguments    : None
 * Return Value : bool
 *                    false:Conversion, true:Conversion end
 *********************************************************************************************************************/
bool R_DSAD0_IsConversionEnd (void)
{
    return (bool) ((1U == IR(DSAD0, ADI0)) ? true : false);
}
/**********************************************************************************************************************
 End of function R_DSAD0_IsConversionEnd
 *********************************************************************************************************************/

/**********************************************************************************************************************
 * Function Name: R_DSAD0_ClearIrFlag
 * Description  : This function clears the IR flag
 * Arguments    : None
 * Return Value : None
 *********************************************************************************************************************/
void R_DSAD0_ClearIrFlag (void)
{
    IR(DSAD0, ADI0)= 0U;
}
/**********************************************************************************************************************
 End of function R_DSAD0_ClearIrFlag
 *********************************************************************************************************************/
/* End user code. Do not edit comment generated here */

The main code is just sampling and converting the result into the voltage:.

/***********************************************************************
*
*  FILE        : rx23ea_dsad0_gcc.c
*  DATE        : 2023-07-23
*  DESCRIPTION : Main Program
*
*  NOTE:THIS IS A TYPICAL EXAMPLE.
*
***********************************************************************/
#include "r_smc_entry.h"

/** Monitor variable definition (reference only) */
static volatile float   s_volt = 0.0F;                  /** Measured voltage [V]                            */
static volatile int32_t s_dsad0_value;                  /** DSAD0 24bit A/D value storage variable          */

float DsadToVoltage (int32_t dsad);

void main(void);

void main(void)
{

    /** A/D conversion start */
    R_Config_DSAD0_Start();
    R_Config_DSAD0_Set_SoftwareTrigger();

    while (1)
    {
        /** A/D conversion complete for DSAD0? */
        if (true == R_DSAD0_IsConversionEnd())
        {
            int32_t dsad0_value;        /** Signed 24-bit DSAD0 value                                   */
            float   volt_value;         /** Measured voltage                                            */

            R_DSAD0_ClearIrFlag();      /** clear DSAD0 IR flag                                         */

            /** Get A/D value */
            {
                uint32_t dsad0_reg;     /** DSAD0.DR register storage variable                          */
                R_Config_DSAD0_Get_ValueResult( &dsad0_reg);

                /** Flag mask, Sign extension */
                dsad0_value = (int32_t) ((dsad0_reg & 0x00FFFFFFU) << 8) >> 8;
                volt_value = DsadToVoltage(dsad0_value);
            }


            /** debug monitor */
            s_dsad0_value = dsad0_value;
            s_volt      = volt_value;
        }

    }

}


inline float DsadToVoltage (int32_t dsad) {
	// VID = (2.5 * 2) / 1 * dsad / 2^24 (V)
	return (5) * (((float)dsad)/16777216);

}

Test

This design can only accept voltages between 0 V and VCC (AVCC0 actually, but read the datasheet and board schematic). 3.3 V with a debugger, 5 V when USB power (VBus) is selected. Just be careful and keep it under 3 V. Only connect the voltage when the controller is powered, and disconnect it before power is lost. If you are using a debugger, the power is lost when you stop debugging. There is no input protection and the inputs can only take –0.3 to AVCC0 + 0.3. If the device is not powered, this means a hard -0.3 to +0.3 V limit. Be careful please. When in doubt, look at the price of the evaluation kit and re-evaluate your position. AIN2 is the negative input, AIN3 positive. No analogue side jumpers need to be changed for this project. 

I used an Analog Devices 2.5 Voltage reference as input. The result in the debugger:

image


I deliberately did not implement the PC Tool interface, although that is straightforward. I tried to create a high precision sample design with as little distraction as possible. If you want PC Tool integration, download the example projects of  one of my previous blogs and port it. Renesas has used the exact same approach for all examples. It isn't hard.

Closing the Road Test

What I learned from doing this project is that it isn't difficult to use the analogue features of the controller. The configurator helps you to set up (or in this blog: bypass) the front end, ADC and filter. An electronic engineer will have to use the same care as when designing a low noise / precision discrete design. Except that the design of front-end (amplifier, buffer, mux, current/voltage exciters, references) and ADC components can be skipped.
That is also the main focus of the controller. The other peripherals are focusing on giving that data efficiently to something else.
It has nice sleep + DMA options to keep the energy footprint low. It fits well in the segment where you need high analogue precision and no crazy calculation power. Not a lot of controllers have a 24 bit ADC with a good programmable  front-end (let alone 2). And as an engineer, you have to love the appnote examples. They are gems.

The e² studio projects with pre-compiled firmware

gcc toolchain version: rx23ea_dsad0_gcc.zip
cc-rx toolchain version: rx23ea_dsad0.zip

link to all posts

  • Sign in to reply
  • shabaz
    shabaz over 2 years ago

    Nice to see the voltage reference board being used to check the results! 

    I put a voltage source in an enclosure once, when I too needed a 2.5V reference. Doesn't do much, just offers the 2.5V when powered on!

    image

    However inside is a Texas Instruments REF5025 since that's what I had at the time. Nothing else to the circuit!  The copper-clad board is used for a ground plane and general chassis to stick everything to.

    image

    The green board on the left is a LiPo charger board I got from SparkFun. It's obsolete, it was quite a useful board. They sell better ones nowadays I'm sure. The LiPo cell was from SparkFun too I think. The enclosure was low-cost from Farnell. I liked the translucentness..

    Charging port is just 5V. I'd use a USB connector nowadays.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to bidrohini

    No, like most evaluation kits, it's a PCB without case. It has:

    • feet
    • K-type thermocouple
    • usb cable
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • bidrohini
    bidrohini over 2 years ago

    Does this kit include an enclosure?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • scottiebabe
    scottiebabe over 2 years ago

    Sad to see the summer of JC experiment with 24-bit ADCs come to an end, nice work on the blogs.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to genebren

    > At first I thought, what no results? Then I expanded the debug window image and found them

    Yes, I deliberately focused on the firmware to get the best possible sample of the input signal into a variable. The rest is software.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube