Trouble Changing I2C Buffer on Boron (Running 5.3.0 OS)

I’ve been trying all day, but can’t seem to change the I2C buffer on my Boron. I just updated the OS firmware to 5.3.0 and thought that would do it, but the I2C data from my sensors is still being cutoff. I only need a few more bytes :joy:

I’ve tried my best to follow the guides/solutions in these threads:

  1. acquireWireBuffer - Wire (I2C) | Reference | Particle
  2. How to use acquireWireBuffer()
  3. Sensirion SPS30 dust sensor: I2C comms - #6 by paulvha
  4. [SOLVED] I2C requestFrom() - how to read > 32 bytes? - #21 by UMD

Here’s my code on the Boron:

#include "Particle.h"
#include <Wire.h>

//Increase I2C buffer size
constexpr size_t I2C_BUFFER_SIZE = 64;

HAL_I2C_Config acquireWireBuffer() {
    HAL_I2C_Config config = {
        .size = sizeof(HAL_I2C_Config),
        .version = HAL_I2C_CONFIG_VERSION_1,
        .rx_buffer = new (std::nothrow) uint8_t[I2C_BUFFER_SIZE],
        .rx_buffer_size = I2C_BUFFER_SIZE,
        .tx_buffer = new (std::nothrow) uint8_t[I2C_BUFFER_SIZE],
        .tx_buffer_size = I2C_BUFFER_SIZE
    return config;

// Settings
const size_t MAX_STRING_LENGTH = 256;

// Global variables
char receivedData[MAX_STRING_LENGTH];
size_t currentDataLength = 0;
bool send = false;


void setup() {
    //hal_i2c_init(HAL_I2C_INTERFACE1, &config);

void loop() {
    if(currentDataLength > 0){
    //if(send == true){
        Particle.publish("cellData", receivedData, PRIVATE);
        // Clear the received data buffer
        currentDataLength = 0;
        receivedData[0] = '\0';
        send = false;

void receiveEvent(int numBytes) {
  while (Wire.available()) {
    char c =;
    if (currentDataLength < MAX_STRING_LENGTH - 1) {
      // Save the received character to the buffer
      receivedData[currentDataLength] = c;

      // If the received character is a null terminator, set send to 1 and break
      if (c == '\0') { //not being detected
        send = true;
    } else {
      Serial.println("Warning: Buffer full, discarding additional data.");

Have you tried it with this line active (not commented)?

BTW, this line is not required

Particle.h already does that for you.

But most confusing for me is the fact that you setup your Boron as a I2C slave but then mention that you expect to read data from your sensors, which would require your Boron to be running as master.

Yes, I am also confused about the use the I2C slave mode, that’s almost never the way you communicate with an I2C sensor.

If you have a sensor connected to another device that’s the I2C master connecting to the Particle I2C slave, make sure you increase the buffer size on the master device as well, because the master side can also truncate the data. Arduino devices often default to 32 bytes.

1 Like

I have tried it with that line uncommented, but received the same results.

Yes, it’s a bit of a weird setup. The Boron is connected to an Arduino Micro over I2C. The Micro is running a system of sensors independently of the Boron. It’s a prototype, so to hack in cell data transfer, I’m just having the Micro send the data collected to the Boron for cell data transmission.

Ah! I hadn’t thought of the I2C output buffer of the Arduino Micro also being limited, but yes also seems to be limited to 32 bytes. I had only verified the Arduino was outputting the correct data with the Serial monitor.

Regarding I2C setup, see response above. The Boron is essentially acting as an I2C slave to the Arduino Micro to simply publish data to the particle cloud.

Since this was a prototype for a client who didn’t know exactly what they wanted, cell data transmission was added as an afterthought. I designed around an Arduino Micro, and added the Boron for cell data later. Luckily the client is open to using Particle for future designs, and I’ll be designing natively around a particle cell module instead of a Micro for the next iteration.

Thanks for the help!

Sadly, since increasing the I2C buffer on Arduino requires a library change, I have to suck it up and send the data in chunks. Otherwise I’d have to have the client upload with a custom Wire.h library as well. I was just being stubborn.

Thanks again for the help,

I’ve ran into this same issue using Arduino’s and specifically the wire library, IIRC they limit each write/read to 32 bytes. You have to go into the library files and increase the buffer size or use a different I2C library. It’s been a while since I had to do this, but if you google increasing wire buffer size or something along those lines you should be able to figure it out where to change the library. Good luck.

Have you considered another way to have the two micros talk with each other (UART, SPI, …)?

I first tried Serial between the 2 Micro USB ports on each board, but USB requires a host and both devices are clients. So that didn’t work. There a sensor on the UART, so I didn’t want to interfere with that. I2C was ideal because of addressing.

I can just send the data as two packets and concatenate them on the Boron side. Almost have that working. But I appreciate the ideas

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.