I2C implementation for STM32

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: I2C implementation for STM32

Post 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.
User avatar
Badger
Posts: 346
Joined: Mon Apr 18, 2011 6:07 pm

Re: I2C implementation for STM32

Post 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
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: I2C implementation for STM32

Post by barthess »

Looks like to all stm32 with minimal differences between (F4,F2) and F1.
Jacon
Posts: 143
Joined: Wed Dec 08, 2010 7:52 am
Has thanked: 50 times
Been thanked: 5 times

Re: I2C implementation for STM32

Post 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...
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: I2C implementation for STM32

Post 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.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: I2C implementation for STM32

Post 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.
matis
Posts: 53
Joined: Fri Jul 01, 2011 1:46 pm

Re: I2C implementation for STM32

Post 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?
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: I2C implementation for STM32

Post by barthess »

matis,
You need to switch to i2c_dev branch in repository.
matis
Posts: 53
Joined: Fri Jul 01, 2011 1:46 pm

Re: I2C implementation for STM32

Post 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?
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: I2C implementation for STM32

Post 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.
Post Reply