<?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>topic Need help! Questions about i.mx6ul PWM8 interrupt in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Need-help-Questions-about-i-mx6ul-PWM8-interrupt/m-p/1191768#M165794</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I'm using a imx6ul board (ZLG imx6g2c) to develop a new product.&lt;BR /&gt;For some reason, I need a 'good' precision frequency, two differential-signal(s) to drive motor, at about 100Hz.&lt;BR /&gt;I have tried soft-delay in application level but it is too crude. That's why I study the PWM/EPIT carefully.&lt;/P&gt;&lt;P&gt;There's a pwm-imx.c in linux kernel tree's ../drivers/pwm/ subdirectory. But the default driver can't provide me&lt;BR /&gt;an interrupt service routine to raise dual-differential-signal to drive motor perfectly, I have to write my new driver.&lt;/P&gt;&lt;P&gt;I have written a basic-driver for PWM8 according &amp;lt;&amp;lt;Linux device driver: 3rd edition&amp;gt;&amp;gt;, unfortunately, there&lt;BR /&gt;are still some difficult questions:&lt;/P&gt;&lt;P&gt;(1) How can I enable the clock for PWM8 manually?&lt;/P&gt;&lt;P&gt;To avoid driver resource conflicts, I remove all of PWM8 relatived entries in device tree. But the clock source for PWM8 is&lt;BR /&gt;disabled automatically. So I have to re-enable it by myself.&lt;BR /&gt;I noticed two clock API named 'clk_get_sys()' and 'clk_prepare_enable()', but I have tried:&lt;BR /&gt;clk_get_sys("pwm8", NULL);&lt;BR /&gt;clk_get_sys("pwm8", "per");&lt;BR /&gt;clk_get_sys("pwm8", "ipg");&lt;BR /&gt;...&lt;BR /&gt;but all of them failed to get a 'struct clk *', so the PWM8 is not really clocked and can't be initted.&lt;/P&gt;&lt;P&gt;(2) How to caculate the IRQ # to call request_irq()?&lt;/P&gt;&lt;P&gt;I noticed the PWM8 interrupt is 149 in &amp;lt;&amp;lt;i.mx6ul reference manual_201508.pdf&amp;gt;&amp;gt;, page 173.&lt;BR /&gt;but it seems the Linux kernel throw many &amp;amp; many &amp;amp; many OOPS after these to lines:&lt;BR /&gt;......&lt;BR /&gt;g_motor.irq = 149;&lt;BR /&gt;if (request_irq(g_motor.irq, motor_irq_handler, 0, DEVICE_NAME, &amp;amp;g_motor) != 0)&lt;BR /&gt;{&lt;BR /&gt;printk(KERN_ALERT DEVICE_NAME ": request_irq(%d) fail.\n", g_motor.irq);&lt;BR /&gt;goto request_irq_fail;&lt;BR /&gt;}&lt;BR /&gt;printk(KERN_INFO "line %d passed, IRQ installed.\n", __LINE__);&lt;BR /&gt;......&lt;/P&gt;&lt;P&gt;Of cause, the 'line xxx passed, IRQ installed.' never be printed.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Could anyone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2020 18:32:24 GMT</pubDate>
    <dc:creator>sunxq</dc:creator>
    <dc:date>2020-12-01T18:32:24Z</dc:date>
    <item>
      <title>Need help! Questions about i.mx6ul PWM8 interrupt</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Need-help-Questions-about-i-mx6ul-PWM8-interrupt/m-p/1191768#M165794</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I'm using a imx6ul board (ZLG imx6g2c) to develop a new product.&lt;BR /&gt;For some reason, I need a 'good' precision frequency, two differential-signal(s) to drive motor, at about 100Hz.&lt;BR /&gt;I have tried soft-delay in application level but it is too crude. That's why I study the PWM/EPIT carefully.&lt;/P&gt;&lt;P&gt;There's a pwm-imx.c in linux kernel tree's ../drivers/pwm/ subdirectory. But the default driver can't provide me&lt;BR /&gt;an interrupt service routine to raise dual-differential-signal to drive motor perfectly, I have to write my new driver.&lt;/P&gt;&lt;P&gt;I have written a basic-driver for PWM8 according &amp;lt;&amp;lt;Linux device driver: 3rd edition&amp;gt;&amp;gt;, unfortunately, there&lt;BR /&gt;are still some difficult questions:&lt;/P&gt;&lt;P&gt;(1) How can I enable the clock for PWM8 manually?&lt;/P&gt;&lt;P&gt;To avoid driver resource conflicts, I remove all of PWM8 relatived entries in device tree. But the clock source for PWM8 is&lt;BR /&gt;disabled automatically. So I have to re-enable it by myself.&lt;BR /&gt;I noticed two clock API named 'clk_get_sys()' and 'clk_prepare_enable()', but I have tried:&lt;BR /&gt;clk_get_sys("pwm8", NULL);&lt;BR /&gt;clk_get_sys("pwm8", "per");&lt;BR /&gt;clk_get_sys("pwm8", "ipg");&lt;BR /&gt;...&lt;BR /&gt;but all of them failed to get a 'struct clk *', so the PWM8 is not really clocked and can't be initted.&lt;/P&gt;&lt;P&gt;(2) How to caculate the IRQ # to call request_irq()?&lt;/P&gt;&lt;P&gt;I noticed the PWM8 interrupt is 149 in &amp;lt;&amp;lt;i.mx6ul reference manual_201508.pdf&amp;gt;&amp;gt;, page 173.&lt;BR /&gt;but it seems the Linux kernel throw many &amp;amp; many &amp;amp; many OOPS after these to lines:&lt;BR /&gt;......&lt;BR /&gt;g_motor.irq = 149;&lt;BR /&gt;if (request_irq(g_motor.irq, motor_irq_handler, 0, DEVICE_NAME, &amp;amp;g_motor) != 0)&lt;BR /&gt;{&lt;BR /&gt;printk(KERN_ALERT DEVICE_NAME ": request_irq(%d) fail.\n", g_motor.irq);&lt;BR /&gt;goto request_irq_fail;&lt;BR /&gt;}&lt;BR /&gt;printk(KERN_INFO "line %d passed, IRQ installed.\n", __LINE__);&lt;BR /&gt;......&lt;/P&gt;&lt;P&gt;Of cause, the 'line xxx passed, IRQ installed.' never be printed.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Could anyone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 18:32:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Need-help-Questions-about-i-mx6ul-PWM8-interrupt/m-p/1191768#M165794</guid>
      <dc:creator>sunxq</dc:creator>
      <dc:date>2020-12-01T18:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need help! Questions about i.mx6ul PWM8 interrupt</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Need-help-Questions-about-i-mx6ul-PWM8-interrupt/m-p/1191977#M165824</link>
      <description>&lt;P&gt;Hi sunxq&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;FIGURE class="design-res-img"&gt;&lt;A id="designResources_collateral_image5" href="https://www.nxp.com/webapp/Download?colCode=SDK2.2_iMX6ULL_WIN&amp;amp;appType=license" data-dtmaction="Software &amp;amp; Tools tab: Developer Resources - Download Image Link click" data-dtmsubaction="SDK2.2_iMX6ULL_WIN" target="_blank"&gt;&lt;/A&gt;to avoid linux complexities one can try to manage pwm from M4 side&lt;/FIGURE&gt;
&lt;P&gt;using SDK (../driver_examples/pwm) :&lt;/P&gt;
&lt;H5 class="design-res-title"&gt;&lt;A id="designResources_title6" href="https://www.nxp.com/webapp/Download?colCode=SDK2.2_iMX6UL_WIN&amp;amp;appType=license" data-dtmaction="Software &amp;amp; Tools tab: Developer Resources - Download Link click" data-dtmsubaction="SDK2.2_iMX6UL_WIN" target="_blank"&gt;SDK2.2_iMX6UL_WIN&lt;/A&gt;&lt;/H5&gt;
&lt;SECTION class="design-res-content"&gt;
&lt;DIV class="design-res-info"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/SECTION&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 03:47:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Need-help-Questions-about-i-mx6ul-PWM8-interrupt/m-p/1191977#M165824</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2020-12-02T03:47:25Z</dc:date>
    </item>
  </channel>
</rss>

