The alternatives
The amount of tools and SDKs that can be used to program the PSOC6 is quite overwhelming, and choosing the right ones for a task is not simple, specially because the information to make the right decision is all scattered in the net. After some quick (and likely unreliable) research I found that Cypress provides 3 development tools:
- PSOC Creator
- Wiced
- Modustoolbox
PSOC Creator is the oldest and most mature product, and supports visual programming to set up pins, UDB blocks (programmable logic), clocks, etc. The tool just works and from what I've read in Cypress's forums, everyone loves it. The main shortcoming of the tool is that it does not support WiFi or Bluetooth.
Wiced was apparently created to add WiFi and Bluetooth support (I don't understand why WiFi and Bluetooth could not be added to PSOC Creator). Wiced apparently doesn't support UDB, and from what I've read, not many are happy with the tool.
The newest tool is Modustoolbox, and is based on Eclipse. Modustoolbox supports WiFi and Bluetooth, and comes with some visual programming slightly reminiscent of PSOC Creator. It still doesn't support UDB blocks though, and apparently not that many are happy with the tool too.
As of ways to connect to the MQTT AWS services, there appear to be 3 alternatives:
- Wiced RTOS
- Amazon FreeRTOS
- Mbed
I did not consider Wiced at all, since it appears to be the least popular alternative. Then between Amazon FreeRTOS and Mbed, Amazon FreeRTOS looked like a better alternative, because it is specially tailored to operate with AWS, and supports AWS over the air (OTA) updates.
Amazon FreeRTOS
I downloaded Modustoolbox and carefully followed Cypress's PDF instructions on how to download Amazon's FreeRTOS and compile its AWS demo. Instructions worked fine, the demo connected to an AWS MQTT broker and posted a few messages there before disconnecting. But then I found that after restarting the board it continuously failed to reconnect to the access point, and the virtual serial port log looked all broken apparently because of racing conditions. Here is a sample:
WLAN MAC Address : CC:C0:79:A7:03:56
WLAN Firmware : wl0: Sep 5 2019 23:24:33 version 7.45.98.92 (r722362 CY) FWID 01-f7128517
WLAN CLM : API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2019-09-05 23:10:00
WHD VERSION : v1.70.0 : v1.70.0 : GCC 7.2 : 2019-12-02 04:14:53 -0600
.1 8308 [Tmr Svc] Wi-Fi failed to connect to AP Infinity-2.4G.
2 8308 [Tmr Svc] Connect to SoftAP Enter SSID for Soft AP using password Enter Password for Soft AP3 8327 [Tmr Svc] Wi-Fi configuration successful.
4 10111 [Tmr Svc] Write certificate...
5 10756 [Tmr Svc] Write certificate...
6 10977 [Tmr Svc] Warning: no persistent storage is available for the JITP certificate. The cerWLAN MAC Adtifi7 10978 dress : CE:[iot_threa] C0:79:A7:03[INFO ][DEMO:56
][lu] ---------STARTING DEMO--WLAN Firmwar-------
.e : wl0: 8 10980 [ioSep 5 2019t_threa] [IN 23:24:33 vFO ][INIT][lersion 7.45u] SDK succe.98.92 (r72ssfully init2362 CY) FWialized.
ID 01-f7128517
WLAN CLM : API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2019-09-05 23:10:00
WHD VERSION : v1.70.0 : v1.70.0 : GCC 7.2 : 2019-12-02 04:14:53 -0600
Function whd_wifi_set_supplicant_key_timeout failed at line 535 checkres = 2007
Function whd_wifi_active_join_init failed at line 1004 checkres = 2007
Function whd_wifi_set_supplicant_key_timeout failed at line 535 checkres = 2007
Function whd_wifi_active_join_init failed at line 1004 checkres = 2007
Function whd_wifi_set_supplicant_key_timeout failed at line 535 checkres = 2007
Function whd_wifi_active_join_init failed at line 1004 checkres = 2007
These problems gave me a bad feeling, so I decided to give Mbed a try.
Mbed
I found a great Mbed tutorial at Allan Hawse's page: IoT Design with Cypress PSoC 6 MCUs and Wi-Fi/Bluetooth using Arm
Mbed
, that begins with the basics to build an AWS MQTT client that sends the boards temperature. I downloaded the finished example and it just worked, so I thought that using the code as template would make coding a similar program a walk in the park.
After reading the whole tutorial I began learning about Mbed from the official documentation. The OS looked very neat, very high level and object oriented C++ based. Just like Allan Hawse, I decided to use Mbed Studio, an IDE with a Visual Studio Code feeling.
It didn't took long before problems start to pop up. Mbed Studio complained about not being able to flash the firmware except through copying the file to the virtual device, so in my attempt to fix the issue I installed: Windows serial configuration. This broke my drivers, and Mbed Studio could not recognized the board anymore. After several days of online searching and attempting different approaches I finally managed to fix the drivers.
Top Comments