Hey ModusToolbox users.  This blog post is a follow-up to the post I recently made showing a WiFi Scanner using the Mbed->ModusToolbox flow. While that was meant as an introduction, this post will actually be a lot shorter. Basically, all I’ll cover here is how to use an example from the Cypress GitHub code example repository instead of Mbed’s.

 

I will be using the PSoC 6 Wi-Fi BT prototyping kit (CY8CPROTO-062-4343W).  But, you can also use the CY8CKIT-062-BLE or the CY8CKIT-062-WiFi-BT. You can use any Cypress kit supported in Mbed that has a CapSense slider on the board.

 

OK, I am going to assume you have already gone through that first blog post and have your ModusToolbox and Mbed environment all set up.  The first thing we need to do is go get the code example.  You can do that in a couple of ways.

 

1. Go directly to the GitHub location for ModusToolbox examples, which is here

     https://github.com/cypresssemiconductorco/Code-Examples-for-ModusToolbox-Software

 

2. From the ModusToolbox IDE Quick Panel, select “Search Online for Code Examples” like this

Either way, you’ll end up at this location.  Focus on the area labeled “Mbed OS Examples”.

I want the Mbed OS and CapSense example so I’ll click on that.  There are actually instructions on running this example right on that GitHub page, but I’ll repeat most of them here so you are not jumping back and forth.

 

3. Open up a Git Bash shell first (you can use a Cygwin terminal or a Windows cmd window, the instructions for setting up your environment will vary slightly).

 

4. Import the code example like this

mbed import https://github.com/cypresssemiconductorco/mbed-os-example-capsense

Depending network traffic, it may take a minute or two to copy the example over (it’s almost a Gb on disk).

 

5. Go to the example folder

cd mbed-os-example-capsense

 

6. Plug in your kit and ensure the kit is in DAPLink mode. See my earlier blog post or the Switch Kit to DAPLink Mode section in chapter 3 of the ModusToolbox IDE User Guide if you need more information on this.  For my kit, I press and hold SW3 for > 2 seconds.

 

7. Compile the example and program the board with the following command

mbed compile --target CY8CPROTO_062_4343W --toolchain GCC_ARM --flash --sterm

For other targets:

mbed compile -m CY8CKIT_062_WIFI_BT -t GCC_ARM -f –sterm

mbed compile -m CY8CKIT_062_BLE -t GCC_ARM -f --sterm

Note: -f is equivalent to –flash, -t is equivalent to --toolchain

 

OK, what is that –sterm option?  In my other examples I have used PuTTY or TeraTerm (you can still use those if you want).

The --sterm option opens a serial terminal set to 9600-8N1 on your the command window after programming completes. Obviously, leave this option out if you wish to connect using another serial terminal application.

 

8. After the kit is programmed and the program starts, you will see this message in your terminal window that looks something like this.

+++++++++++++++++++ Application has started. Touch any CapSense button or slider.

 

9. Touch the buttons and the slider to observe the red LED changing its state and to see the status of the various CapSense sensors printed in the terminal.  The messages in the terminal will look something like this.

10. You can also monitor the CapSense data using the CapSense Tuner application as described on the GitHub site or in this blog post.

 

That’s it for this post. Hit me up in the comments if you have questions.

--Matt