Skip navigation
Home > All Places > WICED Studio Wi-Fi/Combo > WICED Studio Wi-Fi/Combo Forums > Blog > 2016 > March
2016

This snippet application interfaces the Infrared contact-less temperature sensor (TMP007) module from Adafruit (https://www.adafruit.com/products/2023) using WICED SDK.

 

- The snippet application sets up the I2C device interface and probes the device.

- Then all register values are read and pushed to the serial terminal interface.

- To show writing to the I2C device, object high temperature alarm register is updated with a given value then the same register is register back.

- Every 1 second period, I2C device die and object temperature values are read from corresponding registers and printed on the serial terminal.

 

For BCM943362WCD4 evaluation platform update the platform.c and platform.h files for I2C device.

 

Update the .../platforms/BCM943362WCD4/platform.c file by adding the following changes to the file:

 

const platform_i2c_t platform_i2c_peripherals[] =
{
    [WICED_I2C_1] =
    {
        .port                    = I2C1,
        .pin_scl                 = &platform_gpio_pins[WICED_GPIO_11],
        .pin_sda                 = &platform_gpio_pins[WICED_GPIO_12],
        .peripheral_clock_reg    = RCC_APB1Periph_I2C1,
        .tx_dma                  = DMA1,
        .tx_dma_peripheral_clock = RCC_AHB1Periph_DMA1,
        .tx_dma_stream           = DMA1_Stream7,
        .rx_dma_stream           = DMA1_Stream0,
        .tx_dma_stream_id        = 7,
        .rx_dma_stream_id        = 0,
        .tx_dma_channel          = DMA_Channel_1,
        .rx_dma_channel          = DMA_Channel_1,
        .gpio_af                 = GPIO_AF_I2C1
    }
};

 

For platforms/BCM943362WCD4/platform.h file add the WICED_I2C_1 to the wiced_i2c_t as below:

 

typedef enum
{
    WICED_I2C_1,
    WICED_I2C_MAX,
    WICED_I2C_32BIT = 0x7FFFFFFF,
} wiced_i2c_t;

 

The platform files for BCM943362WCD4 are attached.

 

NOTE: On BCM943362WCD4 evaluation board, two 4.7K pull up resistors are needs on each of the SCL and SDA connections.

 

For BCM943341WCD1, the I2C device of WICED_I2C_1 is already defined in the platform files. Since the SCL and SDA pull resistors are already populated on the BCM943341WCD1 evaluation board, no hardware related modifications are needed.

 

Your application specific platform files can be updated as above to interface the chosen I2C device to the WICED SDK 3.x platforms.

 

1. To run the test, connect the I2C device to the evaluation board as following:

 

Connection setup for I2C device to STM32F4xx based WICED evaluation board

I2C-Device   BCM943341WCD1 J7 Header

      -                    J7-27

     +                    J7-28

     SDA               J7-26

     SCL               J7-25

 

Connection setup for I2C device to STM32F2xx based WICED evaluation board

I2C-Device   BCM943362WCD4 J7 Header

     -                         J7-2

     +                        J7-1

     SDA                   J7-7

     SCL                   J7-6

 

2. Unzip and copy the attached files to the WICED SDK-3.x version.

For I2C Temp application snippet:

     Copy the content of the i2c_temp.7z source to .../apps/snip/i2c_temp

 

For BCM943362WCD4:

     Copy the content of the BCM943362WCD4.7z source to .../platforms/BCM943362WCD4

 

For BCM943341WCD1:

     Default platform files could be used.

 

3. To build, download and run the application below

For STM32F4xx MCU BCM943341WCD1:

     snip.i2c_temp-BCM943341WCD1 download run

 

For STM32F2xx MCU BCM943362WCD4:

     snip.i2c_temp-BCM943362WCD4 download run

 

Picture of setup:

IMG_0966.JPG

 

Serial terminal log:

13:15:39.028: Starting WICED v3.3.DEVELOPMENT
13:15:39.028: Platform BCM943341WCD1 initialised
13:15:39.028: Started ThreadX v5.6
13:15:39.028: Initialising NetX_Duo v5.7_sp2
13:15:39.028: Creating Packet pools
13:15:39.028: WWD SDIO interface initialised
13:15:39.348: WLAN MAC Address : 6C:AD:F8:F0:E8:F1
13:15:39.364: WLAN Firmware    : wl0: Nov 25 2015 14:01:39 version 6.49.2 (r602357) FWID 01-1302682f
13:15:39.364: I2C LED Interface Application.
13:15:39.396: Probe successful on address 64!
13:15:39.396: Manufacturer ID: 0x5449
13:15:39.396: Device ID: 0x0078
13:15:39.396: Voltage: -27.6562 uV
13:15:39.396: Die Temp: 25.22C
13:15:39.396: Object Temp: 25.12C
13:15:39.412: Alarms(L/H): Die -256.00C / 255.50C, Object -256.00C / 198.50C
13:15:39.412: Write: 6340 Read: 6340
13:15:39.412: Write: 198.50C Read: 198.50C
13:15:39.412: Die Temp: 25.22C (78.39F) - Object Temp: 25.12C (77.22F)
13:15:39.428: Die Temp: 25.19C (78.34F) - Object Temp: 25.19C (77.34F)
13:15:40.420: Die Temp: 25.19C (78.34F) - Object Temp: 25.34C (77.62F)
13:15:41.428: Die Temp: 25.19C (78.34F) - Object Temp: 26.38C (79.47F)
13:15:42.436: Die Temp: 25.19C (78.34F) - Object Temp: 28.12C (82.62F)
13:15:43.444: Die Temp: 25.19C (78.34F) - Object Temp: 30.03C (86.06F)
13:15:44.451: Die Temp: 25.22C (78.39F) - Object Temp: 32.50C (90.50F)
13:15:45.459: Die Temp: 25.22C (78.39F) - Object Temp: 34.25C (93.65F)
13:15:46.451: Die Temp: 25.22C (78.39F) - Object Temp: 33.12C (91.62F)
13:15:47.460: Die Temp: 25.22C (78.39F) - Object Temp: 32.47C (90.44F)
13:15:48.468: Die Temp: 25.22C (78.39F) - Object Temp: 33.06C (91.51F)
13:15:49.476: Die Temp: 25.22C (78.39F) - Object Temp: 33.91C (93.03F)
13:15:50.484: Die Temp: 25.22C (78.39F) - Object Temp: 34.59C (94.27F)
13:15:51.476: Die Temp: 25.22C (78.39F) - Object Temp: 34.97C (94.94F)
13:15:52.484: Die Temp: 25.25C (78.45F) - Object Temp: 35.38C (95.68F)
13:15:53.492: Die Temp: 25.25C (78.45F) - Object Temp: 35.06C (95.11F)
13:15:54.500: Die Temp: 25.25C (78.45F) - Object Temp: 33.53C (92.36F)
13:15:55.507: Die Temp: 25.22C (78.39F) - Object Temp: 32.19C (89.94F)
13:15:56.515: Die Temp: 25.22C (78.39F) - Object Temp: 30.94C (87.69F)
13:15:57.508: Die Temp: 25.22C (78.39F) - Object Temp: 31.34C (88.42F)
13:15:58.516: Die Temp: 25.28C (78.51F) - Object Temp: 34.59C (94.27F)
13:15:59.524: Die Temp: 25.34C (78.62F) - Object Temp: 38.72C (101.69F)
13:16:00.532: Die Temp: 25.38C (78.68F) - Object Temp: 41.81C (107.26F)
13:16:01.540: Die Temp: 25.44C (78.79F) - Object Temp: 44.59C (112.27F)
13:16:02.532: Die Temp: 25.50C (78.90F) - Object Temp: 47.03C (116.66F)
13:16:03.540: Die Temp: 25.53C (78.96F) - Object Temp: 48.81C (119.86F)
13:16:04.548: Die Temp: 25.59C (79.07F) - Object Temp: 49.91C (121.83F)
13:16:05.556: Die Temp: 25.62C (79.12F) - Object Temp: 50.91C (123.63F)
13:16:06.563: Die Temp: 25.66C (79.18F) - Object Temp: 51.44C (124.59F)
13:16:07.557: Die Temp: 25.72C (79.29F) - Object Temp: 52.41C (126.33F)
13:16:08.564: Die Temp: 25.75C (79.35F) - Object Temp: 52.94C (127.29F)
13:16:09.572: Die Temp: 25.81C (79.46F) - Object Temp: 54.03C (129.26F)
13:16:10.580: Die Temp: 25.88C (79.58F) - Object Temp: 54.62C (130.32F)
13:16:11.588: Die Temp: 25.91C (79.63F) - Object Temp: 55.19C (131.34F)
13:16:12.596: Die Temp: 25.94C (79.69F) - Object Temp: 55.84C (132.52F)
13:16:13.588: Die Temp: 26.00C (79.80F) - Object Temp: 56.59C (133.87F)
13:16:14.596: Die Temp: 26.06C (79.91F) - Object Temp: 57.34C (135.22F)
13:16:15.604: Die Temp: 26.09C (79.97F) - Object Temp: 58.06C (136.51F)
13:16:16.612: Die Temp: 26.16C (80.08F) - Object Temp: 58.78C (137.81F)
13:16:17.621: Die Temp: 26.22C (80.19F) - Object Temp: 59.47C (139.04F)
13:16:18.613: Die Temp: 26.28C (80.31F) - Object Temp: 60.03C (140.06F)
13:16:19.620: Die Temp: 26.34C (80.42F) - Object Temp: 60.38C (140.68F)
13:16:20.628: Die Temp: 26.41C (80.53F) - Object Temp: 60.84C (141.52F)
13:16:21.636: Die Temp: 26.50C (80.70F) - Object Temp: 60.62C (141.12F)
13:16:22.644: Die Temp: 26.59C (80.87F) - Object Temp: 60.34C (140.62F)
13:16:23.653: Die Temp: 26.69C (81.04F) - Object Temp: 60.22C (140.39F)
13:16:24.644: Die Temp: 26.75C (81.15F) - Object Temp: 60.56C (141.01F)
13:16:25.652: Die Temp: 26.81C (81.26F) - Object Temp: 58.62C (137.53F)
13:16:26.660: Die Temp: 26.78C (81.21F) - Object Temp: 53.47C (128.24F)
13:16:27.669: Die Temp: 26.78C (81.21F) - Object Temp: 48.19C (118.74F)
13:16:28.677: Die Temp: 26.81C (81.26F) - Object Temp: 44.44C (111.99F)
13:16:29.669: Die Temp: 26.81C (81.26F) - Object Temp: 41.47C (106.64F)
13:16:30.677: Die Temp: 26.81C (81.26F) - Object Temp: 39.09C (102.37F)
13:16:31.684: Die Temp: 26.84C (81.32F) - Object Temp: 37.34C (99.22F)
13:16:32.692: Die Temp: 26.84C (81.32F) - Object Temp: 36.00C (96.80F)
13:16:33.700: Die Temp: 26.84C (81.32F) - Object Temp: 34.84C (94.72F)
13:16:34.692: Die Temp: 26.84C (81.32F) - Object Temp: 34.00C (93.20F)
13:16:35.700: Die Temp: 26.84C (81.32F) - Object Temp: 33.25C (91.85F)
13:16:36.708: Die Temp: 26.84C (81.32F) - Object Temp: 32.84C (91.12F)
13:16:37.717: Die Temp: 26.84C (81.32F) - Object Temp: 32.59C (90.67F)

WICED connect to quickstart

 

Download and install the latest version of WICED SDK, available for Windows, Mac and Linux. To setup on Windows platform, follow the steps present in this link.

 

To connect to the Quickstart Service, follow these steps:

 

Open the WICED SDK eclipse base IDE
Under demo->IBM , place the bluemix_iot quick start project

 

The MQTT library implementation is included in the libraries and can be found under protocol section

WICED SDK setup :

Edit the wifi_config_dct.h under bluemix_iot as per your accesspoint credentials

 

 

In the make target window add the following new target ( for this example we have used BCM94343W hardware)

And click on build target for this make target. On successfull build and download the application to hardware, open any serial port communication like TeraTerm or Putty to see the hardware console output.

The below console message can be viewed

Enter the deviceId that you see in the console log, in the quickstart website to visualize the data points as shown below

IBM Internet of Things Foundation

 

At this step, we have successfully sent the sensor data to IBM Watson IoT Platform Quickstart service using the WICED hardware

The WiFi module power and reset pins are controlled by the host MCU.

 

BCM943362WCD4:

 

For BCM943362WCD4 evaluation board, the power and reset pins are controlled by the following definitions in .../platforms/BCM943362WCD4/platform.c

 

[WWD_PIN_POWER] = { GPIOB,  2 },
[WWD_PIN_RESET] = { GPIOB,  5 },

 

The "WWD_PIN_POWER" definition in WICED SDK controls the host MCU (STM32F205) PB2 pin. The host MCU PB2 pin controls the VBAT (power) on the WiFi module. Wifi module power completely turned of by the hos MCU to save energy if the WiFi module is not in use at all.

 

The "WWD_PIN_RESET" definition in Wiced SDK controls the host MCU PB5 pin. The host MCU PB5 pin controls the WLAN_RESET_L (reset) on the WiFi module.
Setting this pin logic level to low causes WiFi module reset.

 

 

BCM943341WCD1:

 

For BCM943341WCD1 the reset pin is controlled by the following definition in .../platforms/BCM943341WCD1/platform.c

Although it is named as WWD_PIN_POWER but actually controls the reset pin of the BCM943341 SiP module. Reason is being the logic level to reset the BCM943341 SiP module is inverted compared to the other SiP modules.

 

[WWD_PIN_POWER] = { GPIOB,  2 },

 

The "WWD_PIN_POWER" definition in WICED SDK controls the host MCU (STM32F417IGH6) PB2 pin. This pin from the host MCU controls the WL_REG_ON (reset) on the WiFi module.  Setting this pin logic level to high causes WiFi module reset.

 

 

Unlike on BCM943362WCD4 evaluation board, on BCM943341WCD1 evaluation board the WiFi module power (VBAT) is not controlled by the host MCU. The WiFi module VBAT pin directly connected to the 3.3V via bypass capacitors.

 

If needed, the similar power switching circuit from BCM943362WCD4 evaluation board could be used on BCM943341 module based designs as well.

 

.

Filter Blog

By date:
By tag: