<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21201/pwm-hardware-individual-loading-mode-nrf52</link><description>Please can anyone help me on how to use(program) PWM hardware with individual loading mode? My goal is to control 12 LEDs individually with different duty cycles and playbacks using pwm hardware which has 12 outputs to make a kind of led chaser. 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Apr 2017 13:28:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21201/pwm-hardware-individual-loading-mode-nrf52" /><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82969?ContentTypeID=1</link><pubDate>Mon, 24 Apr 2017 13:28:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58033544-de81-4da4-8811-570ca4bf94e2</guid><dc:creator>akshaey</dc:creator><description>&lt;p&gt;i have got a working code for managing 12 hardware pwm + 8 software pwm together to make a led chaser for 16 leds. Check the following link&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Aksrobin/nrf52"&gt;github.com/.../nrf52&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82971?ContentTypeID=1</link><pubDate>Fri, 21 Apr 2017 09:11:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26dbe794-0925-4b58-a85e-f8b73bc66480</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Sorry for late response, I was on vacation.&lt;/p&gt;
&lt;p&gt;Why do you use this code in the middle of main() ?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   for (;;)
    {
        // Wait for an event.
        __WFE();

        // Clear the event register.
        __SEV();
        __WFE();
        NRF_LOG_FLUSH();
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is infinite loop and you won&amp;#39;t be able to execute code under this loop&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82975?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 16:08:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a95428e-199f-4788-a792-573d35415c75</guid><dc:creator>akshaey</dc:creator><description>&lt;p&gt;i have modified and put the sdk_config file, now there are no errors, the hardware pwm is working on demo 5, but the software pwm is not. this is the final code--&lt;/p&gt;
&lt;p&gt;&lt;a href="https://drive.google.com/open?id=0B2YxaMrcnlAJc3F2U3lLOHBudW8"&gt;drive.google.com/open&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;please let me know what am i doing wrong.&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82974?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 15:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7a09595-55ce-4655-88d4-89d1b8fb0835</guid><dc:creator>akshaey</dc:creator><description>&lt;p&gt;please check the program i have attached-&lt;/p&gt;
&lt;p&gt;&lt;a href="https://drive.google.com/open?id=0B2YxaMrcnlAJcUFJM0VRbmlwNlE"&gt;drive.google.com/open&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;i have copied code from pwm_driver into pwm_library and have added relative .c files like app_timer.c or nrf_drv_pwm.c
It gives the following error-&lt;/p&gt;
&lt;p&gt;._build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol app_timer_init (referred from main.o).
._build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol bsp_buttons_enable (referred from main.o).
._build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol bsp_init (referred from main.o)..&lt;/p&gt;
&lt;p&gt;etc&lt;/p&gt;
&lt;p&gt;what am i missing to add? Please let me know.
thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82973?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 10:13:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86982687-2fd5-47f0-be89-cd9066262d03</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Yes, it should work. Please refer to the nRF52 product specification to find how PWM work at chapter 47.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see any reason software pwm couldn&amp;#39;t work when hardware pwm is also used. Please try to integrate software pwm first before you implement pwm hardware.&lt;/p&gt;
&lt;p&gt;Please be more clear on what error you have.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82972?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 08:00:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b74692b-ef97-4746-b567-350bdd484c94</guid><dc:creator>akshaey</dc:creator><description>&lt;p&gt;thanks for your reply,&lt;/p&gt;
&lt;p&gt;i have used the following method to vary pwm in 4 channels-&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;the code is as follows-


   static nrf_pwm_values_individual_t  /*const*/ seq_values[] =
    {
      

  { 0, 5000, 5000, 5000 },
   { 250, 4750, 5000, 5000 },
   { 500, 4500, 5000, 5000},
	 { 750, 4250, 5000, 5000 },
	 { 1000, 4000, 5000, 5000 }

 };
    nrf_pwm_sequence_t const seq =
    {
        .values.p_individual = seq_values,
        .length              = NRF_PWM_VALUES_LENGTH(seq_values),
        .repeats             = 40,
        .end_delay           = 0
    };

    nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;seq, 1, NRF_DRV_PWM_FLAG_LOOP);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it works but is it the correct method? Also can you help me as how can i use software pwm along with this program of hardware pwm? when i copy the code directly from pwm_library, it gives an error.&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82976?ContentTypeID=1</link><pubDate>Mon, 10 Apr 2017 15:20:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfa3a75a-0545-487c-94d0-24edd26e2aa4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@akshaey: If you do this in the pwm_driver example you can see LED1 at 20% duty cycle , LED2 at 40% duty cycle, LED3 at 60%, and LED4 at  80%. Base clock is 1MHz and count to 10000 top (m_demo1_top = 10000) meaning the frequency is 100Hz. LED1 is at 205 duty cycle because I set   m_demo1_seq_values.channel_0 = 2000; You can choose anything else.&lt;/p&gt;
&lt;p&gt;You can remove demo1_handler() if you don&amp;#39;t need a handler (passing NULL when calling nrf_drv_pwm_init)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void demo1_handler(nrf_drv_pwm_evt_type_t event_type)
{
   
}
static void demo1(void)
{
    NRF_LOG_INFO(&amp;quot;Demo 1\r\n&amp;quot;);

    /*
     * This demo plays back a sequence with different values for individual
     * channels (LED 1 - LED 4). Only four values are used (one per channel).
     * Every time the values are loaded into the compare registers, they are
     * updated in the provided event handler. The values are updated in such
     * a way that increase and decrease of the light intensity can be observed
     * continuously on succeeding channels (one second per channel).
     */

    nrf_drv_pwm_config_t const config0 =
    {
        .output_pins =
        {
            BSP_LED_0 | NRF_DRV_PWM_PIN_INVERTED, // channel 0
            BSP_LED_1 | NRF_DRV_PWM_PIN_INVERTED, // channel 1
            BSP_LED_3 | NRF_DRV_PWM_PIN_INVERTED, // channel 2
            BSP_LED_2 | NRF_DRV_PWM_PIN_INVERTED  // channel 3
        },
        .irq_priority = APP_IRQ_PRIORITY_LOWEST,
        .base_clock   = NRF_PWM_CLK_1MHz,
        .count_mode   = NRF_PWM_MODE_UP,
        .top_value    = m_demo1_top,
        .load_mode    = NRF_PWM_LOAD_INDIVIDUAL,
        .step_mode    = NRF_PWM_STEP_AUTO
    };
    APP_ERROR_CHECK(nrf_drv_pwm_init(&amp;amp;m_pwm0, &amp;amp;config0, demo1_handler));
    m_used |= USED_PWM(0);

    m_demo1_seq_values.channel_0 = 2000;
    m_demo1_seq_values.channel_1 = 4000;
    m_demo1_seq_values.channel_2 = 6000;
    m_demo1_seq_values.channel_3 = 8000;
    m_demo1_phase                = 0;

    (void)nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;m_demo1_seq, 1,
                                      NRF_DRV_PWM_FLAG_LOOP);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here only show you with 4 PWM, you can extend to 12 PWM by using more instance m_pwm1 and m_pwm2, with same configuration.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82977?ContentTypeID=1</link><pubDate>Mon, 10 Apr 2017 11:49:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5422672-d385-4812-b840-fedb9746e155</guid><dc:creator>akshaey</dc:creator><description>&lt;p&gt;Yes i was modyfying the pwm driver example by changing to individual loading mode, but can you please give me an example as how to control duty cycle of each individual channel so that i can have 12 outputs with different duty cycles?
thanks in advance&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pwm hardware individual loading mode nrf52</title><link>https://devzone.nordicsemi.com/thread/82970?ContentTypeID=1</link><pubDate>Mon, 10 Apr 2017 11:20:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d72bdf5-2e24-4bf7-a891-6c59516455f6</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Akshaey: Have you tried to play with the pwm_driver example in the SDK the demo 1 example ? We have 3 PWM instance (PWM0, PWM1, PWM2) and each has 4 channels. In these 4 channel, they will have the same frequency, you can control duty cycle for each of them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>