Skip to main content
Visitor II
December 10, 2009
Question

I2C bus

  • December 10, 2009
  • 10 replies
  • 2633 views
Posted on December 10, 2009 at 08:42

I2C bus

    This topic has been closed for replies.

    10 replies

    lyeganeh9Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    I work stm8205k6 chip and i need to drive i2c bus

    on standard mode & master mode.

    power supply is 3v and fclk is 4.096 mhz.

    can i2c bus drive with this supply?

    I init GPIOB port to reset value at first

    program.and use pull up resistor on SDA &SCL

    lines but busy bit in the SR3 register always

    set to 1 and not allow to do start condition!

    it clear when swrst bit in CR2 register set

    to 1.i don't know how to do!

    i use ride7 IDE version 7.14

    & Rkit-stm8 version 2.13.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hello,

    the reference stm8205k6 does not exist

    for other questions :

    The I2C can be drived by power supply 3V and Fclk 4Mhz

    I advice you to use 4K7 ohm as value for pull up resistor

    Best Regards

    Bassinux

    lyeganeh9Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi

    thanks for your help

    1.what does means ''reference stm8205k6 doesn't exist ''

    don't i continue to work it and change my chip?

    can i use the stm8207k6 chip?

    2.I used 4K7 ohm resistor on SDA & SCL lines

    but cannot drive i2c bus. my init i2c function

    is in below:

    {

    I2C->CR1 &= ~(0x01); //disable PE

    I2C->FREQR = 0x04;

    I2C->CCRH |= 0x00;

    I2C->CCRL |= 0x14; //fclk 100000hz

    I2C->TRISER |= 0x05;

    I2C->CR1 |= 0x01; //PE enable

    I2C->OARH |= 0x40;

    }

    when send init function, busy bit set to 1.

    then send start condition.but any happend on i2c lines!

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi,

    1) Regarding to the ST web site there is no chip with this name stm8205k6, the correct one is stm8207k6, this is which I mean by Reference.

    2) Concerning your application it seems correct but I suggest to let the PE Enable the Last instruction.

    After sending Start condition verify if SB flag in SR1 is set to 1.

    be carefull in I2C pins mapping, verify if works with the correct package

    Best rergards

    Bassinux

    lyeganeh9Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi

    I checked the SB flag in SR1 register,

    it isnot set to 1 after sending start condition.

    i don't heve stm8s207k6 chip and still work with

    stm8s205k6.is it possible 205k6 chip- i2c module

    have problem?

    thanks and best regards

    lyeganeh9Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi

    11 & 12 pin numbers(PB4 & PB5) are

    SDA & SCL lines of i2c bus in the

    stm8s205k6 chip (32 pins).

    is it ok?

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hello I.yeganeh,

    I suggest you to check the pinout.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    hi, the stm8s205k6 is the current STM8S105K6

    regarding the problem, did you tested your application-hardware with the I2C example on the library? this is the quickest way to know if there is something wrong with your mcu. BTW, try using the 16Mhz configuration at first. I've had some issues when using the clock at 24Mhz

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Is this issue been resolved? I have the exact same behavior with the STM8S105K6. The SR3 Busy bit is always settled even if SCL and SDA pins are high level.

    Thanks,

    Mat

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi All,

    The default I2C pins SCL and SDA in the STM8S105 products are PE1 & PE2

    39 & 38 pin numbers not (PB4 & PB5) .

    To use PB4 and PB5 as I2C pins you should active the remap on the I/O

    Regards

    mozra