element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Connected Cloud Challenge
  • Challenges & Projects
  • Design Challenges
  • Connected Cloud Challenge
  • More
  • Cancel
Connected Cloud Challenge
Blog Mbed RTOS thread: Send CapSense Data to AWS #3
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: saicheong
  • Date Created: 8 Apr 2020 5:55 PM Date Created
  • Views 606 views
  • Likes 3 likes
  • Comments 0 comments
  • amazon web services
  • dog bites
  • mailbox
  • cypress
Related
Recommended

Mbed RTOS thread: Send CapSense Data to AWS #3

saicheong
saicheong
8 Apr 2020

Working for framework of RTOS threading

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Introduction

In order to send of data without blocking and improve the smooth  of user interface and background monitoring/tracking, the system required running under thread control provided by Mbed RTOS library.

 

Challenge of running multi-threading under small embedded

Currently, the mobile phone platform included sufficient few giga byte memory and powerful CPU with good graphic display chips.

Unfortunately, as require very low cost for anywhere and power consumption for long running hours, as currently Android and IOS UI provided data driven which the UI automatically change the behaviour when data changed, the IOT or embedded project mostly without those delicious dishes.

 

Our devices for this challenge only have 288K SRAM and 1MB memory, we require carefully handle of memory included the stack/heap under old school style, you know every inch of memory usage, compare as modern mobile app which can run hundred thread in a time, the embedded mostly only with few.

 

Mbed RTOS

image

Mbed included a well threading managing under RTOS which simplified our work.  The system create server thread such as rtx_idle/rtx_timer. The WIFI driver and Network Interface also create their threading.

The main thread is the start thread of the Mbed program.

Our program create additional threads for:

 

1. CapSense  - scan cypress CapSense touch buttons/sllider every 20ms control by EventQueue capsense_queue run under capsense_thread

2. AWSIOT - run every 2 second control by awsiot_queue run under awsiot_thread, for send the data to the AWS server.

3. LCD - The lcd_queue wait task for update LCD Display with size 16, and rejected additional task if  more that 16 drawing jobs waiting.

 

Capsense

By reference of Cypress example of https://github.com/cypresssemiconductorco/mbed-os-example-capsense  and use of capsense-configurator is easy of enable of Touch buttons and sliders.

image

The CapSense Tuner also is helpful for troubleshooting and validate the touch function.

 

Send to AWS IOT

image

 

The process from User pushed to AWS is:

 

1. User push button

2. capsense scan every 20ms

3. lcd_ui received capsense call and build event tasks for update lcd

4. lcd EventQueue work jobs based on FIFO, however some tasks will run by delay such as clear text after one seconds for the short notifications.

5. awsiot received capsense call and write key and value to a c++ map.

6. awsiot EventQueue read the map every two seconds, if the map empty, the event close immediately, otherwise the event build json string and publish to AWS cloud.

    finally clear the map

 

image

 

 

Code

Our gitHub content the source code of this example.

1. Install mbed cli

2. Clone the source code and to this directory

3. mbed config root .

4. mbed deploy

5. update the aws_config.h for AWS cert and endpoint, update network.h for WIFI SSID and password.

6. mbed compile -t GCC_ARM -m CY8CKIT_062_WIFI_BT -f --sterm

 

 

https://github.com/sicreative/mbed-aws-capsense-demo/

 

WIFI Driver issue under Mbed

Be notice, by reference of latest PSOC6 library, the Mbed

mbed-os/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/SDIO_HOST/SDIO_HOST.c

may require update to following content to solve the problem of WIFI cannot be startup when boot.

void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
{
    uint16_t u16Div;
    /*
     * The UDB SDIO implemenation has a extra divider internally that divides the input clock to the UDB
     * by 2. The desired clock frequency is hence intentionally multiplied by 2 in order to get the required
     * SDIO operating frequency.
     */
    u16Div = Cy_SysClk_ClkPeriGetFrequency() / (2 * u32SdClkFreqHz);
    Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
}

 

Next

Work for IOS APP for communicated between IOS and Pioneer kits though AWS cloud.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube