Reply
Posts: 5
Registered: ‎09-10-2017
Accepted Solution

I want to use I2C master mode on EFM8LB1 Development tools

After I followed the user guide's steps, I can't find any example code for how to programming.

I want to use this board as a I2C master, but the I2C pins on board are only for slave mode, how to define another pins as I2C master? Is there any example code for how to use I2C master mode?

I will use this board's I2C connect to an IC, and send data to IC's register.

Thank for your patience.  

Posts: 2,326
Registered: ‎10-14-2014

Re: I want to use I2C master mode on EFM8LB1 Development tools

which peripheral you are using. the
i2c slave could only work as slave, if you need i2c master, you need the SMBUS peripheral. you could see the SMBUS (I2C) master example in the Simplicity Studio folder.
WeiguoLu
Posts: 5
Registered: ‎09-10-2017

Re: I want to use I2C master mode on EFM8LB1 Development tools

I will only connect the development board to Semtech GN2106. It's laser driver IC, and this IC only have I2C port, so I don't think SMBus will work, I need to know how to define another pins on the development board as I2C master, will this method working? 

Posts: 2,326
Registered: ‎10-14-2014

Re: I want to use I2C master mode on EFM8LB1 Development tools

You could see below sentence in the datasheet and reference manual for the SMBus peripheral in EFM8LB1 part

----------------------

The SMBus is compliant with the System Management Bus Specification,
version 1.1, and compatible with the I2C serial bus.

--------------------

WeiguoLu
Posts: 3,100
Registered: ‎02-07-2002

Re: I want to use I2C master mode on EFM8LB1 Development tools

In short, SMBus is I2C with a defined timeout for all operations.

Posts: 2,326
Registered: ‎10-14-2014

Re: I want to use I2C master mode on EFM8LB1 Development tools

Posts: 5
Registered: ‎09-10-2017

Re: I want to use I2C master mode on EFM8LB1 Development tools

I have learned that SMBus max frequency is 100KHz, but my IC need 400KHz I2C, and I saw reference manual for the SMBus peripheral in EFM8LB1 part, it tells me that its SMBus's frequency can be 400 KHz, is that true?

Now, I am trying to follow the steps from here: http://community.silabs.com/t5/8-bit-MCU/I2C-library-for-EFM8/td-p/186660 . I follow the steps posted by  jaycarlson .

At last step, I can't find2c_0.h and i2c_0.c file in inc and src folders.Is there any possible error I can check? Is this walkthrough help me to build an example for my device?    

Thank for your patience. 

Posts: 23
Registered: ‎07-26-2017

Re: I want to use I2C master mode on EFM8LB1 Development tools

I think you are overthinking some of this. The silicon supports I2C and SMBus and 400kHz clocking, you just need to configure everything correctly for your application. I suspect that your slave peripheral will also run much slower than 400kHz, that's just its maximum clock rate. The PCB should not restrict you in your decision of who is master and who is slave, all you need are the two bus connections and proper pull up resistors.