Page 1 of 1

Problem with changing I2C speed or dutycycle

Posted: Tue Jul 15, 2014 4:43 pm
by fuga
hi
I'm testing testhal, I2C example on STM32F4-Discovery.
I've noticed that in this example board.h is NONSTANDARD_STM32F4_BARTHESS1 and not ST_STM32F4_DISCOVERY.
When I've changed board.h to DISCOVERY, I2CD2 was not working. Then I realized that GPIOB_CLK_IN, GPIOB_SDA are connected to (PIN10,PIN9), while according to the datasheet it should be connected as follow: GPIOB_CLK_IN, GPIOB_SDA (PIN10,PIN11). BTW, on NONSTANDARD_STM32F4_BARTHESS1 I2CD2 are set according to the datasheet - please note.
my problem now is that I cannot change I2C speed or dutycycle: when I change default I2CConfig values: 400KHz or FAST_DUTY_CYCLE_2 I don't get any I2C output signal (I'm checking with both scope and logic analyzer).
any idea? thanks

Re: Problem with changing I2C speed or dutycycle

Posted: Tue Jul 15, 2014 5:32 pm
by Giovanni
I cannot test that scenario, are you sure you are specifying valid values? there are restrictions according to the Reference Manual.

Giovanni

Re: Problem with changing I2C speed or dutycycle

Posted: Tue Jul 15, 2014 6:23 pm
by steved
I'm using I2C no problem on a Discovery F4 with the following configuration:

Code: Select all

static I2CConfig i2cfg1 = {
     OPMODE_I2C,
     100000,
     STD_DUTY_CYCLE
};

Re: Problem with changing I2C speed or dutycycle

Posted: Wed Jul 16, 2014 7:29 am
by fuga
Thanks a lot for your quick reply...
from any reason this is the only configuration that is working for me:

Code: Select all

static const I2CConfig i2cfg2 = {
    OPMODE_I2C,
    400000,
    FAST_DUTY_CYCLE_2,
};


any chnge in speed or dutycycle is not working. same resaults on I2CD1 or I2CD2...
while testing I2C with my own code, without ChibiOs I'm getting 100KHz I2C.

Re: Problem with changing I2C speed or dutycycle

Posted: Wed Jul 16, 2014 7:41 am
by Giovanni
Are I/Os programmed correcty?

Giovanni

Re: Problem with changing I2C speed or dutycycle

Posted: Thu Jul 17, 2014 6:06 am
by fuga
hi,

I2C I/O settings is as follow:

Code: Select all

  palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN);   /* SCL */
  palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN);   /* SDA */


After some more speed & duty-cycle combination checking, the followings are working:
400kKHz+FAST_DUTY_CYCLE_2, 100KHz+STD_DUTY_CYCLE - WORKING
400kKHz+STD_DUTY_CYCLE, 100KHz+FAST_DUTY_CYCLE_2 - NOT WORKING

For me it's OK now, but it would be nice to know if others see the same results and to understand why.

Thanks for the help!