Minimizing energy consumption in Amazon FreeRTOS applications

first_imgShare this:TwitterFacebookLinkedInMoreRedditTumblrPinterestWhatsAppSkypePocketTelegram Energy consumption is an important characteristic that needs to be monitored carefully when developing an IoT device. Energy consumption can be the difference between a device lasting for several years on a single battery or contributing to an ever-increasing electrical bill. As developers create connected devices, they will undoubtedly use an RTOS to manage their complex timing requirements, but how can they manage their RTOSs energy consumption? In this post, we will examine how to enable and configure Amazon FreeRTOSs tickless mode and how we can customize it for our own application.The Typical System TickIn order to take a few measurements, I loaded the latest version of Amazon FreeRTOS onto a ST Microelectronics IoT Discovery Node development board and instrumented the tick interrupt so that when the interrupt fires it sets a GPIO line high at the start of the tick interrupt and then brings it low at the end of the interrupt. Using a Saleae Logic probe, I found that a 1 millisecond tick pattern was generated as expected which can be seen below:click for larger imageIf they were to zoom out and look at the pattern that is generated over a 20 second period, they would find that the system tick runs every 1 millisecond even though the demonstration application is idle for approximately 86% of the time. This pattern can be seen in the logic analyzer trace below:click for larger imageNow this is what we expect for a typical application that doesn’t care about low power savings mode, but if we are developing an IoT application, we do care about low power and want to spend as much time sleeping as possible. We don’t want our system to wake-up every 1 millisecond only to discover that there is no work to be done.Amazon FreeRTOS contains an interesting feature called Tickless mode that allows the processor to go to sleep and stretch out the system tick until either a task comes due or an event such as an interrupt wakes up the system. This feature allows the processor to stay asleep as long as possible and conserve a significant amount of energy. Let’s look at how we can enable this feature.Enabling Tickless Mode in Amazon FreeRTOSAll configuration for the RTOS in Amazon FreeRTOS can be adjusted in the FreeRTOSConfig.h file. Within the configuration, there is a #define for configUSETICKLESS_IDLE which by default is set to 0. Changing the 0 to a 1 will enable tickless mode.When tickless mode is enabled, there are two functions that are expected to be defined. The first, is PreSleepProcessing which allows a developer to add custom code that they want executed immediately before the RTOS puts the processor to sleep. A few ideas on what a developer should be doing here include:Setting the desired sleep mode setting (Stop, deep sleep, etc)Disabling power hungry peripheralsSlowing down peripheral clocksEnabling the processors wake-up features.The second function is PostSleepProcessing. As you can imagine, a developer would place code in this function that is executed immediately after the processor wakes up. In many cases, this is going to be code that undoes what was done in PreSleepProcessing but it could also be code that checks what woke the system up and then decides how awake the processor should become before going back to sleep. The possibilities are quite limitless and application dependent.When defining the PreSleepProcessing and PostSleepProcessing functions, it’s important to define there are two things to take into consideration. First, you need to define the functions as follows: void PreSleepProcessing(uint32_t *ulExpectedIdleTime){// Add your code here}void PostSleepProcessing(uint32_t *ulExpectedIdleTime){// Add your code here}Scroll or drag the corner of the box to expand as needed. ↑The ulExpectedIdleTime is a parameter that lets the developer know how long the RTOS expects the system to be idle. This allows a developer to decide how deep into sleep to go along with what they want to do based on the expected sleep time.Testing Tickless ModeI took a quick trace of the system tick with the tickless mode enabled and as you can see below, there are times over the 20 seconds interval where there is no need to run the 1 millisecond tick and you get larger gaps in between. Now the image below was taken at start-up so you can see during the first 8 seconds after start-up the demonstration application is quite busy establishing a secure connection to Amazon Web Services and then the system occasionally wakes up to transmit and receive MQTT for larger imageConclusionsUsing tickless mode in Amazon FreeRTOS is a great way to manage and decrease the energy consumption that your system is using. Instead of waking the system up every millisecond, the system instead can wake-up only when it has work that needs to be done. Developers do need to be careful to make sure that they set their sleep mode setting properly and in a state that will allow the processor to still wake-up. They also need to ensure that there aren’t any other pieces of framework code that could wake their system up unexpectedly. Beyond that, developers have the complete flexibility to do whatever it is that they need to in order to minimize their energy consumption. Jacob Beningo is an embedded software consultant, advisor and educator who currently works with clients in more than a dozen countries to dramatically transform their software, systems and processes. Feel free to contact him at [email protected], at his website, and sign-up for his monthly Embedded Bytes Newsletter. Continue Reading Previous Würth Elektronik eiSos promotes the future networkNext Elma: portable development platform enables collaboration and resource sharing within design teamslast_img read more

Kevin Bacon CoChairs Woodcraft Rangers 90th Anniversary Dinner

first_imgWoodcraft Rangers, the leader in after-school programs for Los Angeles at-risk youth, proudly celebrates their 90th Anniversary with a dinner, silent auction and entertainment on Wednesday, May 8, 2013, at La Plaza de Cultura y Artes in downtown Los Angeles. Kyra Sedgwick and Kevin Bacon serve as Honorary Co-Chairs.Actor, producer and director Dennis Haysbert will be an award presenter. One of the awards will be presented to Academy Award nominee for Best Actress for her role in the 2009 movie Precious, Gabourey Sidibe, for being an inspiration to today’s teens. Musical guests included a special performance by Scott Shriner from the hit band Weezer.“I’m really proud to be honored by Woodcraft Rangers,” said Sidibe. “Being able to inspire teens is really important to me. I’m excited to be a part of this great evening. Kids are my jam!”“Woodcraft Rangers gives youth the amazing chance to express themselves through music — this is a priceless gift,” said Shriner. “I’m thrilled to be performing with one of the talented kids who has benefitted from this great program. The 90th Anniversary celebration is a great way for people to get involved and have a blast.”“Woodcraft Rangers is literally shaping the lives of over 6,000 students every day,” said Sedgwick. “This organization provides an outlet for otherwise at-risk youth to follow their passions, everything from technology to music and from dance to the arts.”“We are very excited about our fundraising event this year,” said Woodcraft Rangers CEO Chris Johnson. “We have so much enthusiasm, passion and commitment this year from a lot of people who believe in our mission. All the funds raised at the dinner and auction will go to our Nvision program, which is one the most successful after-school programs in Los Angeles.”Since 1922, Woodcraft Rangers has provided innovative after-school programs to underserved youth in the greater Los Angeles area. These programs operate on 60 public school campuses and reach over 15,000 students annually by helping children, across all grade levels, mature into healthy, productive adults through positive experiences and age-appropriate challenges. Woodcraft Rangers serves at-risk youth in neighborhoods where access to positive, structured activities is limited and kids are left with little or no adult supervision during non-school hours. Woodcraft Rangers offers a positive alternative to the boredom and negative peer pressures that can lead to juvenile delinquency.The organization promotes self-discovery and supports academic achievement by involving youth in experiences that engage the imagination, stimulate thinking, uncover talents and reveal potential. WR’s signature after-school program is Nvision. Nvision consists of school-based afterschool club for youth designed to promote academic, social, and physical development with activities that include cooking, etiquette, jewelry making, drawing and painting, and computer skills.Within Nvision program is the youth in science, technology, engineering, and mathematics (STEM) education component that was singled out by Senator Barbara Boxer, the Afterschool Caucus Chair, in a speech on the Senate Floor recently stating, “Woodcraft Rangers exposes middle school students to cutting-edge STEM activities, including robotics. This highly engaging program allows students to configure high-tech robotics, enhancing their STEM skills, unlocking their imaginations, and exposing them to real-world problem- solving situations.”Recognition events, to which parents, faculty, and other youth are invited to celebrate participants’ accomplishments, are held at regularly. These events may include an exhibit, team competition, performance, or awards ceremony. WR also provides field trips to educational, cultural, and recreational venues. For more information on Woodcraft Rangers, click here.The event starts at 6:00 pm on Wednesday, May 8, 2013, La Plaza de Cultura y Artes at 501 N. Main Street, Downtown Los Angeles. For more details about the event and to purchase tickets, click here.last_img read more

Tom Arnold To Be Honored With Humanitarian Award

first_imgPeggy Albrecht Friendly House Los Angeles, will honor Tom Arnold with the “Humanitarian Award;” Oscar De La Hoya with the “Man of the Year” award; and Kelly Meyer with the “Woman of the Year” award at their 25th annual Awards Luncheon, Saturday, October 25 at The Beverly Hilton Hotel, Beverly Hills.Sydney Holland and Sumner Redstone serve as Honorary Co-Chairs; Peggy Albrecht and Michael Hollingsworth, Co-Chair. Celebrity fashion stylist and television personality Brad Goreski will emcee.The “Humanitarian of the Year” award is being presented to writer, producer and actor Tom Arnold. Although he’s known as a funny man, he’s successfully broken out of the comedic stereotype by landing more mature and dramatic roles featured at film festivals. Going back to his roots, Arnold has established a writing scholarship and runs an acting workshop for students at the Indian Hills Community College in Iowa in addition to supporting a number of other charities.Peggy Albrecht Friendly House’s “Man of the Year” honoree is Oscar De La Hoya, Olympic gold medalist and 10–time world boxing champion. Since retiring from the ring in 2009, De La Hoya has focused his attention on building his company, Golden Boy Promotions, into the most successful boxing promotion company in the world.Kelly Chapman Meyer, environmental activist and health advocate, will be honored with the “Woman of the Year” award. Meyer is a trustee of the Natural Resources Defense Council (NRDC) and co-founder of the American Heart Association Teaching Gardens.Find out more here.last_img read more