Go Down

Topic: Documentation note - Wire Library (Read 1 time) previous topic - next topic


I found an issue using the Wire library with an ATtiny processor (in my case ATtiny48).  The Wire library (actually the underlying utility functions in twi.h) defines a large amount of memory for buffers.  It creates 3 buffers, each 32 bytes.  There is a define in twi.h that sets the buffer size.  However, because of the way that the Arduino environment compiles sketches, you can't actually redefine the buffer size.  Instead, you have to edit the twi.h header file.

In my case, when I included the Wire library in my project, I had random crashes, hangs, etc.  Once I changed the buffer size from 32 to 6 (my largest message is 2 bytes) it worked just fine.

I think a note about this should be included in the Wire documentation page.  I've already edited the playground page talking about Wire library internals to include a similar note about buffer sizes.

Go Up