<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MCX Microcontrollersのトピック回复： MCXN947 HPDAC backport</title>
    <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2414161#M5923</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/259637"&gt;@wesOS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for confirming your results. The fact that both of us observe DAC2 clock before config: 0 Hz and 48000000 Hz after the clock configuration strongly suggests that the DAC2 clock is not initialized before the HPDAC driver runs.&lt;/P&gt;
&lt;P&gt;I have already reported the bug fix to our internal Zephyr team.&lt;/P&gt;
&lt;P&gt;After looking further into the FRDM-MCXN947 implementation, I found that the existing DAC clock initialization is currently handled at the board level rather than in the DAC drivers themselves.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;zephyr/boards/nxp/frdm_mcxn947/board.c&lt;/LI-CODE&gt;
&lt;P&gt;the function:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;void board_early_init_hook(void)&lt;/LI-CODE&gt;
&lt;P&gt;performs the clock and SPC initialization for both DAC0 and DAC1:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac0))
        SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac0);
        CLOCK_SetClkDiv(kCLOCK_DivDac0Clk, 1u);
        CLOCK_AttachClk(kFRO_HF_to_DAC0);

        CLOCK_EnableClock(kCLOCK_Dac0);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac1))
        SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac1);
        CLOCK_SetClkDiv(kCLOCK_DivDac1Clk, 1u);
        CLOCK_AttachClk(kFRO_HF_to_DAC1);

        CLOCK_EnableClock(kCLOCK_Dac1);
#endif&lt;/LI-CODE&gt;
&lt;P&gt;Based on the current implementation, my expectation would be to keep the solution consistent with the existing board design. In other words, the DAC2 clock initialization could be added to board_early_init_hook() alongside the existing DAC0/DAC1 initialization rather than placing board-specific clock setup into the generic HPDAC driver.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2026 02:08:35 GMT</pubDate>
    <dc:creator>Harry_Zhang</dc:creator>
    <dc:date>2026-09-17T02:08:35Z</dc:date>
    <item>
      <title>MCXN947 HPDAC backport</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2412797#M5914</link>
      <description>&lt;P&gt;I am backporting the Zephyr nxp_hpdac driver to Zephyr 4.3 for an MCXN947-based board.&lt;/P&gt;&lt;P&gt;The upstream driver does not use a device init callback. However, on Zephyr 4.3 the HPDAC does not work correctly unless I explicitly initialize the DAC2 clock, SPC analog modules and reset before using the peripheral.&lt;/P&gt;&lt;P&gt;I added an nxp_hpdac_init() function which performs the following steps:&lt;/P&gt;&lt;P&gt;CLOCK_SetClkDiv(kCLOCK_DivDac2Clk, 1U)&lt;BR /&gt;CLOCK_AttachClk(kFRO_HF_to_DAC2)&lt;BR /&gt;CLOCK_EnableClock(kCLOCK_Dac2)&lt;/P&gt;&lt;P&gt;SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac2)&lt;BR /&gt;SPC_EnableLowPowerModeAnalogModules(SPC0, kSPC_controlDac2)&lt;/P&gt;&lt;P&gt;RESET_PeripheralReset(kDAC2_RST_SHIFT_RSTn)&lt;/P&gt;&lt;P&gt;DAC14_DoSoftwareReset()&lt;BR /&gt;DAC14_DoFIFOReset()&lt;/P&gt;&lt;P&gt;SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlVref)&lt;/P&gt;&lt;P&gt;These initialization steps were based on the MCXN947 reference manual and implemented using the corresponding MCUX SDK APIs.&lt;/P&gt;&lt;P&gt;The init function is registered as the device init callback through DEVICE_DT_INST_DEFINE(). With these changes, the HPDAC works correctly.&lt;/P&gt;&lt;P&gt;I also checked the Zephyr MCUX SYSCON clock-control driver and the mcux_lpc_syscon_clock.h bindings, but I could not find an HPDAC/DAC2 clock identifier or clock-control implementation for this peripheral, so I am currently using the MCUX SDK clock, SPC and reset APIs directly.&lt;/P&gt;&lt;P&gt;My questions are:&lt;/P&gt;&lt;P&gt;1. Is this the correct approach when backporting the MCXN947 HPDAC driver?&lt;/P&gt;&lt;P&gt;2. In newer Zephyr versions, are these resources initialized somewhere else, or does the upstream nxp_hpdac driver assume that they have already been configured?&lt;/P&gt;&lt;P&gt;3. Is the HPDAC device init callback the correct place for this MCXN947-specific initialization, or should these steps be handled elsewhere in Zephyr?&lt;/P&gt;&lt;P&gt;I have attached the complete backported driver for reference.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2026 15:29:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2412797#M5914</guid>
      <dc:creator>wesOS</dc:creator>
      <dc:date>2026-09-10T15:29:22Z</dc:date>
    </item>
    <item>
      <title>回复： MCXN947 HPDAC backport</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2413286#M5919</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/259637"&gt;@wesOS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Is this the correct approach when backporting the MCXN947 HPDAC driver?&lt;/P&gt;
&lt;P&gt;Yes, this is a reasonable and practical approach for the backport. If the required DAC2 clock, SPC analog modules, VREF, and reset resources are not initialized elsewhere in the Zephyr 4.3 environment, performing the initialization in the driver is necessary to ensure correct HPDAC operation.&lt;/P&gt;
&lt;P&gt;2. In newer Zephyr versions, are these resources initialized somewhere else, or does the upstream nxp_hpdac driver assume that they have already been configured?&lt;/P&gt;
&lt;P&gt;HPDAC support has already been added upstream:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/zephyrproject-rtos/zephyr/pull/104642" target="_blank" rel="noopener"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/104642&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;However, I performed a quick verification using the current upstream implementation and observed that the DAC2 clock does not appear to be configured. For example, CLOCK_GetDacClkFreq(2) reports 0 Hz in my test environment, while the equivalent MCUX SDK example reports 48 MHz after the DAC clock is configured.&lt;/P&gt;
&lt;P&gt;Based on this observation, it appears that the current driver may be assuming that certain device resources have already been configured. Could you please double-check the clock configuration path on your side as well?&lt;/P&gt;
&lt;P&gt;I will also report this to our Zephyr team for further investigation and work with them to address the issue if a missing clock initialization bug is confirmed.&lt;/P&gt;
&lt;P&gt;3. Is the HPDAC device init callback the correct place for this MCXN947-specific initialization, or should these steps be handled elsewhere in Zephyr?&lt;/P&gt;
&lt;P&gt;For a backport, placing this logic in the HPDAC device initialization callback is a practical and acceptable solution.&lt;/P&gt;
&lt;P&gt;That said, the MCXN947-specific DAC2 clock, SPC, VREF, and reset configuration should ideally be clearly isolated as SoC-specific functionality rather than embedded as generic HPDAC behavior. In the longer term, these resources would preferably be managed through Zephyr infrastructure such as clock, reset, or power-management frameworks where applicable.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2026 06:02:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2413286#M5919</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2026-09-14T06:02:40Z</dc:date>
    </item>
    <item>
      <title>回复： MCXN947 HPDAC backport</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2414079#M5922</link>
      <description>&lt;P&gt;Thanks, I double-checked the DAC2 clock path on my MCXN947 setup.&lt;/P&gt;&lt;P&gt;Before the HPDAC driver configures the clock: &amp;lt;inf&amp;gt; dac_nxp_hpdac: DAC2 clock before config: 0 Hz&lt;/P&gt;&lt;P&gt;After:&lt;BR /&gt;&lt;BR /&gt;CLOCK_SetClkDiv(kCLOCK_DivDac2Clk, 1U);&lt;BR /&gt;CLOCK_AttachClk(kFRO_HF_to_DAC2);&lt;BR /&gt;CLOCK_EnableClock(kCLOCK_Dac2);&lt;/P&gt;&lt;P&gt;I get: &amp;lt;inf&amp;gt; dac_nxp_hpdac: DAC2 clock after config: 48000000 Hz&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;So I am seeing the same behavior on my side: the DAC2 clock is not configured before the HPDAC driver initialization.&lt;/P&gt;&lt;P&gt;Your explanation about keeping the MCXN947-specific resource handling isolated also makes sense.&lt;/P&gt;&lt;P&gt;What I am mainly trying to understand now is how you expect that initialization to be divided in the eventual upstream solution.&lt;/P&gt;&lt;P&gt;For example, do you expect the DAC2 clock configuration, SPC/VREF setup and reset handling to each move into their corresponding Zephyr/SoC infrastructure, with `dac_nxp_hpdac.c` only keeping the generic HPDAC initialization?&lt;/P&gt;&lt;P&gt;I am mainly asking so I can understand the intended ownership of each initialization step and keep the backport reasonably aligned with that direction.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Ouassim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2026 12:51:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2414079#M5922</guid>
      <dc:creator>wesOS</dc:creator>
      <dc:date>2026-09-16T12:51:25Z</dc:date>
    </item>
    <item>
      <title>回复： MCXN947 HPDAC backport</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2414161#M5923</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/259637"&gt;@wesOS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for confirming your results. The fact that both of us observe DAC2 clock before config: 0 Hz and 48000000 Hz after the clock configuration strongly suggests that the DAC2 clock is not initialized before the HPDAC driver runs.&lt;/P&gt;
&lt;P&gt;I have already reported the bug fix to our internal Zephyr team.&lt;/P&gt;
&lt;P&gt;After looking further into the FRDM-MCXN947 implementation, I found that the existing DAC clock initialization is currently handled at the board level rather than in the DAC drivers themselves.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;zephyr/boards/nxp/frdm_mcxn947/board.c&lt;/LI-CODE&gt;
&lt;P&gt;the function:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;void board_early_init_hook(void)&lt;/LI-CODE&gt;
&lt;P&gt;performs the clock and SPC initialization for both DAC0 and DAC1:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac0))
        SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac0);
        CLOCK_SetClkDiv(kCLOCK_DivDac0Clk, 1u);
        CLOCK_AttachClk(kFRO_HF_to_DAC0);

        CLOCK_EnableClock(kCLOCK_Dac0);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac1))
        SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac1);
        CLOCK_SetClkDiv(kCLOCK_DivDac1Clk, 1u);
        CLOCK_AttachClk(kFRO_HF_to_DAC1);

        CLOCK_EnableClock(kCLOCK_Dac1);
#endif&lt;/LI-CODE&gt;
&lt;P&gt;Based on the current implementation, my expectation would be to keep the solution consistent with the existing board design. In other words, the DAC2 clock initialization could be added to board_early_init_hook() alongside the existing DAC0/DAC1 initialization rather than placing board-specific clock setup into the generic HPDAC driver.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2026 02:08:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN947-HPDAC-backport/m-p/2414161#M5923</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2026-09-17T02:08:35Z</dc:date>
    </item>
  </channel>
</rss>

