<?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>UART and FreeRTOS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42924/uart-and-freertos</link><description>I have used the UART example up and got it working. So i can send and receive data using it. 
 However i wanted to modify it so as to run with the current RTOS environment. So i generated a task: 
 
 In the task section if i invoke a tb_uart_send_event</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Jan 2019 09:18:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42924/uart-and-freertos" /><item><title>RE: UART and FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/168167?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 09:18:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00d882ee-1105-4625-a18b-8fc562ef6c2a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi dmleone,&lt;/p&gt;
&lt;p&gt;I think first you should hold on your code and try to understand its internals. I think what you are facing is the problem understanding the code structure and since you are new to FreeRTOS, you have problems understanding the statemachine of your application.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="dmleone"]Also they used&amp;nbsp;SCB-&amp;gt;SCR |= SCB_SCR_SLEEPDEEP_Msk, however i am having difficulty finding exactly what that is doing or how it works[/quote]
&lt;p&gt;&amp;nbsp;This is ARM Cortex M4 system control block feature of deep sleep.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-90e6790095124085acfc611bbe78846c/pastedimage1548666757535v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="dmleone"]Is there a better way to handle a sleep mode where i can wake it up with the UART?&amp;nbsp;[/quote]
&lt;p&gt;If the choice of your system was to make the nRF chip to go to systemoff (not the same as ARM cortext sleep mode), then you need a mechanism to wake it up and waking from GPIO pins sounds reasonable. But if you do not want to go to deepsleep (System off) then using WFE will wake the system on any internal events.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would not be able to suggest you which mode to use, as it entirely depends on your product requirements.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="dmleone"]Is there a way other than&amp;nbsp;using an input with&amp;nbsp;nrf_gpio_cfg_sense_input() to wake up the system? The system is able to receive a BLE incoming message during this sleep mode and before putting it to sleep they call sd_ble_gap_disconnect(). I am assuming in the code somewhere they have to wake or do something to be able to reconnect with the device&amp;nbsp;before the device sends a message, otherwise it would never get the message. I am looking for this wakeup on BLE action[/quote]
&lt;p&gt;&amp;nbsp;When the system wakes up from systemoff (deep sleep) there will be a system reset and if your application is not checking for the reset reason, then the statemachine would always have the same path on the wakeup. This means that your device will again try to attempt to connect as it did before going to sleep.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART and FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/168032?ContentTypeID=1</link><pubDate>Fri, 25 Jan 2019 20:12:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:088ad8ca-207a-4577-be82-25374bd4fec3</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;Just to give a heads up it may seem like i do not know what is happening because i am working on someone elses code and there is no reference and i have never used freeRTOS or nRF52 before. So if there is something that you may think is trivial it may not be for me. I can upload files to you. but prefer a more direct method or secure method than posting all over the internet&lt;/p&gt;
&lt;p&gt;I stripped my program down to the bare bones UART only task and got it working. I put all the same code back in and it still worked. so i am kinda of ok but i got another issue&lt;/p&gt;
&lt;p&gt;After 1 minute, the system no longer responds. I saw another post that exhibited same issue was wondering if you knew why this was happening for him and may lead me to know why it is happening to me&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38052/all-the-threads-stop-after-running-for-a-while"&gt;Older Post no resolution&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;if I do the only UART task it seems to last longer than 1 minute. but with the BLE enabled it dies after 1 minute. I am trying to search through all the code to determine if there is some BLE timeout since that is what i gather from the older post i linked to.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also they used&amp;nbsp;SCB-&amp;gt;SCR |= SCB_SCR_SLEEPDEEP_Msk, however i am having difficulty finding exactly what that is doing or how it works&lt;/p&gt;
&lt;p&gt;Edit: Reviewed the code and it appears i may have same issue as older post. The system boots up and after allotted time, 1 minute, it calls sd_power_system_off(). This causes whole system to go into a stop mode until we hit a button to wake it up.&lt;/p&gt;
&lt;p&gt;Is there a better way to handle a sleep mode where i can wake it up with the UART?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is there a way other than&amp;nbsp;using an input with&amp;nbsp;nrf_gpio_cfg_sense_input() to wake up the system? The system is able to receive a BLE incoming message during this sleep mode and before putting it to sleep they call sd_ble_gap_disconnect(). I am assuming in the code somewhere they have to wake or do something to be able to reconnect with the device&amp;nbsp;before the device sends a message, otherwise it would never get the message. I am looking for this wakeup on BLE action&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART and FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/167835?ContentTypeID=1</link><pubDate>Fri, 25 Jan 2019 09:12:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b93fae86-fa1a-4be8-ad0f-edb45221d19e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I believe that something is not correctly configured with your uart. If you configured to use FIFO then you will get AA_UART_DATA and not APP_UART_DATA_READY. The driver itself is working in interrupt driven mode, so that should be OK, any data received should have called&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uart_evt_callback-&amp;gt;&amp;nbsp;tb_uart_send_event(you need to put this all in APP_UART_DATA case and not in APP_UART_DATA_READY if you use fifo) -&amp;gt;xQueueSendToBack-&amp;gt;&amp;nbsp;handle_uart_evt&lt;/p&gt;
&lt;p&gt;I do not see any other complications in this path&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART and FreeRTOS</title><link>https://devzone.nordicsemi.com/thread/167833?ContentTypeID=1</link><pubDate>Fri, 25 Jan 2019 09:04:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12fc72b0-0ff5-4cc4-a5a2-b8b2f2a64b03</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am pretty sure that there is not much differences in the way you handle tasks in our port. It must be something with the tasks. Can you give me a compilable file/project to test this out on my end?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I see no obvious issues in your code, and even tried to compile falling into the loop of fixing compilation error. It would be easy to give me a file to test and not spend too much time fixing compiler errors.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>