Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: drivers: can: timing: rework the CAN controller driver timing tests #70224

Conversation

henrikbrixandersen
Copy link
Member

@henrikbrixandersen henrikbrixandersen commented Mar 14, 2024

  • Move the test for setting the minimum/maximum supported timing parameters, setting a too high bitrate, and setting invalid sample points from the CAN timing tests to the CAN API tests as these are validating basic API behavior.
  • Remove tests for additional sample points as this does not provide any real value. The purpose of the CAN timing test suite is to see if the selected CAN clock allows meeting the standard bitrates and sample points used by Zephyr. Any tweaking needed for a specific board or system design is left up to the user and not something that can be covered by testing a few additional sample point locations.
  • Add tests for all CAN bitrates recommended by CAN in Automation (CiA). The newly added bitrate tests are guarded by new, local Kconfig option (CONFIG_TEST_ALL_BITRATES) to avoid breaking existing board tests. Some boards may need adjustments to their CAN core clock in order to pass the newly added tests. Once a board is confirmed to meet these additional checks, this Kconfig can be enabled for that board to avoid future regressions.
  • Some CAN controllers may be unable to meet all bitrates due to timing restrictions, but assert that at least one of the tested bitrates was supported.
  • Use the CAN clock and configuration ranges recommended by CAN in Automation (CiA) for the can_loopback.c and can_fake.c drivers.
  • Enable testing of all CiA recommended bitrates on the following simulated/emulated boards:
    • native_sim
    • native_sim_64
    • native_posix
    • native_posix_64
    • qemu_x86
    • qemu_x86_64
  • Enable testing of all CiA recommended bitrates on the following boards:
    • stm32h735g_disco

Note: This PR is best reviewed commit-by-commit.

Move the test for setting the minimum/maximum supported timing parameters
from the CAN timing tests to the CAN API tests as these are validating
basic API behavior.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Move the tests for setting a too high bitrate from the CAN timing tests to
the CAN API tests as these are validating basic API behavior.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
… suite

Move the tests for using invalid sample points from the CAN timing tests to
the CAN API tests as these are validating basic API behavior.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Remove now unused support for specifying invalid timing test
configurations.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Remove tests for additional sample points as this does not provide any real
value.

The purpose of this test suite is to see if the selected CAN clock allows
meeting the standard bitrates and sample points used by Zephyr. Any
tweaking needed for a specific board or system design is left up to the
user and not something that can be covered by testing a few additional
sample point locations.

Change a few comments and remove an unneeded conditional while here.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Add tests for all CAN bitrates recommended by CAN in Automation (CiA). The
newly added bitrate tests are guarded by new, local Kconfig option
(CONFIG_TEST_ALL_BITRATES) to avoid breaking existing board tests.

Some boards may need adjustments to their CAN core clock in order to pass
the newly added tests. Once a board is confirmed to meet these additional
checks, this Kconfig can be enabled for that board to avoid future
regressions.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Some CAN controllers may be unable to meet all bitrates due to timing
restrictions, but assert that at least one of the tested bitrates was
supported.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Use the CAN clock and configuration ranges recommended by CAN in Automation
(CiA).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Use the CAN clock and configuration ranges recommended by CAN in Automation
(CiA). Adjust the CAN shell test, which makes use of the fake CAN
controller driver, to match the new timing limits.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Enable testing of all CiA recommended bitrates on the following
simulated/emulated boards:
- native_sim
- native_sim_64
- native_posix
- native_posix_64
- qemu_x86
- qemu_x86_64

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Enable testing of all CiA recommended bitrates on the following boards:
  - stm32h735g_disco

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
@henrikbrixandersen henrikbrixandersen marked this pull request as ready for review March 15, 2024 08:37
Copy link
Collaborator

@str4t0m str4t0m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!
I don't have access to all CiA documents referenced, but seems all reasonable.

tests/drivers/can/timing/src/main.c Show resolved Hide resolved
@henrikbrixandersen henrikbrixandersen merged commit c6583e7 into zephyrproject-rtos:main Mar 19, 2024
23 checks passed
@henrikbrixandersen henrikbrixandersen deleted the can_test_timing_rework branch March 19, 2024 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants