You are here

PSoC FreeRTOS Task Notify | Cypress Semiconductor

PSoC FreeRTOS Task Notify

[re-printed from https://iotexpert.com]

I have been writing a bunch of articles about implementing PSoC FreeRTOS so, this morning I was reading the FreeRTOS manual (yes I am one of those…) and I noticed a section in the API guide that I hadn’t see before… Task Notifications.  Every task in the FreeRTOS has a built in 32-bit integer notification value.  This value is super light weight and can be used like a task specific counting semaphore, or a signaling bit mask, or binary semaphore.  The API includes:

It seems like this API is good for the situations when your Semaphore has a specific task target in mind.  I thought that this would be a perfect scheme to have a PSoC FreeRTOS UART ISR signal the UART Handling task that there is data available to do something with.

Setup the PSoC FreeRTOS Project

I start this process by making a copy of “1-BlinkingLED” (which already has all of the FreeRTOS stuff in it) and naming it “9-TaskNotify”.  Then I add a UART to the schematic and name it “UART”

PSoC FreeRTOS Schematic

I attach the UART to the right pins on the CY8CKIT-044 kit.

PSoC Creator Pin Assignment

 

Next I turn on the interrupt which will be called when there is data in the receive FIFO.

PSoC UART Configuration

 

PSoC FreeRTOS UART Code

Now that the schematic is all configured I update my firmware.  The function “uartHandler” is called when there is data in the UART RX FIFO.  It turns of the interrupts for the UART (which I will turn back on after I have cleared the data in the input buffer), clears the interrupt  (so that it will stop pending) and then sends the notification to the UART_Task.

The UART Task just registers the handler… then while(1)’s until the end of time.  It waits for a notification, then reads data out of the RX fifo and puts out,  then re-enables the interrupts.

CY_ISR(uartHandler)
{
    BaseType_t xHigherPriorityTaskWoken;
 
    // disable the interrupt
    UART_SetRxInterruptMode(0);
    vTaskNotifyGiveFromISR(uartTaskHandle,&xHigherPriorityTaskWoken);
    portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
 
void UART_Task( void *arg)
{
    (void)arg;
    char c;
    UART_Start();
    UART_SetCustomInterruptHandler(uartHandler);
    while(1)
    {
        ulTaskNotifyTake(pdTRUE,portMAX_DELAY);
        while(UART_SpiUartGetRxBufferSize())
        {
            c = UART_UartGetChar();
            UART_UartPutChar(c);
        }
        // clear & re-enable the interrupt
        UART_ClearRxInterruptSource(UART_INTR_RX_NOT_EMPTY);
        UART_SetRxInterruptMode(UART_INTR_RX_NOT_EMPTY);
    }
}

 

Comments

marlinhwright665_2756346's picture

Your Article about the implementation of PSoC FreeRTOS is really helpful in API with the solution queries of task notifications and it really works because it is a unique and Essays Writing Services perfect guideline especially about semaphore and binary semaphore.

jam.martinn1987_2774596's picture

Your Article about the implementation of PSoC FreeRTOS is clearly helpful in API with the solution queries of assignment notifications and it truly works. I got it to my colossal statistics from right here. Appreciative to you this sort of beautiful mixture for sharing this publish.

Source by Cheap Coursework Writers

saracanaday225_2842211's picture

An software programming interface (API) is a set of programming commands and standards for having access to a Web primarily based software application or Web device. A software program enterprise releases its API to the public so that different software program developers can layout products which might be powered with the aid of its provider. Do My Essay

abdul.azim5712_2851661's picture

This article is clear my all confusion about the PSoC FreeRTOS. Usually, I do not understand this hardware and software functions and working but after reading this post I get unique knowledge and learn many things. Thanks for sharing the nice information and If sometimes you need assistance about writing so you can take help with us. We are working for the UAE students and providing the online assignment writing service and best academic assistance.

Victoria Julia's picture

Your Article about the execution of PSoC FreeRTOS is truly useful in API with the arrangement questions of undertaking notices and it truly works since it is a unique.I got it to my giant measurements from appropriate here. Grateful to you this kind of delightful blend for sharing this distribute. 

A product programming interface (API) is an arrangement of programming summons and guidelines for approaching a Web principally based programming application or Web gadget. A product program undertaking discharges its API to the general population so extraordinary programming program engineers would layout be able to items which may be fueled with the guide of its supplier

Web Source: Write my Essay Cheap

onlineessayhelp_2874341's picture

Hello! Thanks for the write-up. It was very useful for me to read this. The screenshots which are given here are useful to read it and implement it as a solution.  Hoping to read more posts from you! Urgently get coursework written from life saver essays. 

monica.09anderson_2921931's picture

Well this source is something very important the module have made things quite literally bit easy for me now, I think I can work things out properly out as the source which was provided by Custom Paper Writing Company have helped me a lot.

kakbrus_2889656's picture

Nice blog, the article you have shared is good.This article is very useful. My friend suggest me to use this blog. thank so much! five nights at freddy's

ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.