7 years, 4 months ago.

I2C General Call on STM32F303K8

Hello,

I use a STM Nucleo with the F303K8.

Now it should do a I2C connection as a slave. For this I used the I2CSlave Simple I2C responder example.

#include <mbed.h>

I2CSlave slave(p9, p10);

int main() {
   char buf[10];
   char msg[] = "Slave!";

   slave.address(0xA0);
   while (1) {
       int i = slave.receive();
       switch (i) {
           case I2CSlave::ReadAddressed:
               slave.write(msg, strlen(msg) + 1); // Includes null char
               break;
           case I2CSlave::WriteGeneral:
               slave.read(buf, 10);
               printf("Read G: %s\n", buf);
               break;
           case I2CSlave::WriteAddressed:
               slave.read(buf, 10);
               printf("Read A: %s\n", buf);
               break;
       }
       for(int i = 0; i < 10; i++) buf[i] = 0;    // Clear buffer
   }
}

My Master send data to my slave adresse - everything is working.

When the Master do a data transfer to general call adress (0x00) then nothing happens.

Now i take a look to the Reference manual. There I can see: "The General Call address is enabled by setting the GCEN bit in the I2C_CR1 register."

So I set this with;

I2C1->CR1 |= I2C_CR1_GCEN;

Now I get an response to the General call transfer. But the same as an direct adresses transfer. I could not determine adressed and general call.

Be the first to answer this question.