diff --git a/drivers/i2c/i2c_sam0.c b/drivers/i2c/i2c_sam0.c index ee8e4796c6ab7..576758b88d932 100644 --- a/drivers/i2c/i2c_sam0.c +++ b/drivers/i2c/i2c_sam0.c @@ -162,7 +162,7 @@ static void i2c_sam0_isr(const struct device *dev) data->msg.buffer++; data->msg.size--; } else if (status & SERCOM_I2CM_INTFLAG_SB) { - if (!continue_next) { + if (!continue_next && (data->msg.size == 1)) { /* * If this is the last byte, then prepare for an auto * NACK before doing the actual read. This does not @@ -175,7 +175,7 @@ static void i2c_sam0_isr(const struct device *dev) data->msg.buffer++; data->msg.size--; - if (!continue_next) { + if (!continue_next && !data->msg.size) { i2c->INTENCLR.reg = SERCOM_I2CM_INTENCLR_MASK; k_sem_give(&data->sem); return;