I2C Slave Library

Can someone help me port this library?
Post Reply
ATIU
Posts: 6
Joined: Wed Jun 01, 2016 6:47 am

I2C Slave Library

Post by ATIU » Mon Jul 11, 2016 12:12 am

Hi All,

Is there a working example and library for the I2C slave?

From the LeafLabs documentation, there appears to be problems with the existing hardware and library quoted below,

"There are some important known problems with the built-in I2C peripherals. For more information, see STM32F10xx8 and STM32F10xxB Errata sheet (ST Doc ID 14574 Rev 8), Section 2.11.1, 2.11.2. An important consequence of these problems is that the I2C interrupt must not be preempted. Consequently, (by default) Wirish uses an I2C interrupt priority which is the highest in the system (priority level 0). Other interrupt priorities are set lower."

http://docs.leaflabs.com/static.leaflab ... bmaple-i2c

Also quoted below,

"Currently, only low-level support in i2c.h exists. A Wiring-style library is planned for a future release."

From Function Reference of the I2C from leaflab.com documentation of the maple.

I wonder if the I2C slave is affected and what quirks should I expect before plunging into using the STM32F103 on project where I2C master and slave communication is necessary. I intend to use several STM32F103 as slave to an I2C master polling data from them.

Thanks for any insights and suggestions,

Albert

User avatar
RogerClark
Posts: 7552
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: I2C Slave Library

Post by RogerClark » Mon Jul 11, 2016 1:34 am

@ATIU

Unfortunately we don't have I2C slave support

Note.
Currently the Wire library uses bit-banged code, but we also now have Hardware I2C which also works well.
I've not changed the Wire library over to Hardware I2C in case it breaks things for existing users, though it will probably get changed in the future.

Anyway, I'm not sure the best way forward with this. You could write a bit-banged I2C slave library (there may be code on the web for this, as the I2C master code looks like it was ported from other examples on the web)

Re: Hardware I2C, that may be a tougher nut to crack if there are known issues with the hardware.

ATIU
Posts: 6
Joined: Wed Jun 01, 2016 6:47 am

Re: I2C Slave Library

Post by ATIU » Tue Jul 12, 2016 11:27 pm

Hi Roger,

Thanks for the quick reply. I guess I will stay away from I2C slave for now to avoid implementation problems.

Albert

User avatar
RogerClark
Posts: 7552
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: I2C Slave Library

Post by RogerClark » Thu Aug 03, 2017 4:46 am

Just to update this old thread.

"Wire" has been changed to use hardware I2C

However we still do not have Slave functionality

User avatar
Squonk42
Posts: 253
Joined: Thu Dec 29, 2016 9:25 am
Location: Bordeaux, France

Re: I2C Slave Library

Post by Squonk42 » Thu Aug 03, 2017 8:13 am

AFAICT, the current errata for the STM32F103C8 is now ST Doc ID 14574 Rev 13, not the obsolete Rev 8:
http://www.st.com/content/ccc/resource/ ... 190234.pdf

From the document revision history, sections 2.11.1 and 2.11.2 (now moved to 2.13.1 and 2.13.2) have been edited in revision 9 dated 22-Feb-2011.

There is an interesting ANN2824 covering STM32F10xxx I2C optimized examples:
http://www.st.com/content/ccc/resource/ ... 209826.pdf

Post Reply