From 597b3e6ca774bf8af85cca6252f1e8a95ac0af19 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Mon, 10 Feb 2025 12:46:15 +0200 Subject: [PATCH] mpfs_i2c: Increase TTOA margin to 1ms Due to interrupt latencies the i2c transfer done interrupt can get deferred by a few hunder microseconds. This makes the i2c transfer timeout way too early, even though the i2c IP block is already done. Fix this by adding a significant amount of margin (1ms) to the timeout value. --- arch/risc-v/src/mpfs/mpfs_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/risc-v/src/mpfs/mpfs_i2c.c b/arch/risc-v/src/mpfs/mpfs_i2c.c index 394a451dadd..8201bcd4f17 100644 --- a/arch/risc-v/src/mpfs/mpfs_i2c.c +++ b/arch/risc-v/src/mpfs/mpfs_i2c.c @@ -75,7 +75,7 @@ /* Gives TTOA in microseconds, ~4.8% bias, +1 rounds up */ #define I2C_TTOA_US(n, f) ((((n) << 20) / (f)) + 1) -#define I2C_TTOA_MARGIN 20 +#define I2C_TTOA_MARGIN 1000u /**************************************************************************** * Private Types