Page 6 of 6
Re: i2c hangs when reading just one byte
Posted: Sun Nov 04, 2012 10:09 pm
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
Re: i2c hangs when reading just one byte
Posted: Sun Nov 04, 2012 10:21 pm
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
Re: i2c hangs when reading just one byte
Posted: Sun Nov 04, 2012 10:51 pm
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.
Re: i2c hangs when reading just one byte
Posted: Tue Nov 06, 2012 6:03 pm
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.