diff --git a/arch/sim/src/sim/sim_canchar.c b/arch/sim/src/sim/sim_canchar.c index 37c927f51e5..572922a0cba 100644 --- a/arch/sim/src/sim/sim_canchar.c +++ b/arch/sim/src/sim/sim_canchar.c @@ -292,7 +292,11 @@ static void sim_can_work(void *arg) struct can_hdr_s hdr; int ret; - if (host_can_avail(&priv->host)) + /* Drain all frames queued on the host socket, otherwise only one frame + * is delivered per work period and the RX path lags behind the bus. + */ + + while (host_can_avail(&priv->host)) { /* Wait for data from host stack */ diff --git a/arch/sim/src/sim/sim_cansock.c b/arch/sim/src/sim/sim_cansock.c index b89ae67e11a..f7e2375f0b1 100644 --- a/arch/sim/src/sim/sim_cansock.c +++ b/arch/sim/src/sim/sim_cansock.c @@ -174,7 +174,11 @@ static void sim_can_work(void *arg) struct canfd_frame hframe; int ret; - if (host_can_avail(&priv->host)) + /* Drain all frames queued on the host socket, otherwise only one frame + * is delivered per work period and the RX path lags behind the bus. + */ + + while (host_can_avail(&priv->host)) { /* Wait for data from host stack */