Page 23 of 35

Re: I2C implementation for STM32

Posted: Fri Dec 02, 2011 3:59 pm
by barthess
Giovanni,
No regrets please. Because I have a lot of fun during programming. Any way, I2C bus is too slow to use it in sync mode IMHO.

Now some good news. Finally, driver works in DMA mode (only for reading for a moment) and insane I2C interrupts handler was cutted out.

Re: I2C implementation for STM32

Posted: Fri Dec 02, 2011 9:52 pm
by Badger
That is good news barthess! does the DMA stuff apply to all STM32 or just F4? I look forward to trying it out

Re: I2C implementation for STM32

Posted: Fri Dec 02, 2011 10:06 pm
by barthess
Looks like to all stm32 with minimal differences between (F4,F2) and F1.

Re: I2C implementation for STM32

Posted: Sun Dec 04, 2011 2:24 pm
by Jacon
barthess wrote:Looks like to all stm32 with minimal differences between (F4,F2) and F1.


If so - are there any reasons that stop you from prepare STM32F4 testhal demo version
in your i2c_dev branch, with all needed files updated, tested and checked by yourself,
similar to STM32F1 version ?

Because I'm not able to communicate with simplest I2C device (PCF8574 I/O expander)
from my STM32F4-Discovery board. I need 1 byte <> transmissions only, so DMA
not needed...

Only proper "I2C bus start event" visible on scope, and then MCU "Hard fault"
during ongoing first 1-byte write attempt...

Re: I2C implementation for STM32

Posted: Sun Dec 04, 2011 3:11 pm
by barthess
Jacon wrote:If so - are there any reasons that stop you from prepare STM32F4 testhal demo version
in your i2c_dev branch, with all needed files updated, tested and checked by yourself,
similar to STM32F1 version ?

Only one. I have disassemble old hardware to build new board. And not all staff realize on new board yet.

Jacon wrote:Because I'm not able to communicate with simplest I2C device (PCF8574 I/O expander)
from my STM32F4-Discovery board.

Old driver from trunk works with STM32F4 in callback mode.

Jacon wrote:I need 1 byte <> transmissions only, so DMA
not needed...

This is not my whim. This is stm32 hardware problems. Just read two bytes and drop unneeded one. Any way, you are welcome to create totally sync driver based on polling model. I think, there is no problem to include two drivers in ChibiOS with possibility to switch between.

Re: I2C implementation for STM32

Posted: Sun Dec 04, 2011 7:03 pm
by barthess
Some news:
- Driver tested on my tmp75, mma8451, max1236 with stm32f407 as master.
- 10-bit addressing dropped
- Slave mode rudiments cleaned out.
- Sync mode dropped because low level part are too async oriented. If you want to use it in sync manner - set I2C_USE_WAIT to TRUE and callbacks set to NULL.

Near plans:
- port to other stm32 families
- replacing polling waiting of STOP by something else

Giovanni,
Could you review DMA-related code? I am not too familiar with it.

If anybodies want to test - check out i2c_dev branch rev.3550. High level calls not changed, only remove last 3 fields from I2CConfig. Note, only I2C2 interface realized for a moment.

Re: I2C implementation for STM32

Posted: Mon Dec 05, 2011 10:29 am
by matis
Guys,

What version do I need to download from SVN to get the latest I2C development? Currently I'm at the following revision:

Code: Select all

URL: https://chibios.svn.sourceforge.net/svnroot/chibios/trunk
Repository Root: https://chibios.svn.sourceforge.net/svnroot/chibios
Revision: 3451
Node Kind: directory
Schedule: normal
Last Changed Author: gdisirio
Last Changed Rev: 3451
Last Changed Date: 2011-10-23 14:21:44 +0200 (Sun, 23 Oct 2011)


But I want to actively support the latest developments made on this I2C project.

So what version do I need to download and / or update to achieve the latest (semi stable) I2C sources?

Re: I2C implementation for STM32

Posted: Mon Dec 05, 2011 11:10 am
by barthess
matis,
You need to switch to i2c_dev branch in repository.

Re: I2C implementation for STM32

Posted: Mon Dec 05, 2011 11:15 am
by matis
barthess wrote:matis,
You need to switch to i2c_dev branch in repository.


Thanks for your reply. On what ChibiOS version / branch does development branch live?

When I look in the readme file of the i2c_dev branch; It looks like 2.3.4, is that correct?

Re: I2C implementation for STM32

Posted: Mon Dec 05, 2011 11:24 am
by barthess
matis wrote:On what ChibiOS version / branch does development branch live?

https://chibios.svn.sourceforge.net/svn ... es/i2c_dev
matis wrote:It looks like 2.3.4, is that correct?

Yes, it is correct.