<?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>Send AT commands on button press on nRF9160dk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/54283/send-at-commands-on-button-press-on-nrf9160dk</link><description>Hello, 
 I have to send hardcoded AT commands on button press on nRF9160dk. So for that, first I did program for button press. It is working fine. Then I did simple_at program, which is also working fine. So now I have merged these 2 programs. But it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Nov 2019 12:29:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/54283/send-at-commands-on-button-press-on-nrf9160dk" /><item><title>RE: Send AT commands on button press on nRF9160dk</title><link>https://devzone.nordicsemi.com/thread/219655?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2019 12:29:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:916a4f7e-b507-4547-9a87-dd37b0d9bb76</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for the reply. I will try what you have suggested.&lt;/p&gt;
&lt;p&gt;Yes I realized that app_socket_start() is called twice as ISR is called on both press and release. I observed that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send AT commands on button press on nRF9160dk</title><link>https://devzone.nordicsemi.com/thread/219638?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2019 11:41:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71ee9eef-b7cc-4de0-bdf2-351fc5a558ba</guid><dc:creator>MJD093</dc:creator><description>&lt;p&gt;Try this instead, remove the app_socket_start() function from your callback. This shouldn&amp;#39;t be here as an ISR should be returned from as quickly as possible. From my experience with ISRs in Zephyr, trying to run a function from the ISR will hang.&lt;/p&gt;
&lt;p&gt;Place a boolean flag in the ISR for button_pressed = true, place a while loop in your main function that can run a k_sleep() delay (reduce idle current by yielding main thread via sleep). In the while loop place a function that can react to the boolean button_pressed. Something like app_socket_start(button_pressed), where inside app_socket_start() is a boolean if-true check. Remember to clear the ISR flag when completing app_socket_start().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Side note:&lt;/p&gt;
&lt;p&gt;You do realise you are calling app_socket_start() twice right? I helped you set up that ISR last week but you have continued to use it in rising and falling edge operation. That will call the ISR when you press and release the button, running the code for app_socket_start() and the LED with each press and de-press.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>