Behavior of Low Voltage Detection (LVD) in S7G2

I have implemented a test of the CPU voltage using the LVD and instructions found in Renesas app note R01AN3492EU0101.

I initially configured my test to generate an NMI if the CPU voltage fell below 2.99 volts. I didn't expect that I'd get an NMI in this case and I didn't.

Next, in order to validate that I had set everything up correctly (and since my CPU voltage is constant), I reconfigured my test to generate an NMI if the CPU voltage _exceeded_ 2.85 volts. But still no NMI.

My question is: will the low voltage detector generate an NMI if it sees the CPU voltage in violation of its configured limit? Or will it do so only when the CPU voltage actively _moves past_ its configured limit? In other words, is it looking for an edge? (that I'm not giving it in my experiment)

Any advice appreciated!


  • I should add that I set a breakpoint at the top of the function NMI_Handler and I did _not_ hit this breakpoint. So it appears that the problem is not merely that I did not properly install my handler (using R_BSP_GroupIrqWrite).

  • In reply to erik:

    Have you had a look at the Low Voltage Detection HAL Module Guide - Application Project

    I tried this and on a modified S7G2-SK, LVD seemed to be working

  • Hi, Richard. Thank you for your reply.

    I had not read this application note; my introduction to the LVD module came through the set of diagnostic modules I mentioned earlier. That said, this app note appears to provide sufficient guidance to help me properly configure LVD1 to verify that my CPU's supply voltage is in a nominal range which is my intent.

    I look forward to trying this out tomorrow. Thanks again.
  • In reply to erik:

    Hi, Richard. Thank you for your advice.

    Following the instructions in the app note, I added the LVD HAL module stack and it worked fine right off the bat. I'm using it in polled mode (rather than having it generate an NMI) which is fine for my power-on test application.

    Thanks again!
  • In reply to erik:

    Since we last discussed this, I have encountered a problem with my CPU voltage monitor and I will appreciate any advice.

    (Configuration settings for the HAL module are excerpted below from my configuration.xml file.)

    After checking the CPU’s supply voltage at runtime, I call the function R_LVD_Close. The problem is that this function is calling R_FMI_EventInfoGet which in turn calls HW_FMI_Event_Get which is returning SSP_ERR_IRQ_BSP_DISABLED. This appears to be an error but I’m not sure why. As you can see below, I attempted to configure the HAL module for no response, so I am polling the driver (using the statusGet API). I assume that all interrupts from the LVD module should be disabled.

    I will appreciate any help in debugging what’s going wrong here.

    Erik@DESKTOP-80R2TCM MINGW64 /c/git/timers (timers)
    $ grep -i lvd AcuteDevice/configuration.xml
    <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_lvd" variant="" vendor="Renesas" version="1.3.3">
    <description>Low Voltage Detection Module: Provides=[LVD]</description>
    <module id="module.driver.lvd.1516729794">
    <property id="" value="g_lvd"/>
    <property id="module.driver.lvd.monitor_number" value="module.driver.lvd.monitor_number.MONITOR_1"/>
    <property id="module.driver.lvd.sample_clock_divisor" value="module.driver.lvd.sample_clock_divisor.LVD_SAMPLE_CLOCK_DISABLED"/>
    <property id="module.driver.lvd.voltage_threshold" value="module.driver.lvd.voltage_threshold.LVD_THRESHOLD_MONITOR_1_LEVEL_11"/>
    <property id="module.driver.lvd.detection_response" value="module.driver.lvd.detection_response.LVD_RESPONSE_NONE"/>
    <property id="module.driver.lvd.voltage_slope" value="module.driver.lvd.voltage_slope.LVD_VOLTAGE_SLOPE_FALLING"/>
    <property id="module.driver.lvd.negation_delay" value="module.driver.lvd.negation_delay.LVD_NEGATION_DELAY_FROM_RESET"/>
    <property id="module.driver.lvd.lvd_monitor_callback" value="NULL"/>
    <property id="module.driver.lvd.monitor_ipl" value=""/>
    <stack module="module.driver.lvd.1516729794"/>
    <config id="config.driver.lvd">
    <property id="config.driver.lvd.param_checking_enable" value="config.driver.lvd.param_checking_enable.bsp"/>

    Erik@DESKTOP-80R2TCM MINGW64 /c/git/timers (timers)
  • In reply to erik:

    Hi Erik-
    When you say you are calling R_LVD_Close. Is this the API function for the LVD HAL module? I believe you should only be calling API functions, not lower level interface functions.

  • In reply to WarrenM:

    Well, I'm calling all my APIs through the g_lvd set of function pointers. Is this what you meant?

    if (SSP_SUCCESS != g_lvd.p_api->close (g_lvd.p_ctrl))
    // FAIL
  • In reply to erik:

    Hi Erik-
    Looking over the LVD Close code, it does look like the HW_FMI_EventGet call is related to an ELC Event. Are you using the ELC?

  • In reply to WarrenM:

    Yes, I am using the ELC. Should this be causing me to get bad status back from the low voltage detector's close API?