-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Labels
RegressionSomething, which was working, does not anymoreSomething, which was working, does not anymorearea: CANbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugplatform: NXPNXPNXP
Description
Describe the bug
test is 6/10 pytest scenario(s) failed on v4.3.0-647-g0c4abcdd29fc on frdm_mcxn947/mcxn947/cpu0
testcase path is tests/drivers/can/host/
0c4abcd is the first bad commit
commit 0c4abcd
Author: William Tang [email protected]
Date: Mon Oct 27 20:02:20 2025 +0800
drivers: can: mcux: flexcan: support Enhanced CAN Bit Timing registers
Some FlexCAN devices have enhanced bit timing registers (EPRS ENCBT EDCBT)
with extended timing configuration ranges and different behavior compared
to standard bit timing registers.
This change adds proper support for these enhanced registers, utilize full
bit timing capabilities.
Key differences for enhanced bit timing registers:
- Extended timing ranges with larger maximum values for sjw, phase_seg1,
phase_seg2, and prescaler fields
- No propagation segment configuration support, so prop_seg must be 0
- prop_seg value is used directly without the typical 'minus 1' adjustment
The implementation adds conditional compilation based on the
`FSL_FEATURE_FLEXCAN_HAS_ENHANCED_BIT_TIMING_REG` feature flag.
For Enhanced registers, use extended timing limits and prop_seg directly.
Test this commit on mimxrt1180_evk/mimxrt1189/cm33 drivers.can.timing
test case, and enable `TEST_ALL_BITRATES` Kconfig symbol.
Signed-off-by: William Tang <[email protected]>
drivers/can/can_mcux_flexcan.c | 46 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
Regression
- [Y] Regression
see logs for details
To Reproduce
1.
scripts/twister --device-testing --device-serial /dev/ttyACM0 -p frdm_mcxn947/mcxn947/cpu0 -T tests/drivers/can/host/ --sub-test frdm_mcxn947/mcxn947/cpu0:drivers.can.host
or
# cd tests/
# west build -b frdm_mcxn947/mcxn947/cpu0 tests/drivers/can/host/
# west flash
follow the pytest guide
- See error
Expected behavior
test pass
Impact
Logs and console output
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$ can filter add can@d4000 -e 00000000 00000000
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: adding filter with extended (29-bit) CAN ID 0x00000000, CAN ID mask 0x00000000
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: filter ID: 1
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$
DEBUG can:util.py:209 can config: {'interface': 'socketcan', 'channel': 'can0'}
INFO can.interfaces.socketcan.socketcan:socketcan.py:587 Created a socket
DEBUG can.interfaces.socketcan.socketcan:socketcan.py:603 Binding socket to channel=can0
DEBUG can.interfaces.socketcan.socketcan:socketcan.py:605 Bound socket.
------------------------------ Captured log call -------------------------------
DEBUG can.interfaces.socketcan.socketcan:socketcan.py:856 We've been asked to write a message to the bus
DEBUG can.interfaces.socketcan.socketcan.tx:socketcan.py:858 sending: Timestamp: 0.000000 ID: 020 S Rx DL: 4 aa bb cc dd
ERROR twister_harness.device.device_adapter:device_adapter.py:195 Did not find line ".*can@d4000\s+(?P<brs>\S)(?P<esi>\S)\s+(?P<can_id>\d+)\s+\[(?P<dlc>\d+)\]\s*(?P<data>[a-z0-9 ]*)" within 1.0 seconds
---------------------------- Captured log teardown -----------------------------
DEBUG can.interfaces.socketcan.socketcan:socketcan.py:818 Closing raw can socket
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$ can stop can@d4000
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: stopping can@d4000
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$ can filter remove can@d4000 0
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: removing filter with ID 0
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$ retval
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: 0
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$ can filter remove can@d4000 1
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: removing filter with ID 1
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$ retval
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: 0
DEBUG twister_harness.device.device_adapter:device_adapter.py:150 #: uart:~$
__________________ TestCanRxTx.test_host_to_dut[ext_id_dlc_8] __________________
self = <test_can.TestCanRxTx object at 0x7f9df55dee70>
can_dut = <can_shell.CanShellBus object at 0x7f9df55dffe0>
can_host = <can.interfaces.socketcan.socketcan.SocketcanBus object at 0x7f9df55dd0a0>
msg = can.Message(timestamp=0.0, arbitration_id=0x30, is_extended_id=True, dlc=8, data=[0xee, 0xff, 0xee, 0xff, 0xee, 0xff, 0xee, 0xff])
def test_host_to_dut(self, can_dut: BusABC, can_host: BusABC, msg: can.Message) -> None:
"""Test host to DUT communication."""
self.skip_if_unsupported(can_dut, can_host, msg)
can_host.send(msg, timeout=TIMEOUT)
> rx = can_dut.recv(timeout=TIMEOUT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/drivers/can/host/pytest/test_can.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../.venv/lib/python3.12/site-packages/can/bus.py:121: in recv
msg, already_filtered = self._recv_internal(timeout=time_left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <can_shell.CanShellBus object at 0x7f9df55dffe0>, timeout = 1.0
def _recv_internal(self, timeout: float | None) -> tuple[Message | None, bool]:
frame_regex = (
r'.*'
+ re.escape(self._device)
+ r'\s+(?P<brs>\S)(?P<esi>\S)\s+(?P<can_id>\d+)\s+'
+ r'\[(?P<dlc>\d+)\]\s*(?P<data>[a-z0-9 ]*)'
)
> lines = self._dut.readlines_until(regex=frame_regex, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E AssertionError: Did not find line ".*can@d4000\s+(?P<brs>\S)(?P<esi>\S)\s+(?P<can_id>\d+)\s+\[(?P<dlc>\d+)\]\s*(?P<data>[a-z0-9 ]*)" within 1.0 seconds
tests/drivers/can/host/pytest/can_shell.py:180: AssertionError
------------------------------ Captured log setup ------------------------------
Environment (please complete the following information):
- OS: (e.g. Linux )
- Toolchain (e.g Zephyr SDK)
- Commit SHA or Version used: v4.3.0-647-g0c4abcdd29fc
Metadata
Metadata
Labels
RegressionSomething, which was working, does not anymoreSomething, which was working, does not anymorearea: CANbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugplatform: NXPNXPNXP