<?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 executing TWI function from app_timer handler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29345/nrf52832-executing-twi-function-from-app_timer-handler</link><description>Hello, 
 When i execute a function that uses TWI from a timer handler the NRF gets stuck.
I assumed that this issue occurs because of interrupt priority so i gave the TWI a higher priority then the priority of APP_TIMER, but it didn&amp;#39;t help. 
 What</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Jan 2018 12:57:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29345/nrf52832-executing-twi-function-from-app_timer-handler" /><item><title>RE: nrf52832 executing TWI function from app_timer handler</title><link>https://devzone.nordicsemi.com/thread/116744?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 12:57:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0fd5dc9-a2dc-4f2b-8065-24f174e7cf8a</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Thank you for your explanation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 executing TWI function from app_timer handler</title><link>https://devzone.nordicsemi.com/thread/116743?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 10:20:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37ed445b-cd75-4d6b-a272-f1db5088fbfb</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;NRF_LOG_FLUSH() is a &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/nrf_log.html?cp=4_0_0_3_25_2_0#nrf_log_usage_control"&gt;blocking function&lt;/a&gt; and if you are using UART as backend this is using interrupts while printing messages. Hence, you are triggering interrupts from within an interrupt context and this might cause priority issues. If you are using RTT as backend it will not use interrupts the same way, but since NRF_LOG_FLUSH() is blocking and since it takes a significant amount of time to format a string you should never flush in an interrupt context. NRF_LOG_FLUSH() is intended to be used only in main context.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 executing TWI function from app_timer handler</title><link>https://devzone.nordicsemi.com/thread/116742?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 07:54:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e04de77-9ffb-4d45-96a4-aa51bb1e82a7</guid><dc:creator>David</dc:creator><description>&lt;p&gt;I found out what was the issue.
It was a call to NRF_LOG_FLUSH() inside one of the function in the interrupt handler.
Why the LOG FLUSH causing that ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 executing TWI function from app_timer handler</title><link>https://devzone.nordicsemi.com/thread/116741?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 07:21:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51c2367e-447d-45d4-8a60-89e215501d1b</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Thanks for your answer.
I2C works out of the interrupt handler.
Currently i would like to solve my issue and not try other i2c drivers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 executing TWI function from app_timer handler</title><link>https://devzone.nordicsemi.com/thread/116740?ContentTypeID=1</link><pubDate>Wed, 10 Jan 2018 23:26:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d72bfa8-be9b-4663-bbbe-ccfca13d9a3b</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;Does the I2C works outside of interrupt ?  Make sure the I2C works first then use it in timer interrupt.&lt;/p&gt;
&lt;p&gt;You can also try the &lt;a href="https://github.com/I-SYST/EHAL"&gt;I2C driver from EHAL&lt;/a&gt;. It&amp;#39;s a lot simpler and can be used in interrupt. There is an use case example from this blog &lt;a href="https://devzone.nordicsemi.com/blogs/1223/writing-ble-firmware-with-a-few-lines-of-code-part/"&gt;https://devzone.nordicsemi.com/blogs/1223/writing-ble-firmware-with-a-few-lines-of-code-part/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 executing TWI function from app_timer handler</title><link>https://devzone.nordicsemi.com/thread/116738?ContentTypeID=1</link><pubDate>Wed, 10 Jan 2018 18:47:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e66cd3fc-3532-44fe-b820-e432f7cd3f48</guid><dc:creator>David</dc:creator><description>&lt;p&gt;yes , i do know.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 executing TWI function from app_timer handler</title><link>https://devzone.nordicsemi.com/thread/116739?ContentTypeID=1</link><pubDate>Wed, 10 Jan 2018 18:21:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb427671-5f23-4893-ae34-67c4e845d96d</guid><dc:creator>Julie H</dc:creator><description>&lt;p&gt;Just to get this out of the way, you do know that &amp;quot;bigger number&amp;quot; means &amp;quot;lower priority&amp;quot;, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>