New answers tagged

1

Strings (aka byte arrays of arbitrary length) are perfect for asynchronous and full duplex protocols like UART, essentially because those are no master-slave protocols. Here, both master and slave can transmit a byte stream independent of each other at any time and with any length. But using strings on I2C is quite uncommon. As I2C is a master-slave bus ...


2

I2C works with fixed size byte arrays. Single bytes for commands should be sufficient. For positions you might need int16_t or even bigger numbers. Unsigned positions relative to (above) zero might make things easier, eventually (?) As you have the same architecture on both sides, mapping of byte arrays to bigger numbers via union will work well.


0

How to choose SDA/SCL pain on due from software. wire.h has two instances of TwoWire i.e. Wire and Wire1. Wire uses #define PIN_WIRE_SDA (20u) #define PIN_WIRE_SCL (21u) and Wire1 #define PIN_WIRE1_SDA (70u) #define PIN_WIRE1_SCL (71u) observe which instance is used by your library e.g. #define WIRE Wire1 or #define ...


1

I added pull-up resistors to the board and it started working. Turns out that the boards weren't well designed and the I2C lines were pulled up to 1.8V instead of Vin. By removing the pull-ups and adding pull-ups to Vin, the circuit started functioning. The circuit worked with Mega because it has in-built Pull-up Resistors.


0

I've been rebuilding using Atmel Studio. After a long time bringing my C++ skills up to scratch I've managed to get it to work very reliably. I like the greater level of control it brings. I suspect that I was trying to do something in Arduino IDE that cannot be done with the Wire library. I had to effectively rewrite the Atmel Start Slave driver to get it ...


0

Your program seems to fit well inside the Arduino Uno memory. If your output is displaying correctly through the serial monitor, there also seems nothing wrong with your data sent to the display. Have you tried connecting pull-up resistors to the SDA and SCL lines? Resistors around 3.9k work fine for me when using OLED displays.


1

There is a trick to this, and it involves considering one device "active" and all others "inactive". You only ever work with one address, and that is the address of the "active" unit. All other units are on the secondary "inactive" address which you ignore. The address pin of each unit is then connected to an IO pin, and can be considered a "chip select" ...


1

The limitation is purely in software. The I2C hardware has a limit of one byte at a time, and the software creates a 32 byte buffer and feeds each byte from that in turn. While it would be perfectly possible to increase that buffer size, you may find you have other problems when you get above 255 bytes, since lots of parameters and internal variables for ...


0

Since I made a PCB prototype, I would avoid to add some wires and cut the traces, so I would ask if I could use these pins (GPIO7 and GPIO8) as SDA and SCL. No, you can't. Those pins are used by the internal flash chip. If you connect things to them you will end up not being able to read the flash and thus won't be able to run any code. In other words, the ...


3

Use a logic level conversion IC. picture source http://msx-elektronika.pl/en/logic-level-converter


Top 50 recent answers are included