<?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>Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14677/dependence-between-connection-interval-parameter-and-qdec</link><description>Hi, 
 I have question related with some parameters of BLE transmision. 
 Connection interval in my project is set to 10 ms. Peripheral sends a notifications whenever the value of characteristic is changing - this interval is also set to 10 ms.
So,</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Jul 2016 14:05:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14677/dependence-between-connection-interval-parameter-and-qdec" /><item><title>RE: Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/thread/56026?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2016 14:05:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c26a42b5-1553-4b21-845d-011173208c87</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Sorry for the bad response, I&amp;#39;ve been on vacation for the last two weeks. The example is kind of weird as it both produce the encoder output and then decodes it with the qdec. It may not be the best example to use for a real encoder, and I will see if we can improve this example. The way you use the encoder depends on your application. Instead of getting interrupt on every sample you may want to read the state of the of the accumulators with &lt;code&gt;nrf_drv_qdec_accumulators_read(int16_t * p_acc, int16_t * p_accdbl)&lt;/code&gt; when you need to know how many transisitions have been made since last read, or you may want to set up  the &lt;code&gt;reportper&lt;/code&gt; to know when a certain number of transitions have been made. I suggest that you read the QDEC chapter in the &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.pdf"&gt;Reference Manual&lt;/a&gt; to get a better understanding of how the decoder works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/thread/56025?ContentTypeID=1</link><pubDate>Mon, 04 Jul 2016 14:17:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df926baf-bb31-4dcb-bc63-bffb44cdc198</guid><dc:creator>octopus</dc:creator><description>&lt;p&gt;UP!&lt;/p&gt;
&lt;p&gt;Ole, are you able to help me?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/thread/56024?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2016 12:18:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08132ffc-1125-46f5-a467-8d2292447493</guid><dc:creator>octopus</dc:creator><description>&lt;p&gt;From infocenter:&lt;/p&gt;
&lt;p&gt;&amp;quot;If the SAMPLEPER value needs to be changed, the QDEC shall be stopped using the STOP task. SAMPLEPER can be then changed upon receiving the STOPPED event, and QDEC can be restarted using the START task. Failing to do so may result in unpredictable behaviour.&amp;quot;&lt;/p&gt;
&lt;p&gt;So, where in my code should I enable and disable qdec to read measurements properly, but not allow a SoftDevice interrupt LED output?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/thread/56023?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2016 11:42:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdf478b0-1b4b-4ef8-8a3f-7c39b2b7904a</guid><dc:creator>octopus</dc:creator><description>&lt;p&gt;How should this look like according to you?
If I enable qdec only once in main and do not disable it in my code - I get then a strange measurements. The encoder linked to motor which I use generates 100 counts per turn, so there should occur 400 state changes - accumulated ACC value should be 400 per one turn. Before then, I got it corretly, but now the value is around 185.&lt;/p&gt;
&lt;p&gt;What about a m_report_ready_flag? Should I set it in qdec handler or not? In while loop (in main) I wait for a report this way:&lt;/p&gt;
&lt;p&gt;while (! m_report_ready_flag)
{
__WFE();
}&lt;/p&gt;
&lt;p&gt;How should look like a qdec handler function for my purpose?
Thank you for your answers and please, help me with this. There is a little bit information how it works, even in infocenter.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/thread/56022?ContentTypeID=1</link><pubDate>Wed, 22 Jun 2016 16:28:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42acdd75-3b8d-4523-9c05-a357d00b6197</guid><dc:creator>octopus</dc:creator><description>&lt;p&gt;Indeed, I enable qdec in infinite for loop in main - I followed a qdec example code.
So, I shouldn&amp;#39;t disable it by SAMPLERDY event in qdec handler and enable it once in main function?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/thread/56021?ContentTypeID=1</link><pubDate>Wed, 22 Jun 2016 16:09:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35fd749e-c2f8-419c-99b2-17f28063dd06</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;So you are disabling the qdec in the interrupt, why? I guess you are enabling it somewhere else in the code or else the LED output would be constantly low. If you enable in the while loop in main you will get the LED output on your traces because the SoftDevice may interrupt the code between disable and enable functions. It should not be necessary to disable and enable the qdec like you do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/thread/56020?ContentTypeID=1</link><pubDate>Wed, 22 Jun 2016 15:47:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a482ad7c-371f-4a6c-af66-78994595a7d5</guid><dc:creator>octopus</dc:creator><description>&lt;p&gt;Thanks for your response. My qdec_event_handler function is simple and looks like that:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void qdec_event_handler(nrf_drv_qdec_event_t event)

 { 

 if (event.type == NRF_QDEC_EVENT_SAMPLERDY)

 { 

m_report_ready_flag = true;

nrf_drv_qdec_disable();

 }
 
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I update a value of characteristic in timer handler which is calling every 10 ms. There I use a nrf_drv_qdec_accumulators_read() method and write these values to correct variable.
QDEC configuration looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;define QDEC_CONFIG_REPORTPER NRF_QDEC_REPORTPER_DISABLED

define QDEC_CONFIG_SAMPLEPER NRF_QDEC_SAMPLEPER_2048us

define QDEC_CONFIG_PIO_A 1

define QDEC_CONFIG_PIO_B 2

define QDEC_CONFIG_PIO_LED 3

define QDEC_CONFIG_LEDPRE 10

define QDEC_CONFIG_LEDPOL NRF_QDEC_LEPOL_ACTIVE_LOW

define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW

define QDEC_CONFIG_DBFEN false

define QDEC_CONFIG_SAMPLE_INTEN true
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dependence between connection interval parameter and QDEC</title><link>https://devzone.nordicsemi.com/thread/56019?ContentTypeID=1</link><pubDate>Wed, 22 Jun 2016 15:35:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e044b93-a652-4941-a318-23c667fd6459</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Looks definitely like the SoftDevice is interrupting the LED output, even though this is strange. Can you post the code you use for the setup of QDEC?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>