I2C with struct

Hello,

I try to migrade from R3 Uno to R4 minima.
And I am struggelin with I2C communication.

Situation:
1 nano board used as a slave send a struct of arround 64 byte to the master R4 minima.
The "buffer size" of the "Wire.h" and the "twi.h" library is changed to "64" (nano side)

the struct looks like the following:

struct Waagen{
  char item1[20]; //20 byte
  char item2[20]; // 20 byte
  uint8_t minPcs;     //1 byte
  int pcs;     //2byte
  uint8_t calcPcs;  //1byte
  uint8_t waageID;        //1byte
  uint8_t whatToDo;     // 1byte
}

on the master side i receive the struct until "Waagen.minPcs". The remaining values are 255 or -65504...
Here the serial output from the master side

22:20:41.874 -> item1: 476288EI08020
22:20:41.874 -> item2: 123ABC
22:20:41.874 -> minPcs: 150
22:20:41.874 -> pcs: -65504
22:20:41.874 -> calcPcs: 255
22:20:41.874 -> waageID: 255
22:20:41.874 -> whatToDo: 255

the stream on the master I receive as the following

//Just a sample...
struct Waagen waage;

Wire.readBytes((byte*)&waage, sizeof waage);

The "Wire.h" library on the R4 looks diffrent, but there is a I2C_BUFFER_LENGTH too. It is by default "255".
I used 4k7 Pullups on the I2C line. no change

Do you know where I have to poke?

Thank you for your time in advance.

regards
Daniel

Welcome

Thank you guix.
that coud be spot on.
just changed "int" into "uint8_t" (on Master side) and its looks better. :grinning:

regards
Daniel