Page 1 of 1

I2C on STM32F051

Posted: Mon Feb 11, 2013 12:23 pm
by goeck
Hey everyone,

I just started ARM code development coming from AVR ATMegas. After a short discussion with CooCox CoIDE which is kind of nice to me, I went over to using a RTOS and landed happily at ChibiOS ;)
Now, I have a STM32F0-Discovery which I actually want to use and a STM32F4-Discovery which I ordered as performance backup for later improvements. What I already accomplished is compiling the demo app using the GNU-Tools-for-ARM-embeded-compiler and putting the code on the device using openOCD in ChibiStudio.
Furthermore I need to use I2C heavily so I activated it in halconf.h, now the compiler gives me

Code: Select all

i2c_lld.h: No such file or directory
because its included from os/hal/include/i2c.h. I can't help myself here. Is the driver implemented? I am using the latest code from SVN (Rev 5150).

Here I saw that here in the other thread: http://forum.chibios.org/phpbb/viewtopic.php?f=3&t=333&start=30%20 there is still something going on with the new peripherals on F0 and F3s... Is this work finished or do I have to use the F4 then?
Also here I see http://forum.chibios.org/phpbb/viewtopic.php?f=3&t=822 we have brand new implementation work done on this topic, so it's too soon, to use this driver?
Thanks for the support, guys!

Cheers
Greetings from Germany

Re: I2C on STM32F051

Posted: Mon Feb 11, 2013 1:23 pm
by Giovanni
Hi,

The I2C driver is not yet officially available for the STM32F0 however there is a prototype submitted by doceme here: viewtopic.php?f=3&t=822

Note that the patch is associated to a ticket and you will have to apply it yourself: https://sourceforge.net/tracker/?func=d ... tid=995492

Giovanni

Re: I2C on STM32F051

Posted: Mon Feb 11, 2013 1:58 pm
by goeck
Hey Giovanni,
Thanks for the quick reply. I found that patch and tried to apply it, however, it would just not work out... TortoiseSVN does only half on the patch and then tries to patch files that are just not existent, builds new file structures...Maybe I have to work on that isse "applying patches"... :-(

When will the driver made available to the trunk?

Keept it up!
Cheers

EDIT:
Got the patch applied using TortoiseMerge using this hint: http://stackoverflow.com/questions/517257/how-do-i-apply-a-diff-patch-on-windows.
Of course, had to activate it in halconf.h and add a I2C driver section to mcuconf.h, where I just copied the UART section and replaced UART with I2C, only used one define though:

Code: Select all

/*
 * I2C driver system settings.
 */
#define STM32_I2C_USE_I2C1                  TRUE

The rest was not bneeded and gets set to default values in i2c_lld.h.
I got it compiled but didn't actually use it yet. To be continiued another working day as today we have a holiday here... carnival.