From d128b47c71396b9fd2d0cacbfbf394501e3bd851 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 10 Apr 2014 18:19:03 -0600 Subject: [PATCH] SAMA5 TWI: Number of bytes transferred not be incremented on the first byte. From David Sidrane --- ChangeLog | 3 +++ arch/arm/src/sama5/sam_twi.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4840987d0ff..7a9745ba20d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7162,4 +7162,7 @@ functions are called early in initialization before the tasking structures are initialized, they will not behavr properly (2014-4-10). + * arch/arm/src/sama5/sam_twi.c: TWI data sending is fails to increment + the number of byes transferred on first byte sent. from David Sidrane + (2014-4-10). diff --git a/arch/arm/src/sama5/sam_twi.c b/arch/arm/src/sama5/sam_twi.c index f68f98b042b..f0dfc64a056 100644 --- a/arch/arm/src/sama5/sam_twi.c +++ b/arch/arm/src/sama5/sam_twi.c @@ -719,7 +719,7 @@ static void twi_startwrite(struct twi_dev_s *priv, struct i2c_msg_s *msg) /* Write first byte to send.*/ - twi_putrel(priv, SAM_TWI_THR_OFFSET, msg->buffer[0]); + twi_putrel(priv, SAM_TWI_THR_OFFSET, msg->buffer[priv->xfrd++]); /* Enable write interrupt */