I2C slave icw accelstepper

I have an arduino nano running as an I2C slave. The master is an arduino uno connected to the slave using a short wire (ca. 10cm) icw a pullup resistor.

The slave is more or less just driving a stepper using the accelstepper lib. Stepper parameters and pseudo commands are send to the slave by the master. The master's main puprose is being the user interface and preparing commands/parameters to let the slave stick to it's job: driving the stepper.

Regarding to the communication between master/slave I created a union of a 32 byte array and a struct which contains all info which is shared between slave and master.
The byte array is used to transfer (partially) the buffer.

union I2Cbuf_u {
  unsigned char   byte[0];  
  struct { 
     struct {
        uchar  recType : 4;  
        uchar  cmd : 4; 
     } xfer;
     union { 
       sldrFlds_s    sldrFlds; //REC_TYPE_SLDR_
       dslrFlds_s    dslrFlds; //REC_TYPE_DSLR_
       expFlds_s    expFlds; //REC_TYPE_EXPOSURE_
       expTrackFlds_s expTrackFlds;    //REC_TYPE_EXPOSURETRACK_
       tmlapseFlds_s   tmlapseFlds;     //REC_TYPE_EXPOSURETMLAPSE_
     } rec;
  } content;

It's working all just fine but when the buffer is transferred while the stepper is still stepping it stops stepping for about 400-600ms. (just a quess..) At that time the only thing the slave is doing is stepper.run() in a loop.

I'm using the I2C Wire.h library and default clock speed. (both master and slave)

Any idea if this is a quite normal delay or should the I2C transfer of 32bytes be hardly noticable while the stepper is running. (or: there is probably something wrong in the setup\programming or this is about the performance I could expect..?)

Now the transfer is completely handle in the Wire.onReceive Wire.onRequest interrupts.
Maybe I can just set a flag and then handle the transfer in the loop() outside the interrupt. But if the transfer just takes so much time this wouldn't be much of a help probably.

This may be related to this post I recently made.

I saw your post this morning Dan! Probably about the same thing.

Just curious how much time the transfer of a complete buffer (32bytes) should take in a default and normal situation using the standard library.

I can use that info as a kind of reference to prevent me spending hours on the wrong thing.. :wink: