arduino / arduino/ArduinoCore-renesas

Arduino_CAN library: Calling `available()` twice in a row returns gives different results

Open
#535 0 comments 0 reactions 0 assignees View on GitHub
topic: code type: imperfection
Dominant language
C
Stars
193
Forks
112
PR merge metrics
No merged PRs in 30d

Description

Calling `CAN1.available()` after a message has come in returns `true`. Calling then `CAN1.available()` a second time without any other calls (i.e. `CAN1.read()`) returns `false`.

### Exptected behaviour
`CAN1.available()` should return the number of frames ready to be read via `read()` without consuming or moving any data. Calling it N times without an intervening `read()` should return the same value each time.

### Environment
- Board: Portenta C33
- Library: Arduino_CAN
- Bitrate: 125 kbps
- Only tested on CAN1 interface
- Arduino Renesas Portenta Boards version: 1.5.3
- Arduino IDE version: 2.3.8

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the Arduino_CAN library implementation of available() and read(), then reproduce the Portenta C33 case described in the issue. Check that repeated available() calls report the same number of ready frames until read() is called; done means the reported count remains stable without consuming data.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.