i2c hangs when reading just one byte

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: i2c hangs when reading just one byte

Post by barthess »

nosense wrote:I would definitely expect some note with big red exclamation mark in documentation.

The low level I2C driver for STM32 such warning. Probably we need place it in hi level doxy strings too.
Giovanni, how do you think?
nosense wrote:What about devices expecting only 1 byte read?

If you know one please let me know.
nosense wrote:Where is the problem anyway?

In rotten stm32's I2C cell
nosense wrote: In reference manual I clearly see the sequence for 1 byte reading.

If I remember correctly it use polling approach totally discouraged by Chibios dao.
Look at this topic for details viewtopic.php?f=3&t=25
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: i2c hangs when reading just one byte

Post by Giovanni »

The limitation is STM32F1-specific so it cannot go in the high level, the best place would be to mention it in platform.dox in the I2C section. I'll do that.

Giovanni
User avatar
nosense
Posts: 22
Joined: Mon Oct 08, 2012 7:15 pm

Re: i2c hangs when reading just one byte

Post by nosense »

The warning should definitely be at least on STM32F1xx HAL documentation http://chibios.sourceforge.net/docs/hal ... 4248618967 and probably here http://chibios.sourceforge.net/docs/hal ... _i2_c.html.

1 byte reading in refman is described like this:

Code: Select all

Case of a single byte to be received:
– In the ADDR event, clear the ACK bit.
– Clear ADDR
– Program the STOP/START bit.
– Read the data after the RxNE flag is set.


I think it doesn't require polling and everything can be handled using interrupts (with high priority to overcome problems described in errata). But I agree that I2C periphery design on STM32F1 family is really bad. Just please add some warning to high level driver documentation at least to STM32F1xx section. It could save me few hours of searching for error.
lmamakos
Posts: 20
Joined: Sun May 13, 2012 3:59 pm

Re: i2c hangs when reading just one byte

Post by lmamakos »

I think this also applies to the I2C peripheral in the STM32L15x family, too. I recall having a similar problem using the STM32LDISCOVERY board.
Post Reply