This application snippet demonstrates the I2C device interface using WICED SDK-3.x.

 

The sample application sets up the I2C device interface and send commands to the I2C device then receives replies, if any, from the I2C device.

 

For this example "BlinkM - I2C Controlled RGB LED" (www.sparkfun.com/products/8579) I2C device is used to test the code. It could be any other I2C device chosen for your platform as well.

 

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.

 

For BCM943341WCD1 I2C device of WICED_I2C_1 is already defined in the platform files. For completeness the platform files are attached. The I2C device of WICED_I2C_1 for BCM943362WCD1 is already defined in the platform files. For completeness the platform files are attached.

 

 

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

 

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 LED application snippet:

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

 

For BCM943362WCD4:

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

 

For BCM943341WCD1:

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

 

3. To build, download and run the application below

For STM32F4xx MCU BCM943341WCD1:

     snip.i2c_led-BCM943341WCD1-debug download run

 

For STM32F2xx MCU BCM943362WCD4:

     snip.i2c_led-BCM943362WCD4-debug download run

 

 

This is the modified STM32F4xx MCU BCM943341WCD1 WICED evaluation board:

I2C.BCM43341.JPG

NOTE: There are no hardware nor platform file changes needed on the BCM943341WCD1 evaluation because the already defined I2C lines ,with pull-up resistors, are used.

 

This is the modified STM32F2xx MCU BCM943362WCD4 Wiced evaluation board:

IMG_0486.JPG

NOTE: On BCM943362WCD4 evaluation board, SDA and SCL signals needs 4.7K pull up resistors.