Go Down

Topic: [Solved]I2C Master write issue (more than 32 bytes at one command) (Read 129 times) previous topic - next topic

seandlee

I use NANO as USB-to-I2C Adaptor.
In  my applications, I have to write more than 32 bytes on one command.
But NANO has a limit 32 bytes.

For example, write command as follows,
Device Address (I2C Slave: A2)
/S: START
/P: STOP

33 bytes write:
/SA2000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20/P --> Write


In oscilloscope result,
/SA2000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F/P

34 bytes write:
/SA2000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021/P --> Write


In oscilloscope result,
/SA2000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F/P

How to do solve this issues? Please let me know your know-how.

Thanks.


seandlee

I solved this issues from https://forum.arduino.cc/index.php?topic=330648.msg2281504#msg2281504 .


I changed two defines statements, which are located at "arduino-PR-.../hardware/arduino/avr/libraries/"

1. wire.h --> #define BUFFER_LENGTH 64 // 32 --> 64
2. twi.h -->  #define BUFFER_LENGTH 64 // 32 --> 64


Thanks a lot.

Koepel

That is correct, however, when you update the Arduino IDE, then it will be 32 byte again.

The Arduino Zero/M0/MKR boards have a buffer of 256 bytes and some software Wire-compatible libraries have almost no limit, see: https://github.com/Koepel/How-to-use-the-Arduino-Wire-library/wiki/Buffer-size-of-the-Wire-library.

seandlee

That is correct, however, when you update the Arduino IDE, then it will be 32 byte again.

The Arduino Zero/M0/MKR boards have a buffer of 256 bytes and some software Wire-compatible libraries have almost no limit, see: https://github.com/Koepel/How-to-use-the-Arduino-Wire-library/wiki/Buffer-size-of-the-Wire-library.
Thank you for your comment.

Go Up