<?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>51822 PWM unstable</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27779/51822-pwm-unstable</link><description>Hi guys， 
 I use the 51822&amp;#39;s PWM recently, PWM is made by GPIOTE+PPI+TIMER, and the PWM source code as below(I use TIMER1, GPIOTE[0], PPI_CH[0], PPI_CH[1]， period and duty means ticks with 16MHz): 
 void startPwm1(uint16_t period, uint16_t duty)
{</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 05 Dec 2017 14:52:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27779/51822-pwm-unstable" /><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109582?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 14:52:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0083de4-957f-4de6-9788-cf15d6beda40</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Or you can switch the code to route your pwm solution out P0.25, P0.24. Those don&amp;#39;t have anything connected.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109584?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 14:33:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac178172-8faa-488e-a43f-51be28597180</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;I think you should clarify if you are picking up the signal directly at MUC_PWM or off of Q1_E and Q4_E.
You need to remove or bypass all that junk in between. U4 and U5 have huge 2.2mH inductors and a diode output with a 1uF cap.  It looks like it was designed to be a boost DC/DC switcher converting Vbat to some higher voltage.&lt;/p&gt;
&lt;p&gt;If you are actually ahead (ie, on the base side ) of U4, U5 then not only should you remove the cap but also the series resistance that goes to the base of the transistor.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what type of project you have in mind, but this is a very poor module to use for it.  The module looks like it was designed for a specific application.  Normally the modules route the gpio out directly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109583?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 00:54:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88823c90-d3f6-4146-83c0-d64fe6e3145b</guid><dc:creator>Blue</dc:creator><description>&lt;p&gt;The PWM pin is P0.05 and P0.11.&lt;/p&gt;
&lt;p&gt;Thanks for your suggestion, I will remove the PWM pin&amp;#39;s capacitance and test it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109585?ContentTypeID=1</link><pubDate>Mon, 04 Dec 2017 17:26:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:854442d0-8bba-4a55-85a0-b7586819c2a3</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;You should always configure the external crystal if you intend to use it.  Some peripheral blocks/drivers will automatically configure it for you but many will run on the HF internal RC which would be a bad idea for pwm. According to the spec the timers run off the whatever the current HF CLK is.&lt;/p&gt;
&lt;p&gt;With regard to your board, there will ALWAYS be an external 16MHz crystal.  This is because it is required for bluetooth communications.  However you still have to configure it otherwise the chip will default to 16MHz RC clk.&lt;/p&gt;
&lt;p&gt;Your module has very few direct connections to gpio.  In this manner it is COMPLETELY different from the DK. You need to specify which pins you are using since what I see in the schematic is some very aggressive filtering of the gpio output for things labeled &amp;quot;pwm&amp;quot; and the other stuff is designed as &amp;quot;open collector&amp;quot;.  &amp;quot;open collector&amp;quot; is a rather odd and very outdated choice since BJT&amp;#39;s are pretty bad at switched signals when compared to fet&amp;#39;s.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109581?ContentTypeID=1</link><pubDate>Mon, 04 Dec 2017 02:15:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b54e2de1-4129-4678-8ec0-7b4b14a9c200</guid><dc:creator>Blue</dc:creator><description>&lt;p&gt;Hi, here is the sch pdf,  &lt;a href="https://github.com/bbssuiji/pdf/blob/master/sch.pdf"&gt;link text&lt;/a&gt;&lt;br /&gt;
I found that there is an external crystal.&lt;/p&gt;
&lt;p&gt;I did not configure HFCLK in the application code,  Is there any problem?&lt;/p&gt;
&lt;p&gt;The program is working fine on the  nrf51 DK board, but not working well on my own board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109580?ContentTypeID=1</link><pubDate>Sun, 03 Dec 2017 17:13:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8a80ae7-4827-4d1c-8e66-0115ddbb2cf8</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Per my question above you should read over page 32 of the nrf51822 spec:
4.2 Timer/counters (TIMER)
The timer/counter runs on the high-frequency clock source (HFCLK) and includes a 4 bit (1/2X) prescaler that
can divide the HFCLK.
The TIMER will start requesting the 1 MHz mode of the HFCLK for values of the prescaler that gives fTIMER less
or equal to 1 MHz. If the timer module is the only one requesting the HFCLK, the system will automatically
switch to using the 1 MHz mode resulting in a decrease in the current consumption. See the parameters
I1v2XO16,1M, I1v2XO32,1M, I1v2RC16,1M in Table 32 on page 47 and ITIMER0/1/2,1M in Table 52 on page 61.
The task/event and interrupt features make it possible to use the PPI system for timing and counting tasks
between any system peripheral including any GPIO of the device. The PPI system also enables the TIMER
task/event features to generate periodic output and PWM signals to any GPIO. The number of input/outputs
used at the same time is limited by the number of GPIOTE channels.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109579?ContentTypeID=1</link><pubDate>Sun, 03 Dec 2017 16:51:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:312e52be-b140-4a6d-80e0-c3cb3312ee92</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;There are different levels of power manage. The SD docs discuss these.  You can keep the ppi/gpiote running whilst do a power manage.&lt;/p&gt;
&lt;p&gt;Still need clarity on HFCLK.  Earlier you responded by discussing the LFCLK (ie, RTC).
The pclock is generated from the 16MHz clock.  You need to make sure it is running on the external crystal and not the internal 16MHz RC clock.&lt;/p&gt;
&lt;p&gt;If you feel like posting a pdf of your schematic that would be good too.  To make sure there are no mistakes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109578?ContentTypeID=1</link><pubDate>Sun, 03 Dec 2017 14:43:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f125d84-2e7e-453e-903b-45805337eeb3</guid><dc:creator>Blue</dc:creator><description>&lt;p&gt;Hi, AmbystomaLabs ,&lt;/p&gt;
&lt;p&gt;The reason is power_manager () function in while(1),  When pwm is working, I need to disable power_manager () function, then pwm works well.&lt;/p&gt;
&lt;p&gt;Now the pwm works well on nrf51 DK board,  and the time control is very accurate, such as I set the PWM period to 800 ticks(800/16M = 50us)，and set the PWM duty to 20 ticks(20 /16M = 1.25us), I find the PWM works well through the logic analyzer.&lt;/p&gt;
&lt;p&gt;But I encountered a new problem on our own board, the PWM duty can not be controlled, it is smaller than the value I set,  and the smaller value will be some changes, such as :&lt;br /&gt;
I set the PWM duty to 20 ticks(1.25us), In fact, there is no PWM output;&lt;br /&gt;
I set the PWM duty to 60 ticks(3.75us), In fact, I find the PWM duty is perhaps 1.5us or greater than 1.5us or less than 1.5us;&lt;/p&gt;
&lt;p&gt;Can you help me, What information do I need to provide? Such as PCB?.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109575?ContentTypeID=1</link><pubDate>Sun, 03 Dec 2017 02:11:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7aa0fe0-8ef6-42f2-9128-6552bd5826ba</guid><dc:creator>Blue</dc:creator><description>&lt;p&gt;3, The process is like this：&lt;/p&gt;
&lt;p&gt;power the board , download the program,  PWM work properly now.&lt;/p&gt;
&lt;p&gt;power off the board, use another 3.3V power supply touch any GPIO pin , and then disconnect.&lt;/p&gt;
&lt;p&gt;power the board , this time, PWM work is not normal.&lt;/p&gt;
&lt;p&gt;It seems that PWM is very sensitive to electrical interference.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109577?ContentTypeID=1</link><pubDate>Sun, 03 Dec 2017 02:03:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c15190a7-4020-45f2-b2e5-6bdc5787331a</guid><dc:creator>Blue</dc:creator><description>&lt;p&gt;2, I am using sdk 12.3/examples/ble_peripheral/ble_app_uart and using an SD,  and my application is not set on clock registers, The application starts, I configure the timer1 like this：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  NRF_TIMER1-&amp;gt;PRESCALER = 0;
NRF_TIMER1-&amp;gt;MODE = TIMER_MODE_MODE_Timer;
NRF_TIMER1-&amp;gt;BITMODE = TIMER_BITMODE_BITMODE_16Bit&amp;lt;&amp;lt;TIMER_BITMODE_BITMODE_Pos;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109576?ContentTypeID=1</link><pubDate>Sun, 03 Dec 2017 02:02:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b3168ec-2048-4f28-bf74-2b26636bcfb8</guid><dc:creator>Blue</dc:creator><description>&lt;p&gt;1,  My board does not have an external crystal, I use the internal crystal.&lt;/p&gt;
&lt;p&gt;static void ble_stack_init(void)
{
uint32_t err_code;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_clock_lf_cfg_t clock_lf_cfg = **NRF_CLOCK_LFCLKSRC**;

    // Initialize SoftDevice.
    SOFTDEVICE_HANDLER_INIT(&amp;amp;clock_lf_cfg, NULL);
    ......
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_RC,            \
                                 .rc_ctiv       = 16,                                \
                                 .rc_temp_ctiv  = 2,                                \
                                 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 51822 PWM unstable</title><link>https://devzone.nordicsemi.com/thread/109574?ContentTypeID=1</link><pubDate>Sat, 02 Dec 2017 17:09:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8b61993-2f7e-4a06-93e2-748470811689</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;It&amp;#39;s not clear from your code if you are requesting (ie, starting HFCLK_EXT). The nRF will always run from internal HFCLK which is not accurate, you have to request HFCLK EXT.&lt;/p&gt;
&lt;p&gt;If you are using an SD then you request it through an API command, otherwise you can just set up the clock registers and pclk source.&lt;/p&gt;
&lt;p&gt;Also, I assume your comment about powering through gpio port was just a typo, right?  You meant just applying vdd from external source.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>