<?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>Problem with software, need help</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/501/problem-with-software-need-help</link><description>Hi, 
 i have some troubles with my software which i doesn&amp;#39;t understand maybe some one with more microcontroller Experience cann tell me how to solve this Problem. 
 I have a method which waits for a Time, its like the nrf_delay but instead of this i</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Sep 2013 18:28:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/501/problem-with-software-need-help" /><item><title>RE: Problem with software, need help</title><link>https://devzone.nordicsemi.com/thread/2632?ContentTypeID=1</link><pubDate>Tue, 24 Sep 2013 18:28:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ef51128-d2fb-40e1-a4d7-00948415f548</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;Your question is quite vague, and sparse on details on the exact problem, so it&amp;#39;s not very easy to help you.&lt;/p&gt;
&lt;p&gt;However, in general, if you have trouble with methods behaving differently when called from interrupt context and main context, you should make sure that any global variables that you use from both are handled in a safe way. Depending on your application, you may have to use the critical_region_enter()/_exit() functionality of the softdevice, make sure that your variables are declared volatile or similar.&lt;/p&gt;
&lt;p&gt;Also, the code snippet you have shared seems very strange, and I&amp;#39;d strongly recommend you to reconsider your application structure.  Doing a spin loop like this waiting for a global variable isn&amp;#39;t any more power effective than a simple nrf_delay_ms() loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with software, need help</title><link>https://devzone.nordicsemi.com/thread/2631?ContentTypeID=1</link><pubDate>Tue, 24 Sep 2013 05:46:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e33bde7-04cd-4eaf-b2f9-1fdb412b282e</guid><dc:creator>Nils Minor</dc:creator><description>&lt;p&gt;No ideas what the problem could be or is ther to less information?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with software, need help</title><link>https://devzone.nordicsemi.com/thread/2630?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2013 11:23:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76fbb40b-2ac7-4003-81e7-8dfe13d742e2</guid><dc:creator>Nils Minor</dc:creator><description>&lt;p&gt;Do i have to use the Schceduler?&lt;/p&gt;
&lt;p&gt;I think it&amp;#39;s an cracy error becouse if i use my methods in the main loop they are working but if i use my methods in the timeout-handlers they don&amp;#39;t work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with software, need help</title><link>https://devzone.nordicsemi.com/thread/2629?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2013 08:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59dcd97b-cf9c-44d3-9c29-84543e32bc16</guid><dc:creator>Nils Minor</dc:creator><description>&lt;p&gt;And the problem is if i call this method in timeouthandler, the variable won&amp;#39;t be increment annymore, but in the main loop its oke.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with software, need help</title><link>https://devzone.nordicsemi.com/thread/2628?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2013 08:10:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a2af378-2e16-4e04-8fe6-c620a3b063ad</guid><dc:creator>Nils Minor</dc:creator><description>&lt;p&gt;Hi Martijn,
Thanks for your feedback.&lt;/p&gt;
&lt;p&gt;Yes you are right, my system off mode is just a reset of the device. After a reset it is waiting for an interruptb__WFI ( ). But i think thats not the problem.&lt;/p&gt;
&lt;p&gt;The Problem is that i can use some methods in the main loop but not in an Timeout methods, and i can&amp;#39;t understand why.&lt;/p&gt;
&lt;p&gt;One method is wait_ms (TimeToWait). The Timervariable_to_wait  variable will be increment every millisecond.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;

void wait_ms (uint16_t TimetoWait)
{	
	uartStr(&amp;quot;\nStarte Warte-Timer&amp;quot;);
	Timervariable_to_wait=0;
	while (Timervariable_to_wait != TimetoWait)
	{
			
			//uartDig(Timervariable_to_wait);
			
			//Warte hier für die Zeit TimetoWait
	}		
}

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;if i call this method in the main and it works but if i call this in in timeout_handle it doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;And its also if i call a method which i use for PWM (i use Timer 2)&lt;/p&gt;
&lt;p&gt;Is it possible that a method which need a Timer can not be called in a TimerTimeouthandler? But this would be very bad for me.&lt;/p&gt;
&lt;p&gt;Best regards Nils&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem with software, need help</title><link>https://devzone.nordicsemi.com/thread/2627?ContentTypeID=1</link><pubDate>Sun, 22 Sep 2013 09:07:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46b0e3cd-78cc-463b-9beb-050a0ff1205a</guid><dc:creator>Martijn</dc:creator><description>&lt;p&gt;Please provide Some more code.
And if you put the device in system off it will stop running. It can only wake from external interrupt or a reset.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>