Page 3 of 6

Re: [TODO] I2C driver for STM32F0

Posted: Wed Mar 20, 2013 2:37 pm
by steved
Have a look in the platform.mk file for the STM32F0 - the I2C line is entered twice.

Re: [TODO] I2C driver for STM32F0

Posted: Wed Mar 20, 2013 2:44 pm
by Giovanni
Hi,

The I2C driver is now included in the standard makefiles, perhaps you already included it in your project? if so it would be linked twice and the symbols conflict.

Giovanni

Re: [TODO] I2C driver for STM32F0

Posted: Thu Mar 21, 2013 8:41 am
by goeck
Oh, hey, thanks for the vast reply. And indeed, the platform.mk (STM32F0xx) listed the same I2C low level driver twice. Comenting out the second mention solved everything. Now, why is it, that it comes twice? Should be in trunk then still, right?
... Ah I see, trunk in SVN version 5476 doesn't list it twice anymore. Alrighty then..let's go :-)

Thanks for the help.
Keep it up!
Stefan

Re: [TODO] I2C driver for STM32F0

Posted: Mon Apr 01, 2013 5:21 pm
by Giovanni
Hi,

I tested the driver on STM32F37x and found several issues, for example a NACK because a wrong address didn't trigger any interrupt, there was also another DMA-related problem causing a strange behavior.

I think it is OK now, could somebody confirm on the STM32F0xx and STM32F30x?

Probably it could still be improved by using the AUTO-STOP feature but better wait for feedback.

Barthess, I removed some definitions from i2c.h probably there is something to adjust in the driver now, my idea is to not support the SMB mode in this driver because it is not a feature found on all devices.

Giovanni

Re: [TODO] I2C driver for STM32F0

Posted: Tue Apr 02, 2013 6:46 pm
by Giovanni
Hi,

Sadly the driver is still unstable. At times it works and continues to work then at the next reset it fails, randomly. Still trying to debug it but I would rather remove it than letting unstable code in.

Giovanni

Re: [TODO] I2C driver for STM32F0

Posted: Wed Apr 03, 2013 8:12 am
by steved
Haven't had any success with the update of 24 hours or so ago (there's been another update since then) - getting fatal errors which I have yet to pin down. Will also try reverting to the 'original' when I can.

One problem which only appears when some of the debugging capabilities are enabled is that (in line 704 of latest i2c_lld.c) a minimum of two receive characters are required - not sure whether this is a hangover from the I2CV1 driver, since I had no apparent problem in receiving single characters when using the 'original' I2CV2 driver.

Re: [TODO] I2C driver for STM32F0

Posted: Thu Apr 04, 2013 1:59 am
by MartinP
Giovanni,

I have a working driver attached (slightly modified) which works on stm32f0xx and stm32f30x , unfortunately I have no stm32f7x for testing
it took me some time to merge the latest changes as some preprocessor defines disappeared.
For the STM32F0xx the DMA IRQ mapping got lost. You have to restore the Vectors in the DMA IRQ handler of the STM32F0xx or you will get an unhandled exception

I have added code for setting optionally the clock speed instead of the clock register bytes (like in the V1 driver). for this I had to change the data structure slightly.
This code is not finished yet. for the stm32f3 discover it works very accurate but on the stm32f051 discovery I have different rise/falling slope timings for my external i2c hardware so there is a clock deviation....
It's fun to watch it on the logic analyzer....

I had also to comment out some recent changes in the interrupt handler which stopped the driver from working propery
when I find some time i can also download examples for both versions, but now I'm too tired....

Martin

Re: [TODO] I2C driver for STM32F0

Posted: Thu Apr 04, 2013 8:31 am
by Giovanni
Hi,

Use of float is not an option that part cannot be included.

From the code you submitted it is not clear what the problem was, there were reasons for those changes in the ISR: I want the driver to wakeup the thread when the bus is no more busy (so when the stop condition has been detected).

Giovanni

Re: [TODO] I2C driver for STM32F0

Posted: Thu Apr 04, 2013 9:01 am
by MartinP
Giovanni,

I do not know the exact reason, but when I took the driver some weeks ago it did not work (the Interrupt flags were not resetted and DMA issuesd), then I had a look at Version 1 where there were some DMA related changes by Barthess. When merging in those changes the driver worked stable.

I do not mind the floating stuff as it is not necessary and just for Convenience (currently I do not find the download of the excel tool which does the calculations on the ST web site). it could be also pre-calculated in the user routine and the set the structure entry.

Ad ISR: I just noted that after a transmission some of the remaining IF statements became true and the driver ran into a timeout and the status became locked --> game Over


Martin

Re: [TODO] I2C driver for STM32F0

Posted: Thu Apr 04, 2013 9:08 am
by Giovanni
Thanks, I will look into those DMA changes, probably the problem was there.

Giovanni