<?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>Real time control loop with  softdevice S140 and nrf52840.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68830/real-time-control-loop-with-softdevice-s140-and-nrf52840</link><description>Hello List, 
 I have a use case where i need to control 2 DC-motors using a PID-controller. The system is to be controlled via BLE, using a nrf52840 with softdevice S140. As a starting point I used the ble_app_uart example, where instead of the UART I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 29 Nov 2020 09:49:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68830/real-time-control-loop-with-softdevice-s140-and-nrf52840" /><item><title>RE: Real time control loop with  softdevice S140 and nrf52840.</title><link>https://devzone.nordicsemi.com/thread/282352?ContentTypeID=1</link><pubDate>Sun, 29 Nov 2020 09:49:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38498836-44eb-41c4-a797-80265e2492c8</guid><dc:creator>Sietse</dc:creator><description>&lt;p&gt;Upon closer examination there were a few deviations from 328 that more or less corresponding to the BLE communication, but not more than 3, so about 0.1ms. I now assume that is perfectly possible to get a control loop of up to 1000Hz under these circumstances. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Real time control loop with  softdevice S140 and nrf52840.</title><link>https://devzone.nordicsemi.com/thread/282349?ContentTypeID=1</link><pubDate>Sat, 28 Nov 2020 22:00:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01986961-77f4-40d5-937d-0f00d431956f</guid><dc:creator>Sietse</dc:creator><description>&lt;p&gt;Thanks for the response.&lt;/p&gt;
&lt;p&gt;I added a timer to the app using app_timer_create and made it run each 10ms.&lt;/p&gt;
&lt;p&gt;I logged NRF_RTC0-&amp;gt;COUNTER in an array for 20 seconds and printed it afterwards.&lt;/p&gt;
&lt;p&gt;The counter values change 328 each and every time, even when I send some data over BLE. I couldn&amp;#39;t measure any jitter with this timer, or at least less than 0.1ms. It seems to work perfectly, although I still can&amp;#39;t believe that it works this perfectly.&amp;nbsp; So it seems entirely feasible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Real time control loop with  softdevice S140 and nrf52840.</title><link>https://devzone.nordicsemi.com/thread/282230?ContentTypeID=1</link><pubDate>Fri, 27 Nov 2020 10:17:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9da48101-b07c-4bca-bc7f-e0f22fc3e0cb</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Details on the SD &lt;span&gt;&lt;a title="Interrupt model and processor availability" href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/processor_avail_interrupt_latency/processor_avail_interrupt_latency.html?cp=4_7_4_0_15"&gt;Interrupt model and processor availability.&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you run the SD and the pid needs the cpu you will have conflicts if they are both active at the same time. I.e. in case the SD is advertising, scanning or in a connection.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you are not running the PID while the SD is active, you should not see any issues as you say. Just remember to run your motor control at highest priority.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you want the PID to have priority over the SD this is also possible by redefining the interrupt priorities. However this could lead to timing issues in the SD and possibly make it assert.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>