I2C

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

I would like to use the i2c bus to talk to a sensor. With arm cortex m3 MCU I am use of setting up i2c like below:

void configure_I2C2(void)

{

  I2C_InitTypeDef I2C_InitStructure;

  //I2C2 peripheral configuration.

  I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; //I2C communications instead of SM bus.

  I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;  //I2C fast mode Tlow/Thigh = 2.

  I2C_InitStructure.I2C_OwnAddress1 = 0x01; //Can be anything when using just one slave device.

  I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; //Acknowledgement is enabled.

  I2C_InitStructure.I2C_AcknowledgedAddress =

  I2C_AcknowledgedAddress_7bit; //Specifies a 7-bit acknowledge address versus 10-bit.

  I2C_InitStructure.I2C_ClockSpeed = 100000; //Clock speed is 400KHz

  /* Enable the I2C2 peripheral */

  I2C_Cmd(I2C2, ENABLE);

  I2C_Init(I2C2, &I2C_InitStructure);

}


With the broadcom unit i do not see any header files with such data or any example?


Is there any good example out there that i can use as a guide?

or anyone who can help?

Regards,

Luke.



0 Likes
1 Solution

You cannot use the WICED SDK (WiFi) API and definitions with the WICED Smart SDK - they are not compatible. You should follow the sample in i2c_temperature_sensor in the WICED Smart SDK.

View solution in original post

0 Likes
5 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I think there's a few useful resources that could help familiarize you with our I2C usage.

1.

Sample app in the SDK: /WICED-Smart-SDK/Apps/i2c_temperature_sensor

2.

WICED™ Smart Hardware Interfaces

There is a code snippet that shows how to initialize I2C in the master role, and how to write, read and use the combo write-then-read transaction using the driver API available in the WICED SDK.

The description of the I2C API is available in WICED-Smart-SDK/Wiced-Smart/cfa/cfa.h

3.

WICED Sense SDK 2.1 Firmware.zip  (the sensors used on the eval  board reside on the I2C bus)

0 Likes
Anonymous
Not applicable

mwf_mmfae

I had a look at the i2c_temperature_sensor I couldn't see any initialization of the i2c?

Yes i have also seen this, it only really shows you how to read and write and thats not the problem at the moment.

0 Likes
Anonymous
Not applicable

Luke,

Are you using the TAG3 as your development board?

Thanks

JT

0 Likes
Anonymous
Not applicable

At the moment I am using BCM92073X_LE_KIT ?

Regards,

Luke.

0 Likes

You cannot use the WICED SDK (WiFi) API and definitions with the WICED Smart SDK - they are not compatible. You should follow the sample in i2c_temperature_sensor in the WICED Smart SDK.

0 Likes