Skip to content

Conversation

quytranpzz
Copy link
Contributor

@quytranpzz quytranpzz commented Jul 25, 2025

Add comparator driver support on Renesas RX130 using LVD peripheral.
This driver uses a voltage threshold as the negative input, while the positive input can be selected between Vcc or the CMPA pin.

Copy link

github-actions bot commented Jul 25, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_renesas zephyrproject-rtos/hal_renesas@f0b7844 zephyrproject-rtos/hal_renesas#136 zephyrproject-rtos/hal_renesas#136/files

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hal_renesas DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Jul 25, 2025
@duynguyenxa duynguyenxa added the platform: Renesas RX Renesas Electronics Corp, RX label Jul 25, 2025
@quytranpzz quytranpzz force-pushed the renesas_rx_lvd_support branch 6 times, most recently from 6018f8c to c11e903 Compare July 28, 2025 04:46
@quytranpzz quytranpzz marked this pull request as ready for review August 5, 2025 09:51
@zephyrbot zephyrbot added area: Samples Samples platform: Renesas RA Renesas Electronics Corporation, RA area: RX area: Pinctrl labels Aug 5, 2025
@github-actions github-actions bot added the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Sep 16, 2025
@quytranpzz quytranpzz force-pushed the renesas_rx_lvd_support branch from 32de31c to 7f1fb14 Compare September 16, 2025 10:45
@quytranpzz quytranpzz changed the title drivers: misc: Add Low-voltage detection (LVD) driver support for RX130 drivers: comparator: Add Comparator support on Renesas RX Sep 16, 2025
@quytranpzz quytranpzz force-pushed the renesas_rx_lvd_support branch 3 times, most recently from 59e026a to b71daf0 Compare September 18, 2025 07:37
@decsny
Copy link
Member

decsny commented Sep 18, 2025

this is literally the 3rd PR I looked at in 15 minutes where NXP maintainer got pulled in despite no NXP files, please fix the MAINTAINER.yml

@@ -0,0 +1,271 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quytranpzz , This file name should be comparator_renesas_rx_lvd.c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done. I updated the file name

zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_LPCOMP comparator_nrf_lpcomp.c)
zephyr_library_sources_ifdef(CONFIG_COMPARATOR_SHELL comparator_shell.c)
zephyr_library_sources_ifdef(CONFIG_COMPARATOR_RENESAS_RA comparator_renesas_ra.c)
zephyr_library_sources_ifdef(CONFIG_COMPARATOR_RENESAS_RX_LVD comparator_renesas_rx.c)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quytranpzz , Please change file name to comparator_renesas_rx_lvd.c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done

Comment on lines 182 to 200
#define LVD_IRQ_CONNECT() \
do { \
IF_ENABLED(DT_NODE_HAS_STATUS_OKAY(LVD0_NODE), ( \
IRQ_CONNECT(DT_IRQN(LVD0_NODE), \
DT_IRQ(LVD0_NODE, priority), \
lvd_ch1_isr, \
DEVICE_DT_GET(LVD0_NODE), \
0); \
irq_enable(DT_IRQN(LVD0_NODE)); \
)) \
IF_ENABLED(DT_NODE_HAS_STATUS_OKAY(LVD1_NODE), ( \
IRQ_CONNECT(DT_IRQN(LVD1_NODE), \
DT_IRQ(LVD1_NODE, priority), \
lvd_ch2_isr, \
DEVICE_DT_GET(LVD1_NODE), \
0); \
irq_enable(DT_IRQN(LVD1_NODE)); \
)) \
} while (0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quytranpzz , I think it would be better to add this as static inline function
e.g.

static inline void lvd_irq_connect(void)
{
#if DT_NODE_HAS_STATUS_OKAY(LVD0_NODE)
    IRQ_CONNECT(DT_IRQN(LVD0_NODE), DT_IRQ(LVD0_NODE, priority), lvd_ch1_isr, DEVICE_DT_GET(LVD0_NODE), 0);
    irq_enable(DT_IRQN(LVD0_NODE));
#endif
#if DT_NODE_HAS_STATUS_OKAY(LVD1_NODE)
    IRQ_CONNECT(DT_IRQN(LVD1_NODE), DT_IRQ(LVD1_NODE, priority), lvd_ch2_isr, DEVICE_DT_GET(LVD1_NODE), 0);
    irq_enable(DT_IRQN(LVD1_NODE));
#endif
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I have updated it as a static inline function

@decsny decsny removed their request for review September 23, 2025 11:22
Update the latest commit ID for HAL Renesas

Signed-off-by: Quy Tran <[email protected]>
Add comparator support for Renesas RX with LVD

Signed-off-by: Quy Tran <[email protected]>
Add DTS node for LVD support on RX130

Signed-off-by: Quy Tran <[email protected]>
Add a simple sample using Comparator API to monitor the
voltage on Renesas boards

Signed-off-by: Quy Tran <[email protected]>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Comparator area: Pinctrl area: RX area: Samples Samples DNM (manifest) This PR should not be merged (controlled by action-manifest) manifest manifest-hal_renesas platform: Renesas RA Renesas Electronics Corporation, RA platform: Renesas RX Renesas Electronics Corp, RX platform: Renesas Renesas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants