cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

AbBa_4336446
New Contributor II

Hello. I am trying to run the "mbed-os-example-bluetooth-mesh-gateway" example using the PSOC6 CY8CKIT_062S2_43012.

I have followed the steps in the example repo github page (https://github.com/cypresssemiconductorco/mbed-os-example-bluetooth-mesh-gateway).

when it comes to step # 7 (cmd: mbed compile -t GCC_ARM -m CY8CKIT_062S2_43012 -f), I am facing some errors.

As shown below, I tried to update the python modules that were not auto-installed (using "pip install -r requirements.txt"), a new error pops up

ERROR: Could not find a version that satisfies the requirement pywin32==224 (from -r requirements.txt (line 26)) (from versions: 225, 226, 227, 228)

ERROR: No matching distribution found for pywin32==224 (from -r requirements.txt (line 26))

(N.B.: i am running mbed os v6.0 & python 3.8)

i pasted the cmd output below to show the issue:

C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG>mbed compile -t GCC_ARM -m CY8CKIT_062S2_43012 -f

[mbed] Working path "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG" (library)

[mbed] Program path "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG"

[mbed] WARNING: Missing Python modules were not auto-installed.

       The Mbed OS tools in this program require the following Python modules: jsonschema, mbed_cloud_sdk, jinja2, mbed_ls, mbed_host_tests, mbed_greentea, pyelftools, manifest_tool, icetea, pycryptodome, pyusb, hidapi, cmsis_pack_manager, wmi, psutil, cryptography, click, cbor

       You can install all missing modules by running "pip install -r requirements.txt" in "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os"

---

Traceback (most recent call last):

  File "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os\tools\make.py", line 40, in <module>

    from tools.options import get_default_options_parser

  File "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os\tools\options.py", line 25, in <module>

    from .toolchains import TOOLCHAINS, EXTRA_TOOLCHAIN_NAMES

  File "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os\tools\toolchains\__init__.py", line 20, in <module>

    from . import mbed_toolchain, arm, gcc, iar

  File "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os\tools\toolchains\mbed_toolchain.py", line 48, in <module>

    from ..memap import MemapParser

  File "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os\tools\memap.py", line 34, in <module>

    from jinja2 import FileSystemLoader, StrictUndefined

ModuleNotFoundError: No module named 'jinja2'

[mbed] ERROR: "c:\python38\python.exe" returned error.

       Code: 1

       Path: "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG"

       Command: "c:\python38\python.exe -u C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os\tools\make.py -t GCC_ARM -m CY8CKIT_062S2_43012 --source . --build .\BUILD\CY8CKIT_062S2_43012\GCC_ARM"

       Tip: You could retry the last command with "-v" flag for verbose output

---

C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG>cd "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os"

C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os>pip install -r requirements.txt

Collecting colorama==0.3.9

  Using cached colorama-0.3.9-py2.py3-none-any.whl (20 kB)

Collecting urllib3[secure]==1.24.2

  Using cached urllib3-1.24.2-py2.py3-none-any.whl (131 kB)

Requirement already satisfied: prettytable==0.7.2 in c:\python38\lib\site-packages (from -r requirements.txt (line 3)) (0.7.2)

Collecting junit-xml==1.8

  Using cached junit-xml-1.8.tar.gz (10.0 kB)

Collecting pyyaml==4.2b1

  Using cached PyYAML-4.2b1.tar.gz (263 kB)

Collecting jsonschema==2.6.0

  Using cached jsonschema-2.6.0-py2.py3-none-any.whl (39 kB)

Collecting future==0.16.0

  Using cached future-0.16.0.tar.gz (824 kB)

Collecting six==1.12.0

  Using cached six-1.12.0-py2.py3-none-any.whl (10 kB)

Collecting mbed-cloud-sdk<2.1,>=2.0.6

  Using cached mbed_cloud_sdk-2.0.8-py2.py3-none-any.whl (786 kB)

Collecting requests<2.21,>=2.20

  Using cached requests-2.20.1-py2.py3-none-any.whl (57 kB)

Collecting idna<2.8,>=2

  Using cached idna-2.7-py2.py3-none-any.whl (58 kB)

Requirement already satisfied: pyserial<=3.4,>=3 in c:\python38\lib\site-packages (from -r requirements.txt (line 12)) (3.4)

Collecting Jinja2<2.11,>=2.10.1

  Using cached Jinja2-2.10.3-py2.py3-none-any.whl (125 kB)

Requirement already satisfied: intelhex<=2.2.1,>=1.3 in c:\python38\lib\site-packages (from -r requirements.txt (line 14)) (2.2.1)

Collecting mbed-ls<1.8,>=1.5.1

  Using cached mbed-ls-1.7.12.tar.gz (174 kB)

Collecting mbed-host-tests<1.6,>=1.4.4

  Using cached mbed_host_tests-1.5.10-py2.py3-none-any.whl (61 kB)

Collecting mbed-greentea<1.8,>=0.2.24

  Using cached mbed_greentea-1.7.4-py2.py3-none-any.whl (57 kB)

Collecting beautifulsoup4<=4.6.3,>=4

  Using cached beautifulsoup4-4.6.3-py3-none-any.whl (90 kB)

Collecting pyelftools<=0.25,>=0.24

  Using cached pyelftools-0.25-py2.py3-none-any.whl (126 kB)

Collecting manifest-tool==1.5.2

  Using cached manifest_tool-1.5.2-py3-none-any.whl (75 kB)

Collecting icetea<1.3,>=1.2.1

  Using cached icetea-1.2.4-py3-none-any.whl (172 kB)

Collecting pycryptodome<4,>=3.9.3

  Using cached pycryptodome-3.9.8-cp38-cp38-win32.whl (14.1 MB)

Collecting pyusb<2.0.0,>=1.0.0

  Using cached pyusb-1.0.2.tar.gz (54 kB)

Collecting hidapi<0.8.0,>=0.7.99

  Using cached hidapi-0.7.99.post21.tar.gz (51 kB)

Collecting cmsis-pack-manager<0.3.0,>=0.2.3

  Using cached cmsis_pack_manager-0.2.10-py2.py3-none-win32.whl (2.3 MB)

ERROR: Could not find a version that satisfies the requirement pywin32==224 (from -r requirements.txt (line 26)) (from versions: 225, 226, 227, 228)

ERROR: No matching distribution found for pywin32==224 (from -r requirements.txt (line 26))

C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os>

Thanks for the support

Karim

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator

This is a known issue if Mbed is used with Python 3.8. Listing down the links for reference:

Mbed doesn't work with Python 3.8 if pip install -U mbed-cli is done · Issue #12622 · ARMmbed/mbed-o...

Issue with python packages install · Issue #12848 · ARMmbed/mbed-os · GitHub

They recommend using Python 3.7 when working with Mbed. Although you could edit the requirements.txt and edit pywin32 to point to 225 and higher which has support for Python 3.8, there might be other conflicting modules within Mbed for Python 3.8.

So, I would suggest creating a virtual environment targeting Python 3.7 using pipenv.

>> pipenv --python 3.7

And then install mbed cli inside this environment by using:

>> pip install mbed-cli

Hope this helps

Regards,
Dheeraj

View solution in original post

19 Replies
DheerajK_81
Moderator
Moderator

This is a known issue if Mbed is used with Python 3.8. Listing down the links for reference:

Mbed doesn't work with Python 3.8 if pip install -U mbed-cli is done · Issue #12622 · ARMmbed/mbed-o...

Issue with python packages install · Issue #12848 · ARMmbed/mbed-os · GitHub

They recommend using Python 3.7 when working with Mbed. Although you could edit the requirements.txt and edit pywin32 to point to 225 and higher which has support for Python 3.8, there might be other conflicting modules within Mbed for Python 3.8.

So, I would suggest creating a virtual environment targeting Python 3.7 using pipenv.

>> pipenv --python 3.7

And then install mbed cli inside this environment by using:

>> pip install mbed-cli

Hope this helps

Regards,
Dheeraj

View solution in original post

AbBa_4336446
New Contributor II

Hello. Thanks for the feedback. i Removed Python 3.8 & installed 3.7 and updated also arm-none-eabi-gcc to (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408.

When executing mbed compile -t GCC_ARM -m CY8CKIT_062S2_43012 -f, missing modules and requirements are installed successfully (pywin32 and others..) but new new errors popped. below is the cmd o/p.

is there sth wrong?

C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG>mbed compile -t GCC_ARM -m CY8CKIT_062S2_43012 -f

[mbed] Working path "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG" (library)

[mbed] Program path "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG"

Building project BIG (CY8CKIT_062S2_43012, GCC_ARM)

Scan: BIG

Using RAM region application_ram in this build.

  Region application_ram: size 0xfd800, offset 0x8002000

Compile [  0.1%]: MQTTDeserializePublish.c

Compile [  0.2%]: MQTTConnectServer.c

Compile [  0.3%]: MQTTSerializePublish.c

Compile [  0.3%]: MQTTSubscribeClient.c

Compile [  0.4%]: MQTTConnectClient.c

Compile [  0.5%]: MQTTFormat.c

[Warning] MQTTFormat.c@123,9: variable 'strindex' set but not used [-Wunused-but-set-variable]

[Warning] MQTTFormat.c@193,9: variable 'strindex' set but not used [-Wunused-but-set-variable]

Compile [  0.6%]: MQTTPacket.c

Compile [  0.7%]: http_parser.c

[Warning] http_parser.c@1817,31: this statement may fall through [-Wimplicit-fallthrough=]

[Warning] http_parser.c@2376,18: this statement may fall through [-Wimplicit-fallthrough=]

Compile [  0.8%]: MQTTSubscribeServer.c

Compile [  0.8%]: MQTTUnsubscribeClient.c

Compile [  0.9%]: MQTTUnsubscribeServer.c

Compile [  1.0%]: embedded_BLE.cpp

Compile [  1.1%]: aws_greengrass_discovery.c

Compile [  1.2%]: bt_firmware_embedded_mesh_gateway.c

Compile [  1.3%]: embedded_BLE_mesh.cpp

Compile [  1.4%]: embedded_GAP.cpp

Compile [  1.4%]: bt_firmware.c

Compile [  1.5%]: wiced_hci.c

[Warning] wiced_hci.c@272,54: passing argument 2 of 'cy_rtos_create_thread' from incompatible pointer type [-Wincompatible-pointer-types]

Compile [  1.6%]: wiced_hci_bt_ble.c

Compile [  1.7%]: wiced_hci_bt_dm.c

Compile [  1.8%]: wiced_hci_bt_mesh.c

Compile [  1.9%]: wiced_uart.c

Compile [  1.9%]: JSON.c

Compile [  2.0%]: cy_string_utils.c

Compile [  2.1%]: cy_log.cpp

Compile [  2.2%]: linked_list.c

Compile [  2.3%]: embedded_BLE_hcidriver.cpp

[Error] embedded_BLE_hcitransportdriver.h@126,5: 'RawSerial' does not name a type

[Error] embedded_BLE_hcitransportdriver.h@64,5: class 'cypress::embedded::EmbeddedHCITransportDriver' does not have any field named 'uart'

[ERROR] In file included from .\bluetooth-gateway\embedded_ble\embedded_BLE_hcidriver.h:36,

                 from .\bluetooth-gateway\embedded_ble\embedded_BLE_hcidriver.cpp:34:

.\bluetooth-gateway\embedded_ble\embedded_BLE_hcitransportdriver.h:126:5: error: 'RawSerial' does not name a type

  126 |     RawSerial uart;

      |     ^~~~~~~~~

.\bluetooth-gateway\embedded_ble\embedded_BLE_hcitransportdriver.h: In constructor 'cypress::embedded::EmbeddedHCITransportDriver::EmbeddedHCITransportDriver(PinName, PinName, PinName, PinName, int, PinName, PinName)':

.\bluetooth-gateway\embedded_ble\embedded_BLE_hcitransportdriver.h:64:5: error: class 'cypress::embedded::EmbeddedHCITransportDriver' does not have any field named 'uart'

   64 |     uart(tx, rx, baud), cts(cts), rts(rts),

      |     ^~~~

[mbed] ERROR: "c:\python37\python.exe" returned error.

       Code: 1

       Path: "C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG"

       Command: "c:\python37\python.exe -u C:\Users\xxxx\Desktop\Cypress\GWmaster\BIG\mbed-os\tools\make.py -t GCC_ARM -m CY8CKIT_062S2_43012 --source . --build .\BUILD\CY8CKIT_062S2_43012\GCC_ARM"

       Tip: You could retry the last command with "-v" flag for verbose output

0 Likes
DheerajK_81
Moderator
Moderator

The code example was created with mbed-os v5.15.0 and when you import the example and run "mbed ls" you will be able to see this information.

pastedImage_0.png

I think you updated the mbed-os library to latest one (v6.x) due to which you see errors. The reason being that with mbed-os v6.0 and above, there was some code cleaning done due to which some APIs are deprecated and hence causing errors.

The code example works upto 5.15.4, so you can do the following:

(1) Navigate to mbed-os library folder

>> cd mbed-os

(2) Update the library to point to 5.15.4 version

>> mbed update mbed-os-5.15.4

(3) Go back to application root directory and compile

>> cd ..

>> mbed compile -t GCC_ARM -m CY8CKIT_062S2_43012

It should now build successfully.

Regards,
Dheeraj

AbBa_4336446
New Contributor II

Hello.


The project did build successfully & .hex file has been generated in BUILD directory.

Thanks for the support.

Unfortunately, got stuck now in flashing & connecting to AWS IoT:

  1. In dap-bulk mode, I am getting [mbed] ERROR: The target board you compiled for is not connected to your system. even when Programming the board using Cypress Programmer is done successfully (below screenshots).

BuildErr-0.JPG

CypProg-0.JPG

     2. i got some issues related to drivers when switching to kp3-daplink mode to use the CY8 kit as mbed board. i have searched the community and found that this is a common issue too. in this link mbed git proposed to uninstall the DAPLink driver & install it again. It did work & i was able to switch between kp3-bulk & kp3-daplink using fw-loader (LED2  on the board changes blinking from continuous to 2 Hz & vice versa). But after installing the driver i did't see the board as usb device drive in my computer explorer in both modes kp3-bulk & kp3-daplink.

cmd-devmngr.JPG

MyPC-0.JPG

consequently, connecting to AWS-IoT fails:

Terat-0.JPG

Any clue to to have a successful cnx to AWS IoT?

Thanks

Karim

0 Likes
DheerajK_81
Moderator
Moderator

Hello Karim,

Glad to hear that you were able to get past the build issue. Answers to your other questions inline.

In dap-bulk mode, I am getting [mbed] ERROR: The target board you compiled for is not connected to your system. even when Programming the board using Cypress Programmer is done successfully (below screenshots).

You will be able to program using mbed-cli only if you are in kp3-daplink mode. You should be able to see a DAPLINK drive enumerating when you are in DAPLink mode that allows you to drag and drop hex files. If you are in BULK mode, you see the error you have mentioned above in mbed-cli. You won't be able to use DAPLink mode to program the device using Cypress Programmer.

Please transition to DAPLink mode by running the following command on fw-loader tool:

>> fw-loader --mode kp3-daplink

If the mode switch was successful, you should be seeing the device under USB as shown below:

daplink.png

After this run the following command on mbed-cli to see if it is able to detect the devices:

>> mbed detect

pastedImage_7.png

If you are able to see this, then you should be able to flash the device successfully using mbed-cli.

consequently, connecting to AWS-IoT fails:

From the console screenshot, I see that it fails to set the root CA certificate. Have you modified the aws_config.h file to add the certificates of your IoT Thing? Please refer to this KBA for more information on how to setup your IoT Things and add the configuration information to your application.

Regards,
Dheeraj

AbBa_4336446
New Contributor II

Hello Dheeraj.

Thanks for your quick reply.

Something weird is going on: in below screenshot i am showing you after switching to kp3-daplink mode using fw-loader, CMSIS DAP 2 driver is shown in the device manager & LED2 is blinking also at 2 Hz, mbed detect is not detecting the board?

is it enough to program it through Cypress Programmer? (board is detected in the programmer only when it is in dap-bulk mode!)

i'd drag n drop the hex file if the board had been detected, but unfortunately, the board is not detected!

what do you suggest?

for AWS,  I did all changes to mbed-app.json, gateway_aws_credentials.cpp & AWS.conf. Do i need to change the header file aws_config.h too?

I will check the link you provided too.

Thanks in advance.

Karim

fw-0devmn-0.JPG

0 Likes
DheerajK_81
Moderator
Moderator

Hello Karim,

Can you run the following command and share what you see?

>> mbedls

Also, please share the version by running the command

>> mbedls --version

pastedImage_1.png

Regarding the credentials, you should configure thing name, thing certificates, thing private key and root certificate in the file gateway_aws_credentials.cpp as mentioned in the Readme.md file of the code example.

Regards,
Dheeraj

AbBa_4336446
New Contributor II

Hello Dheeraj,

below is a screenshot:

mbedls.JPG

Regards,

Karim

0 Likes
DheerajK_81
Moderator
Moderator

Seems like you have incorrect drivers due to which DAPLink doesn't seem to work correctly. Can you please follow the steps mentioned in the Troubleshooting section "CMSIS-DAPv2 interface driver for DAPLink mode isn’t installed properly on Windows 10" of the KitProg3 User Guide: https://www.cypress.com/file/452701/download

Let me know if it works after that

Regards,

Dheeraj

AbBa_4336446
New Contributor II

Hello Dheeraj,

Following the instructions in KitProg3 UG solved it & running mbed compile -t GCC_ARM -m CY8CKIT_062S2_43012 -f was done successful (below screenshot) & the drive (DAPLINK (F:)) is now detected in windows explorer. Glad to see it there . (i hit mbedls & mbedls --version for your reference).

But actually the image BIG.HEX is not shown in the drive . I even tried to "copy-paste" it: after finishing the copy-paste, the drive window closes & reloads again with no image file on it (windows option "shown hidden files" is activated by the way ..).

Any suggestions from your end?

HEX-cpy0.JPG

cpy-1.JPG

Thank you

Karim

0 Likes
DheerajK_81
Moderator
Moderator

Hello Karim,

Glad to hear that your DAPLink is now working. Regarding the drag and drop feature, this is how it is intended to work. When you drop the hex into the DAPLink drive, the window closes, the hex gets flashed on to the device, and once complete, the window comes back up again without the hex file.

In case the programming fails, you will notice a FAIL.TXT generated with the corresponding error.

If successful, please open the serial terminal and check if the code is working. Are you able to connect to AWS IoT after adding your credentials and certificates?

Looking forward to your reply

Regards,
Dheeraj

AbBa_4336446
New Contributor II

Hello Dheeraj. Thanks for the info.

I have added the credentials & certificates. I'll screen-shot it for you below:

1- thing name, thing certificates, thing private key and root certificate in gateway_aws_credentials.cpp:

JSON-0.JPG

awsCred-0.JPG

Credentials taken from AWS IoT as follows:

Capture.JPG

2- MeshController app config. as follows:

AWS.conf added to SD Card of the android device

sdcard-0.png

AWS.conf configuration is as follows (from AWS Cognito):

awsConf-0.png

AWS.conf credentials are taken from:

AWSCognito-0.JPG

3. using the MeshController app:

mesh network & room are formed & working (LED is on/off working on the board)

app-0.pngapp-1.png

nothing happens as shown: app doesn't detect the "mesh-proxy" un-provisioned point

app-2.png

4. Serial Port is showing nothing. Sometimes unrecognized letters are displayed:

teraT-1.JPG

5. despite the above, the AWS IoT console shows there are successful connections but the MeshController doesn't detect "mesh-proxy" as an unprovisioned point:

AWS-0.JPG

AWS-1.JPG

AWS-2.JPG

AWS-3.JPG

AWS-4.JPG

Sorry for this long post, but i wanted to share all the steps in order to make things clear.

What do you propose to move forward?

Thanks in advance

Karim.

0 Likes
PrSo_4744096
New Contributor

Hi Karim, what does your application actually do? Why are you using aws-iot? Is it a part of the code example or you made your custom application containing BT mesh and AwsIot?

0 Likes
AbBa_4336446
New Contributor II

Hello,

The application is a simple BLE Mesh Gateway to AWS IoT. it is part of the gateway code example.

0 Likes
DheerajPK_41
Moderator
Moderator

Hi AbBa_4336446

Ideally in step Step#3, When you try to "Add BT Internet Gateway", on the same pop-up window you should see un-provisioned beacons of Gateway node. You should select the IOT Cloud (AWS Iot) and wait for the un-provisioned advertisement on the same pop-up window, select the device and click "OK".  Could you please try waiting little longer (15-30 seconds)?

Try resetting your device and re-scan from the mesh mobile app.

Could you please check whether advertisements are coming out of the Mesh gateway node after programming (using any sniffer device)?

AWS IoT console show a successful connection, because the WiFi part of the gateway node successfully established a connection with the cloud since the credentials are correct. The BT part of the device should be added to the provisioner thereby to the network during this initial setup so that provisioner can configure the device. After successful setup, you can select "Goto Away" mode and control the mesh network through the cloud.

Thanks,

-Dheeraj

AbBa_4336446
New Contributor II

Hello Dheeraj,

I have tried many combinations (resetting the device, waiting more time ..) with some weird outcomes. After resetting the device & trying to "Add BT Internet Gateway" & after waiting for some time, nothing popped (no devices shown) . But i got " Remove BT Internet Gateway" instead of "Add BT Internet Gateway" and upon choosing "Go to Away" the Meshcontroller app crashes. You might have a look at below screenshots. Removing & re-installing the app, resetting the device (XRES SW1 on the board) didn't solve it, still crashes.

is it possible that it is sth has to do with the Meshcontroller app?

Screenshot_20200811-231537.png

Screenshot_20200811-232015.png

Screenshot_20200811-220908.png

Regards,

Karim

0 Likes
DheerajPK_41
Moderator
Moderator

Hi AbBa_4336446 ,

Could you please try collecting the ADB traces during your experiment, so that we can understand the app crash scenario.

We will also try to reproduce the issue at our end, and get back to you soon.

Thanks,

-Dheeraj

0 Likes
AbBa_4336446
New Contributor II

Hi Dheeraj,

you may find in below the link the bug report for the crash scenario.

WeTransfer

i am looking forward to the end result.

By the way, I am wondering to know why iOS app is lacking many features which, add BIG gateway, is one of them?

are there plans to make the iOS app a "replica" of the MeshController Android app?.

Regards

Karim

0 Likes
DheerajPK_41
Moderator
Moderator

Hi,

Thank you very much. Let us have a look at it.

We can expect the mesh gateway support in IOS app and other platforms as well. Currently we do not have a strict deadline for it.

Thanks,

-Dheeraj

0 Likes
Top labels