<?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>Problem with PWM and Timer simultaneous with WS2812B leds</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29940/problem-with-pwm-and-timer-simultaneous-with-ws2812b-leds</link><description>I&amp;#39;m using nRF52832 SDK board with softdevice s132_nrf52_5.0.0 and SDK 14.2.
The program compile without an error. I tested the led and timer separately and these work. 
 When the timer throws the timeout_handler and try to send pwm to set ws2812b leds</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 Jan 2018 14:09:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29940/problem-with-pwm-and-timer-simultaneous-with-ws2812b-leds" /><item><title>RE: Problem with PWM and Timer simultaneous with WS2812B leds</title><link>https://devzone.nordicsemi.com/thread/119085?ContentTypeID=1</link><pubDate>Tue, 30 Jan 2018 14:09:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf510b28-45c0-4739-b349-bfe0910e949e</guid><dc:creator>dhinojosac</dc:creator><description>&lt;p&gt;Thanks Sigurd,
My mystake was that I had wrongly initialized (I had not added it) the module nrf_drv_WS2812_init(pin) in which pwm was initialized.
There was no error in compile.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void nrf_drv_WS2812_init(uint8_t pin)
{

nrf_gpio_cfg_output(pin);
nrf_gpio_pin_clear(pin);

uint32_t err_code;
nrf_drv_pwm_config_t const config0 =
{
    .output_pins =
    {
        pin, // channel 0
        NRF_DRV_PWM_PIN_NOT_USED, // channel 1
        NRF_DRV_PWM_PIN_NOT_USED, // channel 2
        NRF_DRV_PWM_PIN_NOT_USED  // channel 3
    },
    .irq_priority = APP_IRQ_PRIORITY_LOW,
    .base_clock   = NRF_PWM_CLK_16MHz,
    .count_mode   = NRF_PWM_MODE_UP,
    .top_value    = PERIOD_TICKS,
    .load_mode    = NRF_PWM_LOAD_COMMON,
    .step_mode    = NRF_PWM_STEP_AUTO
};

err_code = nrf_drv_pwm_init(&amp;amp;m_pwm0, &amp;amp;config0, NULL);  // handler is NULL
APP_ERROR_CHECK(err_code);

for(int i = 0; i &amp;lt; NRF_PWM_VALUES_LENGTH(m_seq_values); i++)
{
    m_seq_values[i] = ONE_HIGH_TICKS;
}
	
for(int i = 0; i &amp;lt; RESET_ZEROS_AT_START; i++)
{
m_seq_values[i] = 0x8000;
}

m_seq_values[NR_OF_PIXELS * 24 + RESET_ZEROS_AT_START] = 0x8000;

nrf_drv_pwm_simple_playback(&amp;amp;m_pwm0, &amp;amp;m_seq, 1, 0);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with PWM and Timer simultaneous with WS2812B leds</title><link>https://devzone.nordicsemi.com/thread/119084?ContentTypeID=1</link><pubDate>Mon, 29 Jan 2018 10:03:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4106dab2-a556-4e79-8c6f-2a106f3c95ab</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you convert &lt;code&gt;3735928559&lt;/code&gt; to hex value, you get the code &lt;code&gt;DEADBEEF&lt;/code&gt;. This is typically a assert from the SoftDevice. This could happen if you are using e.g a &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/sd_resource_reqs/hw_block_interrupt_vector.html?cp=2_3_1_0_6_0"&gt;peripheral with restricted access&lt;/a&gt;(The SoftDevice need e.g. TIMER0), or if you are calling a SoftDevice function from a high interrupt priority.&lt;/p&gt;
&lt;p&gt;Could you post the code for the nrf_drv_WS2812_show() function?  If we look at line 286 in nrf_drv_pwm.c,  we have this line:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ASSERT(p_cb-&amp;gt;state != NRF_DRV_STATE_UNINITIALIZED);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This means that you are trying to start a nrf_drv_pwm_simple_playback(), but you have not initialized the driver with nrf_drv_pwm_init().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>