Help with I2C OnRequest Transmission & Reception

I have a BLE sensor that periodically generates 50 bytes of data, as fast as every 0.5 seconds and as slow as every 5 seconds.

I am trying to use a Nano Matter as an I2C bridge to an Uno R4 Minima controller.
But the Nano Matter Wire library does not support the transmit buffer in Follower mode and I am having trouble reliably sending the 50 bytes.

I assume I have an I2C bus timing problem, but everything I try results in inaccurate reception.

Here is the code for the Nano Matter using the Silicon Labs BLE stack and an I2C onRequest handler that simply writes 50 bytes (which doesn't work)...

#include <Wire.h>

uint8_t ProbeStatusData[50] = { 0 };

uint32_t last_blink = 0;
uint8_t blink_state = 0;

void TxHandler(void) {
  for (int tx = 0; tx < 50; tx++) {
    Wire.write(ProbeStatusData[tx]);
  }
}

void setup() {
  Wire.begin(0x42);
  Wire.onRequest(TxHandler);

  pinMode(LED_BUILTIN, OUTPUT);
  last_blink = millis();
}

void loop() {
  if ((millis() - last_blink) > 750) {
    digitalWrite(LED_BUILTIN, (++blink_state & 1) ? HIGH : LOW);
    last_blink = millis();
  }
}

// ********************************
// Silicon Labs Bluetooth Stack
// ********************************
enum conn_state_t {
  ST_BOOT,
  ST_SCAN,
  ST_CONNECT,
  ST_SERVICE_DISCOVER,
  ST_CHAR_DISCOVER,
  ST_REQUEST_NOTIFICATION,
  ST_RECEIVE_DATA
};

const uint8_t target_mac[6] = { 0x60, 0xa6, 0x5a, 0x05, 0x71, 0xc2 };  // c2:71:05:5a:a6:60 in reverse order

const uint8_t target_uuid[] = { 0x7A, 0x40, 0xC1, 0x51, 0xAE, 0x97, 0x44, 0x3D,
                                0x92, 0x37, 0xAB, 0xCA, 0x00, 0x01, 0x00, 0x00 };  // For 00000100-CAAB-3792-3D44-97AE51C1407A in little-endian

const uint8_t target_char_uuid[] = { 0x7A, 0x40, 0xC1, 0x51, 0xAE, 0x97, 0x44, 0x3D,
                                     0x92, 0x37, 0xAB, 0xCA, 0x01, 0x01, 0x00, 0x00 };  // For 00000101-CAAB-3792-3D44-97AE51C1407A in little-endian

uint32_t CPT_service_handle = __UINT32_MAX__;
uint16_t CPT_char_handle = __UINT16_MAX__;

uint8_t data_length = 50;

conn_state_t connection_state = ST_BOOT;

// Bluetooth Stack Event Handler
void sl_bt_on_event(sl_bt_msg_t *evt) {
  sl_status_t sc;

  switch (SL_BT_MSG_ID(evt->header)) {
    // This event is received when BLE has successfully booted
    case sl_bt_evt_system_boot_id:
      // Start scanning for BLE devices
      sc = sl_bt_scanner_set_parameters(sl_bt_scanner_scan_mode_active, 16, 16);
      app_assert_status(sc);

      sc = sl_bt_scanner_start(sl_bt_scanner_scan_phy_1m,
                               sl_bt_scanner_discover_generic);
      app_assert_status(sc);
      connection_state = ST_SCAN;
      break;

      // This event is received when a BLE device is scanned
    case sl_bt_evt_scanner_legacy_advertisement_report_id:
      // Check if the BLE device is our CPT MAC address
      if (memcmp(evt->data.evt_scanner_legacy_advertisement_report.address.addr, target_mac, 6) == 0) {
        // Stop scanning
        sc = sl_bt_scanner_stop();
        app_assert_status(sc);
        // Connect to the device
        sc = sl_bt_connection_open(evt->data.evt_scanner_legacy_advertisement_report.address,
                                   evt->data.evt_scanner_legacy_advertisement_report.address_type,
                                   sl_bt_gap_phy_1m,
                                   NULL);
        app_assert_status(sc);
        connection_state = ST_CONNECT;
      }
      break;

    // This event is received when a BLE connection has been opened
    case sl_bt_evt_connection_opened_id:
      // Discover the target Probe Status service
      sc = sl_bt_gatt_discover_primary_services_by_uuid(evt->data.evt_connection_opened.connection,
                                                        sizeof(target_uuid),
                                                        target_uuid);
      app_assert_status(sc);
      connection_state = ST_SERVICE_DISCOVER;
      break;

    // This event is received when a BLE connection has been closed
    case sl_bt_evt_connection_closed_id:
      // Restart scanning
      sc = sl_bt_scanner_start(sl_bt_scanner_scan_phy_1m,
                               sl_bt_scanner_discover_generic);
      app_assert_status(sc);
      connection_state = ST_SCAN;
      break;

    // This event is generated when the target service is discovered
    case sl_bt_evt_gatt_service_id:
      // Store the handle of the discovered service
      CPT_service_handle = evt->data.evt_gatt_service.service;
      break;

    // This event is generated when the target characteristic is discovered
    case sl_bt_evt_gatt_characteristic_id:
      // Store the handle of the discovered characteristic
      CPT_char_handle = evt->data.evt_gatt_characteristic.characteristic;
      break;

    // This event is received when the GATT procedure completes
    case sl_bt_evt_gatt_procedure_completed_id:

      if (connection_state == ST_SERVICE_DISCOVER) {
        // Discover target characteristic on the CPT
        sc = sl_bt_gatt_discover_characteristics_by_uuid(evt->data.evt_gatt_procedure_completed.connection,
                                                         CPT_service_handle,
                                                         sizeof(target_char_uuid),
                                                         target_char_uuid);
        app_assert_status(sc);
        connection_state = ST_CHAR_DISCOVER;
        break;
      }

      if (connection_state == ST_CHAR_DISCOVER) {
        // Enable update notifications
        sc = sl_bt_gatt_set_characteristic_notification(evt->data.evt_gatt_procedure_completed.connection,
                                                        CPT_char_handle,
                                                        sl_bt_gatt_notification);
        app_assert_status(sc);
        connection_state = ST_REQUEST_NOTIFICATION;
        break;
      }

      if (connection_state == ST_REQUEST_NOTIFICATION) {
        // Subscribed to notifications
        connection_state = ST_RECEIVE_DATA;
      }
      break;

    // This event is received when the characteristic value ia updated
    case sl_bt_evt_gatt_characteristic_value_id:
      // Check if this is a notification
      if (evt->data.evt_gatt_characteristic_value.att_opcode == sl_bt_gatt_handle_value_notification) {
        // Check if this is from our target characteristic
        if (evt->data.evt_gatt_characteristic_value.characteristic == CPT_char_handle) {
          // Read the Probe Status data
          data_length = evt->data.evt_gatt_characteristic_value.value.len;
          memcpy(ProbeStatusData,
                 evt->data.evt_gatt_characteristic_value.value.data,
                 data_length);
        }
      }
      break;

    // Default event handler
    default:
      break;
  }
}

#ifndef BLE_STACK_SILABS
#error "This code rquires the Silicon Labs BLE stack. Please select 'BLE (Silabs)' in 'Tools > Protocol stack'."
#endif

I know the Nano Matter is properly being notified and reading the probe data.
And the I2C connection between Nano Matter Connector Carrier is using pullup resistors and a voltage translation / isolator between it and the Uno R4 Minima.
Everything works except the Nano Matter in Follower mode because it cannot use the transmit buffer like this...

void TxHandler(void) {
    Wire.write(ProbeStatusData, 50);
}

One the Uno R4 Minima I have tried a few different ways to read the data.
This is the basic code to request sensor data every second...

#include <Wire.h>

uint32_t last_millis = 0;

uint8_t RxByte[50] = {};

void setup() {
  Wire.begin();
  Serial.begin(9600);
  Serial.println("here we go...");
  last_millis = millis();
}

void loop() {
  if (millis() - last_millis > 1000) {
    Wire.requestFrom(0x42, 50);
    for (int i = 0; i < 50; i++) {
      RxByte[i] = Wire.read();
    }
    Serial.print(millis());
    Serial.print(" - ");
    for (int x = 0; x < 50; x++) {
      Serial.print(RxByte[x]);
    }
    Serial.println();
    last_millis = millis();
  }
}

The received data is not accurate.
The same occurs if I try to do 50 individual 1 byte reads...

for (int i = 0; i < 50; i++) {
      Wire.requestFrom(0x42, 1);
      RxByte[i] = Wire.read();
    }

Does anyone know how to arbitrate and successfully transmit 50 bytes from an I2C Follower using an On Request event handler on a controller which does not support the transmit buffer?

Between other Arduino boards and even the Nano Matter in Leader mode, using...

// Peripheral Follower
Wire.write(ProbeStatusData, 50);

// Controller Leader
Wire.requestFrom(0x42, 50);
    for (int i = 0; i < 50; i++) {
      RxByte[i] = Wire.read();
    }

...works perfectly fine.
Thank you for any advice!

What's that?

Where can we find documentation?
That library seems to differ widely from the Arduino standard lib. Can you find a specialized Matter or Silicon Labs forum section?

Hi @DrDiettrich, not sure if you are referring to the I2C Buffer or the "Follower" term, which is the replacement for the term 'slave' in a lot of the documentation I am seeing.
The 'master' and 'slave' terms are still in the library code.

In the Wire libraries and online documentation/tutorials there are references to I2C_BUFFER_LENGTH, tx_buffer[I2C_BUFFER_LENGTH], rx_buffer[I2C_BUFFER_LENGTH], etc. and comments that the libraries buffer multi-byte transfers (sending or receiving) and using the commands that references arrays or strings of characters, to buffer them and send them.

This works for both master and slave modes, sending and receiving, on boards like the Uno R4 Minima.

For the Nano Matter, the Wire library only lists the "buffered" write command (sorry if my terminology is incorrect) as being compatible with Master/Leader mode...

/***************************************************************************//**
   * Sends the provided bytes over the I2C bus
   * (leader mode only)
   *
   * @param[in] data Pointer to the data to be sent
   * @param[in] size Size of the data to be sent
   *
   * @return Returns the number of bytes sent
   ******************************************************************************/
  size_t write(const uint8_t* data, size_t size);

For Slave/Follower mode only the "unbuffered" single byte write command is available...

/***************************************************************************//**
   * Sends the provided byte over the I2C bus
   * (leader/follower mode)
   *
   * @param[in] value Byte of data to be sent over the I2C bus
   *
   * @return Returns the number of bytes sent
   ******************************************************************************/
  size_t write(uint8_t value);

In Slave/Follower mode the Nano Matter can receive (buffer) multi-byte transfers from the Master/Leader.
The Nano Matter only seems to be lacking the code to automatically buffer and send multi-byte transfers in the Slave/Follower mode, from what I can tell.

So I am hoping someone knows how to write code to manually send 50 bytes of data over the I2C bus from a Slave/Follower using an On Request handler.

But I am having difficulty getting even a single byte to successfully transfer when the Nano Matter is configured as a Slave/Follower.

I am not sure about documentation.
I have been interrogating the Silicon Labs Wire library found at...

\AppData\Local\Arduino15\packages\SiliconLabs\hardware\silabs\2.3.0\libraries\Wire

The documentation I have been using is the Aruino Inter-Integrated Circuit (I2C) Protocol and Wire library references as well as the I2C section of the Nano Matter User Manual.

These are correct technical terms. Political correct terms only are confusing.

All I2C transmissions execute during master.endTransmission() or master.requestFrom(). The slave serves all transfers byte by byte, in response to the byte received/requested interrupts of the I2C data register.

For a transmission of 50 bytes from the slave you have to configure the rx_buffer of the master to (at least) that size.

How that? Does the Matter have two independent I2C ports? Please describe how those 50 bytes will travel from the sensor to the Minima.

This code uses Silicon Labs BLE stack to subscribe to the sensors notification service and reads the sensor data into the ProbeStatusData[50] byte array every time the characteristic value is updated...

// ********************************
// Silicon Labs Bluetooth Stack
// ********************************
enum conn_state_t {
  ST_BOOT,
  ST_SCAN,
  ST_CONNECT,
  ST_SERVICE_DISCOVER,
  ST_CHAR_DISCOVER,
  ST_REQUEST_NOTIFICATION,
  ST_RECEIVE_DATA
};

const uint8_t target_mac[6] = { 0x60, 0xa6, 0x5a, 0x05, 0x71, 0xc2 };  // c2:71:05:5a:a6:60 in reverse order

const uint8_t target_uuid[] = { 0x7A, 0x40, 0xC1, 0x51, 0xAE, 0x97, 0x44, 0x3D,
                                0x92, 0x37, 0xAB, 0xCA, 0x00, 0x01, 0x00, 0x00 };  // For 00000100-CAAB-3792-3D44-97AE51C1407A in little-endian

const uint8_t target_char_uuid[] = { 0x7A, 0x40, 0xC1, 0x51, 0xAE, 0x97, 0x44, 0x3D,
                                     0x92, 0x37, 0xAB, 0xCA, 0x01, 0x01, 0x00, 0x00 };  // For 00000101-CAAB-3792-3D44-97AE51C1407A in little-endian

uint32_t CPT_service_handle = __UINT32_MAX__;
uint16_t CPT_char_handle = __UINT16_MAX__;

uint8_t data_length = 50;

conn_state_t connection_state = ST_BOOT;

// Bluetooth Stack Event Handler
void sl_bt_on_event(sl_bt_msg_t *evt) {
  sl_status_t sc;

  switch (SL_BT_MSG_ID(evt->header)) {
    // This event is received when BLE has successfully booted
    case sl_bt_evt_system_boot_id:
      // Start scanning for BLE devices
      sc = sl_bt_scanner_set_parameters(sl_bt_scanner_scan_mode_active, 16, 16);
      app_assert_status(sc);

      sc = sl_bt_scanner_start(sl_bt_scanner_scan_phy_1m,
                               sl_bt_scanner_discover_generic);
      app_assert_status(sc);
      connection_state = ST_SCAN;
      break;

      // This event is received when a BLE device is scanned
    case sl_bt_evt_scanner_legacy_advertisement_report_id:
      // Check if the BLE device is our CPT MAC address
      if (memcmp(evt->data.evt_scanner_legacy_advertisement_report.address.addr, target_mac, 6) == 0) {
        // Stop scanning
        sc = sl_bt_scanner_stop();
        app_assert_status(sc);
        // Connect to the device
        sc = sl_bt_connection_open(evt->data.evt_scanner_legacy_advertisement_report.address,
                                   evt->data.evt_scanner_legacy_advertisement_report.address_type,
                                   sl_bt_gap_phy_1m,
                                   NULL);
        app_assert_status(sc);
        connection_state = ST_CONNECT;
      }
      break;

    // This event is received when a BLE connection has been opened
    case sl_bt_evt_connection_opened_id:
      // Discover the target Probe Status service
      sc = sl_bt_gatt_discover_primary_services_by_uuid(evt->data.evt_connection_opened.connection,
                                                        sizeof(target_uuid),
                                                        target_uuid);
      app_assert_status(sc);
      connection_state = ST_SERVICE_DISCOVER;
      break;

    // This event is received when a BLE connection has been closed
    case sl_bt_evt_connection_closed_id:
      // Restart scanning
      sc = sl_bt_scanner_start(sl_bt_scanner_scan_phy_1m,
                               sl_bt_scanner_discover_generic);
      app_assert_status(sc);
      connection_state = ST_SCAN;
      break;

    // This event is generated when the target service is discovered
    case sl_bt_evt_gatt_service_id:
      // Store the handle of the discovered service
      CPT_service_handle = evt->data.evt_gatt_service.service;
      break;

    // This event is generated when the target characteristic is discovered
    case sl_bt_evt_gatt_characteristic_id:
      // Store the handle of the discovered characteristic
      CPT_char_handle = evt->data.evt_gatt_characteristic.characteristic;
      break;

    // This event is received when the GATT procedure completes
    case sl_bt_evt_gatt_procedure_completed_id:

      if (connection_state == ST_SERVICE_DISCOVER) {
        // Discover target characteristic on the CPT
        sc = sl_bt_gatt_discover_characteristics_by_uuid(evt->data.evt_gatt_procedure_completed.connection,
                                                         CPT_service_handle,
                                                         sizeof(target_char_uuid),
                                                         target_char_uuid);
        app_assert_status(sc);
        connection_state = ST_CHAR_DISCOVER;
        break;
      }

      if (connection_state == ST_CHAR_DISCOVER) {
        // Enable update notifications
        sc = sl_bt_gatt_set_characteristic_notification(evt->data.evt_gatt_procedure_completed.connection,
                                                        CPT_char_handle,
                                                        sl_bt_gatt_notification);
        app_assert_status(sc);
        connection_state = ST_REQUEST_NOTIFICATION;
        break;
      }

      if (connection_state == ST_REQUEST_NOTIFICATION) {
        // Subscribed to notifications
        connection_state = ST_RECEIVE_DATA;
      }
      break;

    // This event is received when the characteristic value ia updated
    case sl_bt_evt_gatt_characteristic_value_id:
      // Check if this is a notification
      if (evt->data.evt_gatt_characteristic_value.att_opcode == sl_bt_gatt_handle_value_notification) {
        // Check if this is from our target characteristic
        if (evt->data.evt_gatt_characteristic_value.characteristic == CPT_char_handle) {
          // Read the Probe Status data
          data_length = evt->data.evt_gatt_characteristic_value.value.len;
          memcpy(ProbeStatusData,
                 evt->data.evt_gatt_characteristic_value.value.data,
                 data_length);
        }
      }
      break;

    // Default event handler
    default:
      break;
  }
}

#ifndef BLE_STACK_SILABS
#error "This code rquires the Silicon Labs BLE stack. Please select 'BLE (Silabs)' in 'Tools > Protocol stack'."
#endif

This is a BLE connection and working robustly.
I would like the Nano Matter to respond to I2C requests to forward this data.
On the Uno R4 Minima this is setup with...

Wire.requestFrom(0x42, 50);
    for (int i = 0; i < 50; i++) {
      RxByte[i] = Wire.read();
    }

...to read the 50 bytes into the RxBte[50] array.

My problem is coding the I2C On Request handler to deliver the 50 bytes.

I can send dummy 50 byte data payloads between 2 other Arduino boards, for example 2 Uno R4 Minima's.

The only scenario not working is when the Nano Matter is a slave.

Wire.endTransmission(); or Wire.requestFrom();

What is the default I2C Buffer size of Nano Matter?

The Silicon Labs Wire library indicates 64 bytes...

static const uint32_t tx_buffer_size = 64u;
static const uint32_t rx_buffer_size = 64u;

If I use the Nano Matter as a I2C Master/Controller/Leader, there is no problem writing the 50 byte array.
But if I use the Nano Matter as the Master then the I2C bus on the Minima needs to be in Slave mode, which I cannot accommodate as I need other I2C modules connected (but they are removed trying to get this to work).

From what I can determine, the issue is the Nano Matter cannot buffer the writes and use Wire.write(data, lengh);
It can only Wire.write(byte); in Slave mode.

But even single byte writes from the Nano Matter as a slave are not being received correctly.

So when the Nano Matter is not in control of the bus, something is not working, like timing or arbitration.

If I try adding availableForWrite or timing delays, it compiles, but still doesm't work.

If I could even get one byte to be sent and received accurately it would be progress.

Show that code part.

Each i2C device is in slave mode by default.
Which I2C addresses do your devices have?

Please show the related code part.
This Wire.write adds the data to the tx buffer. Transmission of the entire tx buffer occurs at Wire.endTransmission() only.

This should be declared as volatile.

Note that memcpy() will not work with volatile storage.

Thank you @david_2018, I was not familiar with the need for the volatile declaration and usage.

Hi @DrDiettrich,
First Scenario = Master Sender to Slave Receiver.
Will start here even though my goal is to get the Master Receiver scenario to work, but wanted to show how the Nano Matter as a Slave isn't working in what I would consider the expected manner as noted below.

Master Code

#include <Wire.h>

uint8_t TxData[50];

void setup() {
  Wire.begin();

  for (int i = 0; i < 50; i++) {
    TxData[i] = i;
  }
}

void loop() {
  Wire.beginTransmission(0x42);
  Wire.write(TxData, 50);
  Wire.endTransmission();

  delay(1000);

  for (int x = 0; x < 50; x++) {
    TxData[x]++;
    if (TxData[x] > 49) {
      TxData[x] = 0;
    }
  }
  delay(1000);
}

Slave Code

#include <Wire.h>

volatile uint8_t RxData[50];
volatile bool Fresh = false;
volatile uint32_t last_millis;

void handler(int howmany) {
//void handler(void) {
  for (int i = 0; i < howmany; i++) {
    RxData[i] = Wire.read();
  }
  Fresh = true;
  last_millis = millis();
}

void setup() {
  Serial.begin(9600);
  while (!Serial) {}
  Wire.begin(0x42);
  Wire.onReceive(handler);
}

void loop() {
  if (Fresh) {
    Serial.print(last_millis);
    Serial.print(" - ");
    for (int a = 0; a < 50; a++) {
      Serial.print(RxData[a]);
      Serial.print(" ");
      }
    Serial.println();
    Fresh = false;
  }
}

For these configurations (Master to Slave)...

  • Minima to Minima
  • Nano Matter to Minima

...the following "correct" output is received

2110 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
4131 - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0
6153 - 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1
8174 - 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2
10195 - 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2 3
12216 - 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2 3 4
14237 - 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2 3 4 5
16258 - 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2 3 4 5 6
18279 - 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2 3 4 5 6 7
20301 - 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2 3 4 5 6 7 8
22322 - 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2 3 4 5 6 7 8 9
...

However, with the same code using the Minima as the Master Sender and the Nano Matter as the Slave Receiver results in...

8584 - 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10590 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12596 - 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
14603 - 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
16609 - 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
18615 - 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
20621 - 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
...

Something is clearly wrong here with the Nano Matter as the Slave Receiver.
It appears all of the bytes of the transfer are read into the first byte of the array as evidenced by the first line of the output starting with '49'.

I will follow up with the second scenario when I have some time this weekend...

Check whether/when the expected number of bytes has been received and stored in the correct array element.

With the Nano Matter in Slave mode howmany = 1 and TxData[49] is read into RxData[0]

In the two other configurations (Mimima to Minima & Nano Matter as the Master) howmany = 50 and the RxData array matches the TxData array

That's the case which you also have to handle.

In my opinion, according to the Nano Matter Wire library it should operate in the same manner as the other devices when configured as a Slave Receiver.
I am pointing out the inconsistency.

As a Slave Sender, the Nano Matter Wire library explicitly states it is not compatible with 'Wire.write(buffer, howmany)'...

/***************************************************************************//**
   * Sends the provided bytes over the I2C bus
   * (leader mode only)
   *
   * @param[in] data Pointer to the data to be sent
   * @param[in] size Size of the data to be sent
   *
   * @return Returns the number of bytes sent
   ******************************************************************************/
  size_t write(const uint8_t* data, size_t size);

So back to my original question, how to use an On Request handler to send 50 bytes from a Slave Sender that can only write one byte per I2C transfer session?

I will get to detailing this second scenario when I have some more time this weekend where it appears only the Nano Matter in Slave mode cannot properly queue up and send 50 bytes in a single I2C transfer.

If I try to run 50 consecutive Master Wire.requestFrom(addr, 1); commands and have the Slave handler count the requests and respond appropriately it still doesn't seem to work.
Maybe it is a timing or bus arbitration issue?
Or would it be better to have the Master transmit which byte it expects and then have the Slave's next response be that byte?
Just trying to figure out how to work around the Nano Matter Slave mode limitations...

See Wire.onRequest(handler)
Such a handler writes the next byte into the I2C output register.