<?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>nrf52832 PWM with EasyDMA problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44313/nrf52832-pwm-with-easydma-problem</link><description>I&amp;#39;m trying to communicate with a single NeoPixel ( WS2812B) using the PWM module. 
 I&amp;#39;ve configured a sequence array with the compare values necessary to turn on the red and the blue leds. 
 I would like to transmit this data without having to poll EVENTS_SEQEND</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Mar 2019 07:51:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44313/nrf52832-pwm-with-easydma-problem" /><item><title>RE: nrf52832 PWM with EasyDMA problem</title><link>https://devzone.nordicsemi.com/thread/174722?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 07:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d03d9288-ad85-4006-960c-800275045872</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Marc&lt;/p&gt;
&lt;p&gt;Should make for a more efficient implementation.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best of luck &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 PWM with EasyDMA problem</title><link>https://devzone.nordicsemi.com/thread/174557?ContentTypeID=1</link><pubDate>Wed, 06 Mar 2019 13:03:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e04bac75-5bb0-4da3-9089-8ca8f0bd1bf4</guid><dc:creator>Marc</dc:creator><description>&lt;p&gt;Good idea about using an interrupt to trigger the STOP task instead of the while loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 PWM with EasyDMA problem</title><link>https://devzone.nordicsemi.com/thread/174530?ContentTypeID=1</link><pubDate>Wed, 06 Mar 2019 12:09:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fe3efdb-aa0e-4e5b-a647-dc5e3683ee3b</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Marc&lt;/p&gt;
&lt;p&gt;It is good to hear you got the code working.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In general I would suggest&amp;nbsp;configuring the EVENTS_SEQEND event to generate an interrupt, but maybe this is your next step already ;)&lt;/p&gt;
&lt;p&gt;Thanks for the heads up regarding the product specification. I will report this to the tech writers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 PWM with EasyDMA problem</title><link>https://devzone.nordicsemi.com/thread/174325?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 15:00:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a6baf18-20a3-4b72-a7b7-a774e4f229d4</guid><dc:creator>Marc</dc:creator><description>&lt;p&gt;Thanks Torbjorn,&lt;/p&gt;
&lt;p&gt;I appreciate that you want to promote the use of your drivers, but I like to use the modules directly, as you say, so that I can understand them better.&lt;/p&gt;
&lt;p&gt;Since my original post I think I understand the issue much better. The main problem is the large amount of RAM required for communication with these chips. Each chip needs 24 (8 bits for each color) 16 bit integers for the wave pattern. 100 of these, for instance, would require 4800 bytes of RAM. Therefore it is imperative to free this space up immediately after the transmission is complete. That&amp;#39;s why looping on the SEQEND event is important. The following code works for me.&lt;/p&gt;
&lt;p class="p1"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define PIXPIN 7 //data pin for neopixel

void main()

{

  NRF_GPIO-&amp;gt;DIRSET = (1 &amp;lt;&amp;lt; PIXPIN); //set ref pin as output

  NRF_GPIO-&amp;gt;OUTCLR = (1 &amp;lt;&amp;lt; PIXPIN); //set ref pin low

  NRF_PWM1-&amp;gt;MODE = 0; //up counter

  NRF_PWM1-&amp;gt;PRESCALER = 0; //16MHz ticks

  NRF_PWM1-&amp;gt;COUNTERTOP = 20; //1.25 &amp;#181;sec pwm period

  NRF_PWM1-&amp;gt;LOOP = 0; //looping disabled

  NRF_PWM1-&amp;gt;DECODER = 0; //common, refresh count

  NRF_PWM1-&amp;gt;SEQ[0].REFRESH = 0;

  NRF_PWM1-&amp;gt;SEQ[0].ENDDELAY = 0;

  NRF_PWM1-&amp;gt;PSEL.OUT[0] = PIXPIN;

  NRF_PWM1-&amp;gt;ENABLE = 1;

  uint16_t neoPixelWavFrm[24] = {6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 13 | 0x8000, 6 | 0x8000,

6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 13 | 0x8000, 6 | 0x8000,

6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 6 | 0x8000, 13 | 0x8000, 6 | 0x8000,};

  NRF_PWM1-&amp;gt;SEQ[0].PTR = (uint32_t)(neoPixelWavFrm);

  NRF_PWM1-&amp;gt;SEQ[0].CNT = 24; //one uint16_t for each of the 24 bits per pixel

  NRF_PWM1-&amp;gt;SEQ[0].REFRESH = 0;

  NRF_PWM1-&amp;gt;SEQ[0].ENDDELAY = 0;

  NRF_PWM1-&amp;gt;EVENTS_SEQEND[0] = 0;

  NRF_PWM1-&amp;gt;TASKS_SEQSTART[0] = 1;

  while(1) //non-blocking while loop

  {

    if(NRF_PWM1-&amp;gt;EVENTS_SEQEND[0]) break;

    __asm__(&amp;quot;nop\n\t&amp;quot;);

  }
  NRF_PWM1-&amp;gt;TASKS_STOP = 1;  //drives PIXPIN low as determined by NRF_GPIO-&amp;gt;OUTCLR = (1 &amp;lt;&amp;lt; PIXPIN) to latch data for 50&amp;#181;s
  while(1);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;I&amp;#39;ve successfully tried it with 60 LEDs and it should work with any number. In my implementation I put the first half of the code in an initialization function and the second half in a transmission call that first constructs the waveform from an array of LED colors that is passed to it. At the conclusion of the transmission of the sequence as marked by SEQEND a STOP task is sent. Aside from keeping the module from sending the sequence again, it also drives the data pin low which is necessary for latching. &amp;nbsp;In my experience the required 50&amp;micro;s latching time is always accomplished between transmission calls.&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;By the way, there&amp;rsquo;s an error in the definition of the RAM defined register on page 498 of nRF52832_PS_v1.4. Bit 15 should be 0 for FallingEdge and 1 for RisingEdge. This would make it consistent with Fig 142 on page 496.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 PWM with EasyDMA problem</title><link>https://devzone.nordicsemi.com/thread/174145?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 07:33:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1404d4f-16ad-4e7b-852f-15fc7655955f</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Marc&lt;/p&gt;
&lt;p&gt;I would strongly suggest using the nrfx_pwm driver provided with the SDK, rather than using the module directly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One of the unofficial examples on our Github account actually has a WS2812B implementation already, using the&amp;nbsp;nrfx_pwm driver:&lt;br /&gt;&lt;a href="https://github.com/NordicPlayground/nrf52-ble-multi-link-multi-role/tree/master/common/drv_ws2812"&gt;https://github.com/NordicPlayground/nrf52-ble-multi-link-multi-role/tree/master/common/drv_ws2812&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I would suggest having a look at it, and see if you can&amp;#39;t just reuse this code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>