<?xml-stylesheet type="text/xsl" href="https://community.element14.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/"><channel><title>PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><description>The steps to integrate incoming UART data with FreeRTOS on a PSoC 6.The focus is on saving processor power. The design does not poll for incoming data.It yields all powers to the RTOS scheduler (possibly going to low power mode) until a trigger fires</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Wed, 15 Sep 2021 03:58:48 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>skruglewicz</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;hello &lt;span&gt;[mention:acaf6a9338de4eef8f6717d5561ed01d:e9ed411860ed4f2ba0265705b8793d05]&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I am trying to follow your blog to implement your example. It seems like the Link you refer to at the beginning of the blog is broken?&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;quot;I follow the &lt;/span&gt;&lt;a class="" href="https://cypresssemiconductorco.github.io/psoc6pdl/pdl_api_reference_manual/html/group__group__scb__uart.html"&gt;PSoC 6 documentation&lt;/a&gt;&lt;span&gt; for Serial Communication Block configuration&amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Can you direct me to the documentation you are referring to?&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;I&amp;#39;m using the PSOC 6&amp;nbsp; EVK: CY8Ckit-062S2-43012 . I&amp;#39;ve been able to follow some of your other blogs in your PSoC6 Series. I&amp;#39;m planning on a design that uses the Arduino Nano to connect to a UART on the PSoC 6.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Steve K&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Wed, 23 Jun 2021 08:43:50 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>brandiware</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hello Jan,&lt;/p&gt;&lt;p&gt;I found the problem source: the UART and the pins when configured by the Device Configurator actually reserve the pins.&lt;/p&gt;&lt;p&gt;This is why the second reservation, which is tried when cyhal_uart_init is called, fails.&lt;/p&gt;&lt;p&gt;If I don&amp;#39;t configure the UART and the pins in the Configurator but with the CYHAL calls then the cyhal_uart_init&lt;/p&gt;&lt;p&gt;call works fine. Strange - there must be a way to use the configuration from the configurator and get straigt to the&lt;/p&gt;&lt;p&gt;uart object without calling cyhal_uart_init. Any idea ? I need to configure the MSB_first for this UART, as the external RS232 device&lt;/p&gt;&lt;p&gt;requires that.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks much for your assistance so far !&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers&lt;/p&gt;&lt;p&gt;Stefan&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Tue, 22 Jun 2021 14:46:27 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>brandiware</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I did. P8_0 and P8_1 are available for UART 4. I debugged some, in the port_map I find P8_1 but not P8_0 that is strange.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Tue, 22 Jun 2021 14:11:15 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>brandiware</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hi Jan,&lt;/p&gt;&lt;p&gt;now I did just that. It does not recognize the pins now...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I get a CYHAL_UART_RSLT_ERR_INVALID_PIN error result from calling &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* Initialize the UART Block */&lt;/p&gt;&lt;p&gt;&amp;nbsp; rslt = cyhal_uart_init(&amp;amp;uart_obj, CYBSP_UART1_TX, CYBSP_UART1_RX, CYPSP_UART1_CLK_HW, &amp;amp;uart_config);&lt;/p&gt;&lt;p&gt;&amp;nbsp; if(rslt != CY_RSLT_SUCCESS)&lt;/p&gt;&lt;p&gt;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handle_error();&lt;/p&gt;&lt;p&gt;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The pins are named just like this in the Device Configurator. Seems like I am having trouble allocating the resources correctly.&lt;/p&gt;&lt;p&gt;Or there is some well hidden syntax when naming pins or clocks.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Tue, 22 Jun 2021 10:35:11 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>brandiware</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Jan, I checked some things. The error I am getting does not appear unless I debug into the ISR. The Transmit actually runs through but then the Receive hangs.&lt;/p&gt;&lt;p&gt;Debugging into it indicates that a receive is actually in operation - this is probably the Receive in your task example.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;so once I did the Transmit, how do I block the transmitting task and wait for the receive - using the xTaskToNotify flag ?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;&lt;p&gt;Stefan&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Tue, 22 Jun 2021 09:54:00 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>brandiware</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;Hi Jan,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I extern the variable outside of main where it is defined:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;extern cy_stc_scb_uart_context_t uartContext;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It did not appear to be empty. What I see now is that I did not set the xTaskToNotify flag anywhere outside of your code example functions.&lt;/p&gt;&lt;p&gt;I have to check how you did that in your full sample project. Also, I disregarded the size of the rxBuffer until now. This should probably match&lt;/p&gt;&lt;p&gt;the number of bytes of the expected answer.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;To cut short on complexity couldn&amp;#39;t I just call&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tx_status = Cy_SCB_UART_Transmit(scb_4_HW, txBuffer, sizeof(txBuffer), &amp;amp;uartContext);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (tx_status != CY_SCB_UART_SUCCESS) {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handle_error();&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Blocking wait for transmission completion */&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (0UL != (CY_SCB_UART_TRANSMIT_ACTIVE &amp;amp; Cy_SCB_UART_GetTransmitStatus(scb_4_HW, &amp;amp;uartContext)))&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (void) Cy_SCB_UART_Receive(scb_4_HW, rxBuffer, sizeof(rxBuffer), &amp;amp;uartContext);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (0UL != (CY_SCB_UART_RECEIVE_ACTIVE &amp;amp; Cy_SCB_UART_GetReceiveStatus(scb_4_HW, &amp;amp;uartContext))) {}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;after the InitUART() from within any task that has the uartContext ? I thought it should then write and read fine. By the way, it seems that the ISR must be set up and initialized regardless.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;And I did step into&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Cy_SCB_UART_Interrupt(scb_4_HW, &amp;amp;uartContext)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;but the debugger said it didn&amp;#39;t find any symbols there. Guess I have to recompile some of the shared files or something&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;I will check that again.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Thank you very much Jan.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Cheers&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Stefan&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Tue, 22 Jun 2021 05:26:20 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>brandiware</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hello Jan,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;thanks for your swift answer. I think it is not an issue with your task coordination logic. &lt;/p&gt;&lt;p&gt;I rather have difficulties addressing the UART which I configured using the Device Configurator&lt;/p&gt;&lt;p&gt;on SCB4. Seems like I do not register the interrupt correctly as the MCU throws a &amp;quot;cannot address memory&amp;quot; error when&lt;/p&gt;&lt;p&gt;&lt;span&gt;Cy_SCB_UART_Interrupt(scb_4_HW, &amp;amp;uartContext); is called.&lt;/span&gt; &lt;/p&gt;&lt;p&gt;I have not found any working example that uses an UART configured with the Device Configurator. Any idea on how to&lt;/p&gt;&lt;p&gt;correctly address this resource ? Could be that scb_4_HW, which is generated by the Configurator, is not the correct&lt;/p&gt;&lt;p&gt;address to reach the configured UART ?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks and best regards&lt;/p&gt;&lt;p&gt;Stefan&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Sat, 19 Jun 2021 14:36:48 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>brandiware</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hello Jan,&lt;/p&gt;&lt;p&gt;I am trying to implement your logic in my code. However, it fails with the set / unset of the xTaskToNotify. It reaches the ISR with xTaskToNotify = NULL.&lt;/p&gt;&lt;p&gt;I have defined it as a global in my UART.c (see below). The init function I defined in the main and call it from there just as recommended.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In the debugger I get an error just when the code hits the ISR: &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Error: Failed to read memory at 0xa5a5a5a6&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The whole sequence of reading the UART should be kicked off by this code which is executed in a separate task:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tx_status = Cy_SCB_UART_Transmit(scb_4_HW, txBuffer, sizeof(txBuffer), &amp;amp;uartContext);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (tx_status != CY_SCB_UART_SUCCESS) {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handle_error();&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Blocking wait for transmission completion */&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (0UL != (CY_SCB_UART_TRANSMIT_ACTIVE &amp;amp; Cy_SCB_UART_GetTransmitStatus(scb_4_HW, &amp;amp;uartContext)))&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Any idea what I could be missing here ? It seems like the xTaskToNotify gets lost in the context switch between the tasks.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks for any help on this - we are working on a research project in ornithology and would like to kick off the research&lt;/p&gt;&lt;p&gt;beginning of july.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers&lt;/p&gt;&lt;p&gt;Stefan&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;UART.c *************************************************&lt;/p&gt;&lt;p&gt;/* Allocate context for UART operation */&lt;/p&gt;&lt;p&gt;extern cy_stc_scb_uart_context_t uartContext;&lt;/p&gt;&lt;p&gt;static TaskHandle_t xTaskToNotify;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;char rxBuffer[UART_BUFFER_SIZE];&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;void uart_task(void *pvParameters) {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* To avoid compiler warnings */&lt;/p&gt;&lt;p&gt;&amp;nbsp; (void)pvParameters;&lt;/p&gt;&lt;p&gt;&amp;nbsp; uint32_t ulNotificationValue;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; while (true) {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Start the receiving from UART. */&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART_receive();&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Wait to be notified that the receive is complete.&amp;nbsp; Note&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the first parameter is pdTRUE, which has the effect of clearing&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the task&amp;#39;s notification value back to 0, making the notification&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value act like a binary (rather than a counting) semaphore.&amp;nbsp; */&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ulNotificationValue = ulTaskNotifyTake(pdTRUE, portMAX_DELAY&amp;nbsp; );&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( ulNotificationValue == 1 )&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Blocking wait until buffer is full */&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // in this example, it will never handle because the UART interrupt fires exactly when the buffer is full&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (0UL != (CY_SCB_UART_RECEIVE_ACTIVE &amp;amp; Cy_SCB_UART_GetReceiveStatus(scb_4_HW, &amp;amp;uartContext))) {}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Handle received data */&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; char tempBuffer[UART_BUFFER_SIZE];&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sprintf(tempBuffer, rxBuffer);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;// UART activate a receive with interrupt. Wait for ever for UART_BUFFER_SIZE bytes&lt;/p&gt;&lt;p&gt;void UART_receive() {&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* At this point xTaskToNotify should be NULL as no receive&lt;/p&gt;&lt;p&gt;&amp;nbsp; is in progress.&amp;nbsp; A mutex can be used to guard access to the&lt;/p&gt;&lt;p&gt;&amp;nbsp; peripheral if necessary. */&lt;/p&gt;&lt;p&gt;&amp;nbsp; configASSERT( xTaskToNotify == NULL );&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* Store the handle of the calling task. */&lt;/p&gt;&lt;p&gt;&amp;nbsp; xTaskToNotify = xTaskGetCurrentTaskHandle();&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* Start receive operation (do not check status) */&lt;/p&gt;&lt;p&gt;&amp;nbsp; (void) Cy_SCB_UART_Receive(scb_4_HW, rxBuffer, sizeof(rxBuffer), &amp;amp;uartContext);&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;// UART interrupt handler&lt;/p&gt;&lt;p&gt;void UART_Isr() {&lt;/p&gt;&lt;p&gt;&amp;nbsp; Cy_SCB_UART_Interrupt(scb_4_HW, &amp;amp;uartContext);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; BaseType_t xHigherPriorityTaskWoken = pdFALSE;&lt;/p&gt;&lt;p&gt; configASSERT( xTaskToNotify != NULL );&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* Notify the task that the receive is complete. */&lt;/p&gt;&lt;p&gt;&amp;nbsp; vTaskNotifyGiveFromISR( xTaskToNotify, &amp;amp;xHigherPriorityTaskWoken );&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* There are no receive in progress, so no tasks to notify. */&lt;/p&gt;&lt;p&gt;&amp;nbsp; xTaskToNotify = NULL;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* If xHigherPriorityTaskWoken is now set to pdTRUE then a&lt;/p&gt;&lt;p&gt;&amp;nbsp; context switch should be performed to ensure the interrupt&lt;/p&gt;&lt;p&gt;&amp;nbsp; returns directly to the highest priority task.&amp;nbsp; The macro used&lt;/p&gt;&lt;p&gt;&amp;nbsp; for this purpose is dependent on the port in use and may be&lt;/p&gt;&lt;p&gt;&amp;nbsp; called portEND_SWITCHING_ISR(). */&lt;/p&gt;&lt;p&gt;&amp;nbsp; portYIELD_FROM_ISR( xHigherPriorityTaskWoken );&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;*****************************************************************************************************&lt;/p&gt;&lt;p&gt;main - initUART()&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;void initUART() {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cy_en_scb_uart_status_t init_status;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cy_en_sysint_status_t irq_init_status;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* Configure UART to operate */&lt;/p&gt;&lt;p&gt;&amp;nbsp; init_status = Cy_SCB_UART_Init(scb_4_HW, &amp;amp;scb_4_config, &amp;amp;uartContext);&lt;/p&gt;&lt;p&gt;&amp;nbsp; if (init_status!=CY_SCB_UART_SUCCESS)&lt;/p&gt;&lt;p&gt;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp; handle_error_main();&lt;/p&gt;&lt;p&gt;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; /* Populate configuration structure (code specific for CM4) */&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; cy_stc_sysint_t uartIntrConfig =&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .intrSrc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = UART_INTR_NUM,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .intrPriority = UART_INTR_PRIORITY,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; };&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; /* Hook interrupt service routine and enable interrupt */&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; irq_init_status = Cy_SysInt_Init(&amp;amp;uartIntrConfig, &amp;amp;UART_Isr);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; if (irq_init_status!=CY_SYSINT_SUCCESS)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handle_error();&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; NVIC_EnableIRQ(UART_INTR_NUM);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; /* Enable UART to operate */&lt;/p&gt;&lt;p&gt;&amp;nbsp; Cy_SCB_UART_Enable(scb_4_HW);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: PSoC 6 and ModusToolbox: UART receiver with FreeRTOS</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/psoc-6-and-modustoolbox-uart-receiver-with-freertos</link><pubDate>Sat, 13 Mar 2021 23:21:44 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1</guid><dc:creator>balearicdynamics</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Great piece of cooperation &lt;span&gt;[View:/resized-image/__size/16x16/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-0bbedc67-ca4d-4f75-bee5-1e2d5c2f9cb1/contentimage_5F00_3.png:16:16]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Enrico&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=10972&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>