Timeline for How does the Arduino send more than 6 bytes via I2C
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 11, 2017 at 12:42 | comment | added | Mikael Patel | The Arduino Wire implementation is synchronous (blocking) but still requires an intermediate buffer. As the answer about states the buffer is limited to max 32 bytes. This alternative I2C (Two-Wire) library does not have this limit and supports both software and hardware bus manager implementation. github.com/mikaelpatel/Arduino-TWI Device drivers written using this library can be used with the AVR/SAM hardware support or with any GPIO pin. | |
Jun 28, 2015 at 22:32 | comment | added | Nick Gammon♦ |
In the Wire library, beginTransmission() "primes" (starts) collecting data for a transmission. Then Wire.write() simply adds data to an internal buffer (which is 32 bytes long). Finally the endTransmission() actually does the sending of the buffer. As for the slave, in a "requestFrom" function as soon as you do a Wire.write() it is sent (or at least, it commences to be sent). You cannot (successfully) do more than one. If you attempt to, the second one overwrites the buffer used to return the data to the master.
|
|
Mar 8, 2015 at 15:04 | comment | added | krol | @Hoytman I'm actually not sure why the library handles i2c that way. I would expect that it has its roots in making a generic i2c/twi interface, but I don't understand i2c/twi well enough to give a correct answer. | |
Mar 7, 2015 at 15:40 | comment | added | Hoytman | in the wire code examples, the master uses beginTransmission() and endTransmission(), but the slave does not. The slave only uses write(). why is this? How does the Slave know when to end the transmission? | |
Mar 7, 2015 at 15:40 | vote | accept | Hoytman | ||
Mar 7, 2015 at 2:47 | history | answered | krol | CC BY-SA 3.0 |