Skip to main content
u23
Associate III
Jan 12, 2017 2:39 PM UTC
Question

STM8S-Discovery I2C problems

Posted on January 12, 2017 at 15:39

I have the problem with I2C comunication.

I programmed two STM8S-Discovery with example firmware available in C:\Users\u.iaquinta\Downloads\en.stsw-stm8069\STM8S_StdPeriph_Lib\Project\STM8S_StdPeriph_Examples\I2C\I2C_TwoBoards\I2C_DataExchange

One discovery is master and the second discovery is slave.

0690X00000605pAQAQ.png

Rp1 and Rp2 is 10 K.

The interrupt I2C not start.

The master firmware is:

void main()

{

   /* system_clock / 1 */

   CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);

  /* I2C Initialize */

  I2C_Init(I2C_SPEED, 0xA0, I2C_DUTYCYCLE_2, I2C_ACK_CURR, I2C_ADDMODE_7BIT, 16);

  /* Enable Buffer and Event Interrupt*/

  I2C_ITConfig((I2C_IT_TypeDef)(I2C_IT_EVT | I2C_IT_BUF) , ENABLE);

  enableInterrupts();

  .......

  .......

 ........

}

Any idea?

Thanks

    This topic has been closed for replies.

    1 reply

    u23
    u23Author
    Associate III
    Jan 18, 2017 9:55 AM UTC
    Posted on January 18, 2017 at 10:55

    I attached the project solution.

    In the master folder there is the firmware for master device, and in the slave folder there is the firmware for slave device.

    Push the button on the STM8S-Discovery master and wait until the LED1 blinks, else there is the comunication problem.

    ________________

    Attachments :

    STM8S003_I2C_Example.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyzO&d=%2Fa%2F0X0000000bEy%2FEmklgAGT_WIePAalz_T8a35Rj4B4w31sa3qCJ54xkZM&asPdf=false