3 years, 2 months ago.

i2c or PA_6, PA_5 pins configuration bug in NUCLEO_F031K6

Hi, guys!

The problem exists in NUCLEO_F031K6. I am using mbed-dev. If you try to work with i2c on PB_7, PB_6 pin everything OK. But if you try to declare DigitalOut on PA_6 (or PA_5) it will broke i2c (return from i2c.write & i2c.read with error). I do not know how pins PA_6 and PB_7, PB_6 is connected in mbed configuration. Please help to fix or give some advice where to search the problem roots.

bug reproduce

#include "mbed.h"

I2C i2c(PB_7, PB_6);

//if you declare DigitalOut on PA_6 pin read/write i2c operation will fail.

DigitalOut tryToBrokeI2c(PA_6);

 int main() { 
  //!!! use your code to work with your i2c device
  int address = 0x62;
  char data[2];
  data[0] = 0;
   data[1] = 1; 
   if(i2c.write(address, data, 2))
      printf("i2c write fail");
   if(i2c.read(address, data, 2))
      printf("i2c read fail");

1 Answer

3 years, 2 months ago.

Of course check the manual and schematic http://www.st.com/content/ccc/resource/technical/document/user_manual/e3/0e/88/05/e8/74/43/a0/DM00231744.pdf/files/DM00231744.pdf/jcr:content/translations/en.DM00231744.pdf

See pages 20 and 21. It appears PA5 and PA6 cannot be used as a digital output unless you remove bridge SB16 and SB18. Page 22 suggests you might have more luck with say, PA_4. There are no special notes for that pin.

Accepted Answer

I really appreciated your help. Thank you very much!

posted by pressurecontrol pressurecontrol 08 Jun 2017