Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Mbed part 2 - Importing a code example from the Cypress ModusToolbox code example GitHub repository

Mbed part 2 - Importing a code example from the Cypress ModusToolbox code example GitHub repository

mattl_01
Employee
Employee
100 replies posted 50 replies posted 25 replies posted

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

pastedImage_0.png

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

pastedImage_1.png

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.

pastedImage_7.png

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

2336 Views
12 Comments
hemic_330866
Level 3
Level 3
5 comments on blog First comment on blog 10 replies posted

Dear MattL_01,
your described way works fine. But only the terminal does not. I connect TeraTerm to ComX (DapLink) with 9600, 8N1 and reset the App but nothing happens in the terminal. So in 3 diffrent examples. What could be the error?

Thank you!

Helmut

0 Likes
mattl_01
Employee
Employee
100 replies posted 50 replies posted 25 replies posted

Hey Helmut, you might try resetting the board (SW1). Do you get garbage or just no output?

0 Likes
hemic_330866
Level 3
Level 3
5 comments on blog First comment on blog 10 replies posted

Hello Matt,
thank you for your answer, but as i described: after resetting the app (SW1 at CY8CPROTO_062_4343W) nothing happens in terminal window. The cusor blinks at position 0,0. Since the programming seems to be ok. Example "... blinky" LED4 blinks and example "... capsense" LED4 is on, wenn pressing one of the buttons or moving the slider. Only in TeraTerm no output.

Helmut

0 Likes
mattl_01
Employee
Employee
100 replies posted 50 replies posted 25 replies posted

Maybe there is some issue with the Mbed serial port / serial port driver.  Do you see something like this in the device manager?

pastedImage_0.png

0 Likes
hemic_330866
Level 3
Level 3
5 comments on blog First comment on blog 10 replies posted

Thank you Matt for your help.

As I described in my posts I see ComX (here Com7 9600 8N1). I see the DapLink in file-Browser (here drive H:\ also with MBED.HTM and DETAILS.TXT). The Com Properties are correctly set to 8N1 and in TeraTerm – also in Putty – Iset correctly Com 7 8N1. And Ireset the App 1, 2, 3 times for 1, 2, 3, 5, 12 seconds but nothing happens in my terminal window.

Helmut

Von: MattL_01

Gesendet: Mittwoch, 8. Mai 2019 23:30

An: Helmut Mielenz <service@mielenz-ctg.de>

Betreff: Re: – Mbed part 2 - Importing a code example from the Cypress ModusToolbox code example GitHub repository

<https://community.cypress.com/?et=blogs.comment.created> Cypress Developer Community

Mbed part 2 - Importing a code example from the Cypress ModusToolbox code example GitHub repository

neuer Kommentar von MattL_01 <https://community.cypress.com/people/MattL_01?et=blogs.comment.created> - Alle Kommentare für diesen Blog-Eintrag anzeigen <https://community.cypress.com/community/modustoolbox/blog/2019/03/31/mbed-part-2-importing-a-code-example-from-the-cypress-modustoolbox-code-example-github-repository?et=blogs.comment.created#comment-11196>

0 Likes
mattl_01
Employee
Employee
100 replies posted 50 replies posted 25 replies posted

So you definitely see the Mbed serial port in the device manager. Correct?  I think I saw in an earlier post where you did an mbedls and it returned something that looked correct.

0 Likes
hemic_330866
Level 3
Level 3
5 comments on blog First comment on blog 10 replies posted

Yes Matt, it is correct.

Dear Matt, I am a little embarrassed to torpedo you with my problems (Terminal-output and Reset from DapLink to KitProg3). But I’m experimenting since two weeks with these mbed-examples and it seems to me to be a dead end - as interesting as the examples are. Especially since I can not restore from DAPLINK-mode to KitProg3-mode for future MTB attempts.

Could it be an interface error of my CY8CPROTO_062-4343W-KitProg3?

If nobody else can help, I'll wait until Monday.

Thanks you for your effort and help again!

Helmut

Von: MattL_01

Gesendet: Donnerstag, 9. Mai 2019 00:08

An: Helmut Mielenz <service@mielenz-ctg.de>

Betreff: Re: – Mbed part 2 - Importing a code example from the Cypress ModusToolbox code example GitHub repository

<https://community.cypress.com/?et=blogs.comment.created> Cypress Developer Community

Mbed part 2 - Importing a code example from the Cypress ModusToolbox code example GitHub repository

neuer Kommentar von MattL_01 <https://community.cypress.com/people/MattL_01?et=blogs.comment.created> - Alle Kommentare für diesen Blog-Eintrag anzeigen <https://community.cypress.com/community/modustoolbox/blog/2019/03/31/mbed-part-2-importing-a-code-example-from-the-cypress-modustoolbox-code-example-github-repository?et=blogs.comment.created#comment-11200>

0 Likes
mattl_01
Employee
Employee
100 replies posted 50 replies posted 25 replies posted

I overlooked the part where you couldn't get back to normal KP3 mode, even holding SW3 for > 2 seconds (it's definitely SW3 labeled MODE, not SW2 which is labeled USER). That seems like a hardware problem.    What Rev is on the white sticker on the back?  One other thing to try is running fw-loader --update-kp3 again.

--Matt

0 Likes
hemic_330866
Level 3
Level 3
5 comments on blog First comment on blog 10 replies posted

Dear Matt,

as I described, I pressed SW3 (Mode) at KitProg3 for > 2 seconds. But again all Documents and your descriptions LED2 of KitProg3 stays „off“. And since „fw-loader –device-list“ brings up the message

„Cypress Firmware Updater, Version: 2.1.0.52

(C) Copyright 2018-2019 by Cypress Semiconductor

All Rights Reserved

Info: Start API initialization

Info: Hardware initialization complete (330 ms)

No connected devices“

It just seems logical, that also „fw-loader --update-kp3“

Brings up exactly the same mesage.

The MTB-fw-loader is not possible to connect DAPLINK-Interface.

The Problem ist that my KitProg3 not switches by pressing KitProg3-SW3 (MODE).

That's why I asked if my kit could be faulty.

Waybe the terminal problem is synonymous with it?

Helmut

Von: MattL_01

Gesendet: Donnerstag, 9. Mai 2019 00:47

An: Helmut Mielenz <service@mielenz-ctg.de>

Betreff: Re: – Mbed part 2 - Importing a code example from the Cypress ModusToolbox code example GitHub repository

<https://community.cypress.com/?et=blogs.comment.created> Cypress Developer Community

Mbed part 2 - Importing a code example from the Cypress ModusToolbox code example GitHub repository

neuer Kommentar von <https://community.cypress.com/people/MattL_01?et=blogs.comment.created> MattL_01 - <https://community.cypress.com/community/modustoolbox/blog/2019/03/31/mbed-part-2-importing-a-code-example-from-the-cypress-modustoolbox-code-example-github-repository?et=blogs.comment.created#comment-11202> Alle Kommentare für diesen Blog-Eintrag anzeigen

0 Likes
hemic_330866
Level 3
Level 3
5 comments on blog First comment on blog 10 replies posted

Matt,

sorry I overlocked this question.

White sticker on the back is:

121-60537-01 Rev 04

1844SO00272

Helmut

0 Likes
mattl_01
Employee
Employee
100 replies posted 50 replies posted 25 replies posted

Can you email me your shipping address/phone number?  I'm at mdl@cypress.com.  I just ran through the flow again, and it's working, and I am not having trouble getting out of DAPLink.  Your suspicion about the hardware may be correct.

--Matt

0 Likes
baga_4725781
Level 3
Level 3
10 replies posted 5 replies posted 5 questions asked

The link to "mbed-part-2...." is a dead link. I trimmed off the part for the comment - same results.

0 Likes
Authors