<?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 clock on nRF52 does not lock on oscilloscope</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15087/pwm-clock-on-nrf52-does-not-lock-on-oscilloscope</link><description>I have a very simple program that generates a 50% duty cycle clock using the NRF_PWM0 on the new nRF52 device. Unfortunately, my Tektronix 1GHz oscilloscope doesn&amp;#39;t lock to the signal. If I used a Timer and GPIOTE with PPI then the clock was perfect.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Jul 2016 10:36:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15087/pwm-clock-on-nrf52-does-not-lock-on-oscilloscope" /><item><title>RE: PWM clock on nRF52 does not lock on oscilloscope</title><link>https://devzone.nordicsemi.com/thread/57636?ContentTypeID=1</link><pubDate>Wed, 13 Jul 2016 10:36:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83b86816-4a7c-432f-a681-8162b47191ef</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;You can use nrw_pwm_tasks_trigger.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM clock on nRF52 does not lock on oscilloscope</title><link>https://devzone.nordicsemi.com/thread/57637?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2016 22:56:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1980877c-42ab-401c-aca9-a04423809d51</guid><dc:creator>guraaf</dc:creator><description>&lt;p&gt;I did want to ask a thing though - I can use functions from nrf_pwm.h for everything other than starting the PWM task itself. For that I have to use the direct write to the register. Is the following correct and intended? Why is there no function to write to TASKS_SEQSTART[0]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_gpio_cfg_output(SAMPLE);
nrf_pwm_enable(NRF_PWM0);
nrf_pwm_pins_set(NRF_PWM0, out_pins);
nrf_pwm_configure(NRF_PWM0, NRF_PWM_CLK_16MHz, NRF_PWM_MODE_UP, 50);
nrf_pwm_decoder_set(NRF_PWM0, NRF_PWM_LOAD_INDIVIDUAL, NRF_PWM_STEP_AUTO);
nrf_pwm_shorts_set(NRF_PWM0, 0);
nrf_pwm_int_set(NRF_PWM0, 0);
nrf_pwm_loop_set(NRF_PWM0, 0);
nrf_pwm_sequence_set(NRF_PWM0, 0, &amp;amp;seq);
NRF_PWM0-&amp;gt;TASKS_SEQSTART[0] = 1; // &amp;lt;=== why no function?
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM clock on nRF52 does not lock on oscilloscope</title><link>https://devzone.nordicsemi.com/thread/57635?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2016 20:16:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bafcfc03-ec7f-435c-83b4-099de26b34d8</guid><dc:creator>guraaf</dc:creator><description>&lt;p&gt;I figured out my mistake and problem. It was the oscilloscope. With the correct settings, the output is stable. Sorry for taking up your time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM clock on nRF52 does not lock on oscilloscope</title><link>https://devzone.nordicsemi.com/thread/57634?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2016 17:54:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:159c4529-cd6c-4a9a-ac88-8475962077cf</guid><dc:creator>guraaf</dc:creator><description>&lt;p&gt;Thanks Øyvind. I tried exactly  your code but the waveform still keeps scrolling. The oscilloscope just doesn&amp;#39;t lock. It appears that the frequency period isn&amp;#39;t correct or maybe there is a phase shift of some sort?&lt;/p&gt;
&lt;p&gt;If I do stop the trigger or do a single capture then I do see the waveform period as 1 ms. The low-period is about 600 us and On duration is 400 us. This would be based upon the 10,000 value in pwm_seq[0].&lt;/p&gt;
&lt;p&gt;I am using Pin 5 and a few more unconnected pins but they all have scrolling clock. Note that I am using a single channel and not concerned about inverting the signal with Bit 16 (MSB) yet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM clock on nRF52 does not lock on oscilloscope</title><link>https://devzone.nordicsemi.com/thread/57633?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2016 13:27:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90c36eb5-5821-4272-8f6d-599d70c46127</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please refer to &lt;a href="https://devzone.nordicsemi.com/question/71325/nrf52-pwm-updown-counter-mode/"&gt;this answer&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can try the following code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main (void)
{
    // Start 16 MHz crystal oscillator .
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART    = 1;

    // Wait for the external oscillator to start up.
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0) {
    }

    uint16_t pwm_seq[4] = {10000, 11000 | 0x8000, 0, 0};
    NRF_PWM0-&amp;gt;PSEL.OUT[0] = (2 &amp;lt;&amp;lt; PWM_PSEL_OUT_PIN_Pos) | (PWM_PSEL_OUT_CONNECT_Connected &amp;lt;&amp;lt; PWM_PSEL_OUT_CONNECT_Pos);
    NRF_PWM0-&amp;gt;ENABLE      = (PWM_ENABLE_ENABLE_Enabled &amp;lt;&amp;lt; PWM_ENABLE_ENABLE_Pos);
    NRF_PWM0-&amp;gt;MODE        = (PWM_MODE_UPDOWN_Up &amp;lt;&amp;lt; PWM_MODE_UPDOWN_Pos);
    NRF_PWM0-&amp;gt;PRESCALER   = (PWM_PRESCALER_PRESCALER_DIV_1 &amp;lt;&amp;lt; PWM_PRESCALER_PRESCALER_Pos);
    NRF_PWM0-&amp;gt;COUNTERTOP  = (16000 &amp;lt;&amp;lt; PWM_COUNTERTOP_COUNTERTOP_Pos); //1 msec
    NRF_PWM0-&amp;gt;LOOP        = (PWM_LOOP_CNT_Disabled &amp;lt;&amp;lt; PWM_LOOP_CNT_Pos);
    NRF_PWM0-&amp;gt;DECODER   = (PWM_DECODER_LOAD_Individual &amp;lt;&amp;lt; PWM_DECODER_LOAD_Pos) | (PWM_DECODER_MODE_RefreshCount &amp;lt;&amp;lt; PWM_DECODER_MODE_Pos);
    NRF_PWM0-&amp;gt;SEQ[0].PTR  = ((uint32_t)(pwm_seq) &amp;lt;&amp;lt; PWM_SEQ_PTR_PTR_Pos);
    NRF_PWM0-&amp;gt;SEQ[0].CNT  = ((sizeof(pwm_seq) / sizeof(uint16_t)) &amp;lt;&amp;lt; PWM_SEQ_CNT_CNT_Pos);
    NRF_PWM0-&amp;gt;SEQ[0].REFRESH  = 0;
    NRF_PWM0-&amp;gt;SEQ[0].ENDDELAY = 0;
    NRF_PWM0-&amp;gt;TASKS_SEQSTART[0] = 1;

    while (1) {
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make sure that you are not using any pins that conflict with peripherals, for example on the DK you can use pin 0 and 1 as they are used by the HF crystal.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>