Skip navigation
Home > All Places > WICED Studio Wi-Fi/Combo > WICED Studio Wi-Fi/Combo Forums > Blog > Authors AndrewY_86

Starting in WICED Studio 6.1, the FTDI driver has been changed from using libusb0 to libusbK. When installing WICED Studio 6.1, updated drivers will be installed for WICED evaluation boards. These drivers should take effect automatically, but if they do not, follow the steps below to upgrade the new drivers. This should only affect Windows users.

 

  1. Remove the current drivers
    1. Plug in a WICED device and open the Device Manager
      1.png
    2. Right click on the "WICED USB Serial Port" and uninstall the driver - delete the driver from the system to ensure it does not get automatically reinstalled
      2.png
    3. Repeat for the "WICED USB JTAG Port"
  2. Install the Serial port driver with <WICED Studio Dir>/Drivers/Windows/wiced_uart/DPInst_x64.exe (or DPInst.exe for 32 bit machines)
  3. Install the JTAG Port driver with <WICED Studio Dir>/43xxx_Wi-Fi/tools/drivers/CYW9WCD1EVAL1/InstallDriver.exe
  4. Disconnect and reconnect the WICED device (or click scan for hardware changes in the device manager) and verify the driver installation4.png5.PNG

To evaluate USB operation on the CYW943907AEVAL1F, the following hardware modification / connections need to be made:

  1. USB Bootstrapping
  2. Power Distribution IC
  3. USB Type A Connector
  4. USB Host/Device Select

 

1. USB Bootstrapping

GPIO_9 is a bootstrapping option to choose between HSIC PHY and USB PHY. Pull this pin up with a 4.7k resistor to enable USB PHY and power cycle the board for the bootstrapping to take effect.

USB/HSIC Sel : 0 = HSIC PHY

                          1 = USB PHY

 

2. Power Distribution IC

When operating as a USB host, it is recommended to use a power distribution IC to control power delivery to the USB device. The USB driver will not function if the power distribution IC is not present.

 

Wire up an external power distribution IC and make the necessary changes in the platform.h file. A possible option for the power distribution IC is the TPS2051BDBVR, example application circuit pictured below.

 

In platforms/CYW943907AEVAL1F/platform.h, change

#define WICED_USB_HOST_OVERCURRENT      (WICED_GPIO_NONE) /* No GPIO available, must use controller */

#define WICED_USB_HOST_POWER_ENABLE     (WICED_GPIO_NONE) /* No GPIO available, must use controller */

to

#define WICED_USB_HOST_OVERCURRENT      (WICED_GPIO_1)

#define WICED_USB_HOST_POWER_ENABLE     (WICED_GPIO_2)

 

 

For evaluation purposes, we can bypass the power distribution IC requirement. Doing so will increase the risk of damage to the eval board and the USB device. Proceed with this option only if you accept the risks.

Pull WICED_USB_HOST_POWER_ENABLE pin low through a 10k resistor (based on the pin defined in platform.h)

Pull WICED_USB_HOST_OVERCURRENT pin high through a 4.7k resistor (based on the pin defined in platform.h)

Modify platform.h as mentioned above

 

3. USB Type A Connector

Device Mode

Option 1 - Using the on-board Micro USB receptacle:

Rework R26 and R56, move both resistors from position A-C to position B-C

Note: This disconnects the Micro USB receptacle from the FTDI IC, you will not be able download or view UART traces through the USB port until the resistors are moved back to the A-C position. You can still download to the CYW943907 via JTAG and view UART traces using an external UART-USB adapter.

Visit OpenOCD -WICED for instructions on how to download via JTAG

 

Option 2 - Using a modified USB cable:

Connect a USB cable to the DN/DP signals on the WICED header (J6.43 and J6.44)

Connect USB VCC to VIN_EXT (J9.8) and USB GND to any available ground (J9.6)

Note: This option may affect USB signal integrity

Host Mode

Option 1 - Using the on-board Micro USB receptacle:

The micro USB receptacle on the CYW943907AEVAL1F eval kit is of type Micro-B. This is sufficient if the CYW943907 is acting as a device, but not as a host.

Replace J5 with a Micro USB Type AB receptacle

Rework R26 and R56, move both resistors from position A-C to position B-C (Same as Device Mode Option 1)

Populate R66 with a 0R resistor. The R66 pads can be found on the underside of the eval board, near the uSD card socket

Use a Micro-A male to Type A receptacle adapter such as USB OTG Cable - Female A to Micro A - 4" - CAB-11604 - SparkFun Electronics (Using a Micro-A plug should properly pull USB2_HOST_DEV_SEL high)

If using a power distribution IC, connect the VCC from the USB cable to the 5V output of the IC. Otherwise connect VCC from the USB cable to VIN_EXT (J9.6)

Provide 5V to the DC barrel jack (J8). Make sure the DC power supply is center positive.

 

Option 2 - Using a modified USB cable:

Connect a USB cable to the DN/DP signals on the WICED header (J6.43 and J6.44)

If using a power distribution IC, connect the VCC from the USB cable to the 5V output of the IC. Otherwise connect VCC from the USB cable to VIN_EXT (J9.6)

Connect USB GND to any available ground (J9.6)

Provide 5V to the DC barrel jack (J8). Make sure the DC power supply is center positive.

Note: This option may affect USB signal integrity

4. USB  Host/Device Select

The CYW943907 will operate in 'Host' mode or 'Device' mode depending on the state of USB2_HOST_DEV_SEL.

When operating in 'Host' mode, ensure that USB2_HOST_DEV_SEL is pulled low. If using Option 1 for 'Host' mode, manually setting USB2_HOST_DEV_SEL is not necessary when using a proper adapter.

When operating in 'Device' mode, ensure that USB2_HOST_DEV_SEL is pulled high.

USB2_HOST_DEV_SEL Can be found on J6.21

 

Examples

Examples of USB Host and Device mode applications are available in WICED-Studio 6.1 under snip/usbx_usb_device and snip/usbx_usb_host

To use the graphics library on STM based platforms, download the attached file and replace the files in WICED/platform/STM32FXxx/peripherials/

 

To run the graphics snip apps, add the necessary platforms to the valid platform list in the makefile.

Modify the I2C port in the wiced_i2c_device_t variable if necessary; by default, the 43364 platform has only one I2C port defined.

Connect the display to the evaluation board and download the snip app.

snip.graphics.graphicstest-BCM943364WCD1 download run

 

IMG_5161.JPG

AndrewY_86

Using Aliyun MNS Service

Posted by AndrewY_86 Aug 25, 2016

Aliyun is a cloud service provider that supports a messaging service called Aliyun MNS. Messages and commands are transmitted using RESTful HTTP methods. This blog provides an application and a guide to interfacing with the Aliyun MNS service.

 

Creating an Account:

  1. Create an account at http://intl.aliyun.com( for users outside of China ) by clicking on "Free Trial"
  2. 1.PNG
  3. After verifying your account and adding a payment method (MNS Service is free as of time of writing), log in to http://console.aliyun.com
  4. Click on the gear icon next to the "Products" drop down list and add the "Message Service"
  5. 2.PNG

 

Creating Account Settings:

  1. Click on the newly added "Message Service" tab or navigate to http://mns.console.aliyun.com
  2. The locations listed next to "Queue list" are the locations of the servers for the messaging service. Select one and click on "Get endpoint"
  3. 3.PNG
  4. The format of the public endpoint is (accountid).mns.(region).aliyuncs.com. Make note of the account ID and region
  5. Close the popup window and click on "AccessKeys" on the top menu bar or navigate to https://ak-console.aliyun.com
  6. A "Security Tips" popup will appear, click on continue to proceed
  7. 4.PNG
  8. Click on "Create Access Key", read the API Terms of Use, then "Agree and Create"
  9. Make note of the "Access Key ID" and the "Access Key Secret"

 

Running the Application:

  1. Download and unzip the application to your snip folder
  2. Open aliyun_common.h and fill in the previously noted information. ALIYUN_QUEUE_NAME is the name of the queue you want to create or work on
  3. Configure wifi_config_dct.h for your AP settings
  4. Build and download the application with the make target snip.aliyun_mns-<platform> download run
  5. Open a terminal application to view the output
  6. 5.PNG
  7. You can also send/receive messages on the web console (comment the call to delete queue to verifymessages sent from wiced board)
  8. 6.PNG

Aliyun API reference documents can be found here: https://intl.aliyun.com/help/product/27412.htm?spm=a3c0i.men.a1.3.3adntp

This application will demonstrate how to sent a device-to-cloud message from a WICED device to the Azure IoT Hub over HTTP.

 

Before running the app, you will need to have an Azure IoT Hub set up, and a device provisioned in the account.

Configuring Azure:

  1. Create an account at https://azure.microsoft.com/
  2. 1.PNG
  3. Follow the instructions here (or below) to set up an IoT Hub in your account
    1. Log in to portal.azure.com
    2. On the left sidebar, select New -> Internet of Things -> IoT Hub
    3. Fill in the form and submit to create the IoT Hub. Deployment of the IoT Hub will take a few minutes.
    4. On your console dashboard, open the IoT Hub that was just created.
    5. Click on the key icon to open Shared Access Policies. Open the iothubowner policy and copy the connection string.
  4. 2.1.PNG
    3.PNG
  5. Use the Device Explorer GUI (Windows only) to provision a device. Instructions; Download (scroll down to downloads)
    or
    Use the iothub-explorer command line utility (cross platform) to provision a device. Instructions
    1. Open Device Explorer and paste the connection string into the IoT Hub Connection String field and press update.
    2. Open the Management tab and create a device. Use your own device ID take note or the device ID if the Auto Generate ID option is selected.
  6. Use the Device Explorer or WICED functions to generate a SAS token.
    Using Device ExplorerUsing WICED functions
    1. Select the SAS Token action
    2. Select the desired device and enter a TTL value.
    3. Generate the token

    Psuedocode to generate SAS:

    stringtosign = resourceURI + '\n' + expiryTimeInUTCsecs

    signedstring = base64(hmacsha265(stringtosign,secretkey))

     

    snprintf(SAS,length, "SharedAccessSignature sr=%s&sig=%s&se=",URIencode(resourceURI),URIencode(signedstring),expiryTimeInUTCsec)

  7. 4.PNG5.PNG6.PNG

 

Configuring WICED app:

  1. Download the attached .zip file and extract into apps/snip.
  2. Modify wifi_config_dct.h with credentials for your WiFi AP.
  3. Modify the HUBNAME, DEVICENAME, and SASTOKEN fields with credentials from your Azure IoT Hub.
    The SAS token has the format: SharedAccessSignature sr=<devicehubname>.azure-devices.net%2fdevices%2f<deviceid>&sig=<signature>&se=<expiry>
  4. As of SDK 3.7.0, TLS v1.1 is needed to connect to IIS servers. This workaround is temporary and should be patched in the next SDK release.

    Open the file <WICEDSDK>/WICED/security/BESL/host/WICED/tls_cipher_suites.c
    Change

    tls_version_num_t tls_maximum_version = TLS1_2;

    To

    tls_version_num_t tls_maximum_version = TLS1_1;

  5. Compile and run the app with the target "snip.azure_https_client-<platform> download run"
  6. Open Device Explorer to the "Data" tab and start monitoring for data
    or
    follow the instructions for iothub-explorer to monitor device-to-cloud messages
  7. 7.PNG8.1.PNG


Device Messaging REST API documentation can be found here: Device Messaging REST APIs

The ble_addr_toggle snippet application demonstrates how to change the Bluetooth MAC address. The app starts advertising with the default MAC address on the board. Pressing the user button on the WICED eval board will toggle the MAC address between two predetermined MAC addresses. Please note that the MAC addresses used are for demonstration only and do not follow the specifications for MAC address. To follow the demonstration, you will need two combo WICED based eval boards, or a WICED based eval board and a Bluetooth enabled device to scan for the MAC address.

 

Step by Step Walkthrough:

If using a non-WICED device to scan for your BT MAC address, skip to step 4.

 

  1. Configure your wifi_config_dct.h in the demo.bt_smartbridge folder. The WICED board will need to connect to an access point to display the scan data.
  2. Build and run the demo.bt_smartbridge app on your first WICED device using the target "demo.bt_smartbridge-<PLATFORM> download run".
  3. Disconnect the WICED board or the next steps might be applied to this board instead of the second board.
  4. Download the attached file and unzip the folder into apps/snip.
  5. Build and run the ble_addr_toggle app on your second WICED device using the target "snip.ble_addr_toggle-<PLATFORM> download run".
  6. Reconnect the first WICED board or start your non-WICED device to start scanning to Bluetooth devices.
  7. Start two instances of a terminal program (e.g. teraterm, putty, etc) to view the output from the boards.
  8. Open a web browser and navigate to the SmartBridge Demo Application web page. The IP address can be found on the terminal output from the board running the bt_smartbridge app.
  9. web1.PNG
  10. Connect/reset the board running the ble_addr_toggle app. The board will start advertising with the default MAC address and a device name of "HELLO".
  11. cmd1.PNGweb2.PNG
  12. Press the button on the WICED board (SW2) to change the MAC to the first of the predetermined addresses. This by default is 00:00:00:00:00:00.
    You can uncomment the last line in ble_addr_toggle.mk to inclue the wiced_bt_cfg.h file. This file will override the first predetermined MAC address with the one defined in wiced_bt_cfg.h. The address, by default, is 11:22:33:AA:BB:CC.
    NOTE: The app may seem unresponsive because 10 seconds are allocated to deinitialize and reinitialize the Bluetooth stack.
  13. Press "Rescan" on the webpage to scan and update the list of Bluetooth devices.
  14. wiced_bt_cfg not inlcuded:
    cmd2.PNGweb3.PNG
    wiced_bt_cfg included:
    cmd4.PNG
    web5.PNG
  15. Press the button on the WICED board again to change the MAC address to the second predetermined MAC address. This by default is FF:FF:FF:FF:FF:FF.
  16. Press "Rescan" on the webpage to scan and update the list of Bluetooth devices.
  17. cmd3.PNG
    web4.PNG
  18. Pressing the button further will continue to toggle the MAC address between the two preconfigured addresses.

 

The API call to change the Bluetooth address is wiced_bt_set_local_bdaddr ( wiced_bt_device_address_t )

AndrewY_86

BLE WiFi Introducer

Posted by AndrewY_86 Jul 18, 2016

The BLE WiFi Introducer app shows an example interfacing the BLE and WiFi components on a combo chip. It demonstrates GATT database initialization, DCT configuration, processing read/write requests from a BLE client, and sending data to the client. The BLE WiFi Introducer has two components, an app running on a WICED devices, and an app running on an iOS device.

 

WICED App Functionality:

  • Reads WiFi network configuration from DCT and attempts to connect to the network
  • Upon failure to join the network, BLE GATT server is started to advertise network connection characteristic values
  • When the iOS app triggers the BLE GATT characteristic write event, the network credential values are received. The WICED device will attempt to connect to the network and send the result via a notification message to the iOS device
  • Pressing the user button on the WICED board wipes the WiFi network credentials from the DCT and the system is rebooted

 

iOS App Functionality:

  • Scans for a WICED based device and reads advertising data
  • Connects to the WICED device and allows user to enter network credentials for the currently connected network
  • Writes the network credentials to the corresponding BLE GATT characteristic values
  • Indicates the success or failure state of the WICED device network connection and allows for re-entering credentials upon connection failure

 

Step by step usage guide:

  1. Use an OS X system to install the iOS Demo App (WiFIIntroducer) onto an iOS device. The files are located at <WICED_SDK>/apps/demo/ble_wifi_introducer/peerapps/iOS
  2. Compile and download the ble_wifi_introducer app onto a WICED device using the target "demo.ble_wifi_introducer-<platform> download run"
  3. Open a terminal to view the output. Since WiFi network credentials were not edited in the wifi_config_dct, the connection will fail and the BLE GATT server will start advertising. You should see output similar to the following,
    1.PNG
  4. On the iOS device, connect to the WiFi AP that you want the WICED device to connect to. Open the WiFiIntroducer application and you should be greeted with the following splash screen,
    IMG_3382small.PNGIMG_3370small.PNG
  5. The app will scan until a nearby WICED device is detected. Bring the WICED device close to the iOS device and the following screen will be brought up
    IMG_3385small.PNG
    Note: If the iOS app does not detect the WICED device, kill and reopen the iOS application

  6. Enter the WiFi AP passphrase and press connect. You will be prompted to pair the device. Select "Pair" and a secure LE connection will be made between the iOS device and the WICED device using the ECDH algorithm to generate and exchange the secure keys.
    IMG_3375small.PNG
    Note: If the device has been previously paired, it may be necessary to remove the pairing before the app will run correctly. Do this by going to Settings > Bluetooth. Under My Devices, click the "i" icon next to WiFiInt and select "Forget This Device"

  7. The WiFi network credentials will be sent to the WICED device and the connection result will be pushed back to the iOS device. If the connection fails, press "Try Again" to re-input the passphrase. Upon successful connection, the network credentials will be saved to the DCT.
    IMG_3376small.PNGIMG_3377small.PNGfail.pngsuccess.png
  8. When rebooting the WICED device, since the DCT has configured Network credentials, the BLE GATT server will not be started. You can press the user button on the WICED board to reset the DCT. The device will reboot and the BLE GATT server will start advertising.

Filter Blog

By date:
By tag: