forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers: stepper: test: Added drv8424 driver tests
Adds 2 test suites for the drv8424 stepper driver, testing API conformity and return values in the first suite and gpio pin values in the second suite Signed-off-by: Jan Behrens <[email protected]>
- Loading branch information
1 parent
79d6294
commit 4bd2ab7
Showing
14 changed files
with
890 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2024 Navimatix GmbH | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(stepper_drv8424_api) | ||
target_sources(app PRIVATE | ||
src/main.c | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2024 Navimatix GmbH | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config ENTROPY_GENERATOR | ||
depends on ZTEST_SHUFFLE | ||
bool "Shuffle the order of tests and suites" | ||
default y | ||
|
||
source "Kconfig.zephyr" |
61 changes: 61 additions & 0 deletions
61
tests/drivers/stepper/drv8424/api/boards/mimxrt1060_evkb.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2024 Navimatix GmbH | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/dt-bindings/gpio/gpio.h> | ||
|
||
/ { | ||
zephyr,user { | ||
stepper-motors = <&drv8424 0>; | ||
}; | ||
}; | ||
|
||
&lpi2c1 { | ||
status = "okay"; | ||
|
||
mikroe_stepper_gpios: mikroe_stepper_ctrl_tca9538a@70 { | ||
status = "okay"; | ||
compatible = "ti,tca9538"; | ||
|
||
reg = <0x70>; | ||
|
||
gpio-controller; | ||
ngpios = <8>; | ||
#gpio-cells = <2>; | ||
|
||
gpio-reserved-ranges = <7 1>; | ||
|
||
gpio-line-names = | ||
"M0", | ||
"M1", | ||
"DEC0", | ||
"DEC1", | ||
"TOFF", | ||
"STP", | ||
"DIR"; | ||
}; | ||
}; | ||
|
||
/ { | ||
drv8424: drv8424 { | ||
status = "okay"; | ||
compatible = "ti,drv8424"; | ||
|
||
dir-gpios = <&arduino_header 9 0>; /* D3 */ | ||
step-gpios = <&arduino_header 10 0>; /* D4 */ | ||
sleep-gpios = <&arduino_header 8 GPIO_ACTIVE_LOW>; /* D2 */ | ||
en-gpios = <&arduino_header 11 0>; /* D5 */ | ||
m0-gpios = <&mikroe_stepper_gpios 0 0>; | ||
m1-gpios = <&mikroe_stepper_gpios 1 0>; | ||
counter = <&pit0_channel0>; | ||
|
||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
#stepper-motor-cells = <0>; | ||
}; | ||
}; | ||
|
||
&pit0_channel0 { | ||
status = "okay"; | ||
}; |
47 changes: 47 additions & 0 deletions
47
tests/drivers/stepper/drv8424/api/boards/native_sim.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2024 Navimatix GmbH | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/dt-bindings/gpio/gpio.h> | ||
|
||
/ { | ||
drv8424: drv8424 { | ||
status = "okay"; | ||
compatible = "ti,drv8424"; | ||
|
||
|
||
dir-gpios = <&gpio1 0 0>; /* D3 */ | ||
step-gpios = <&gpio1 1 0>; /* D4 */ | ||
sleep-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>; /* D2 */ | ||
en-gpios = <&gpio2 1 0>; /* 5 */ | ||
m0-gpios = <&gpio3 0 0>; | ||
m1-gpios = <&gpio3 1 0>; | ||
counter = <&counter0>; | ||
|
||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
#stepper-motor-cells = <0>; | ||
}; | ||
|
||
gpio1: gpio1 { | ||
compatible = "zephyr,gpio-emul"; | ||
#gpio-cells = <0x2>; | ||
status = "okay"; | ||
gpio-controller; | ||
}; | ||
|
||
gpio2: gpio2 { | ||
compatible = "zephyr,gpio-emul"; | ||
#gpio-cells = <0x2>; | ||
status = "okay"; | ||
gpio-controller; | ||
}; | ||
|
||
gpio3: gpio3 { | ||
compatible = "zephyr,gpio-emul"; | ||
#gpio-cells = <0x2>; | ||
status = "okay"; | ||
gpio-controller; | ||
}; | ||
}; |
64 changes: 64 additions & 0 deletions
64
tests/drivers/stepper/drv8424/api/boards/nucleo_f767zi.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2024 Navimatix GmbH | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/dt-bindings/gpio/gpio.h> | ||
|
||
/ { | ||
zephyr,user { | ||
stepper-motors = <&drv8424 0>; | ||
}; | ||
}; | ||
|
||
&i2c1 { | ||
status = "okay"; | ||
|
||
mikroe_stepper_gpios: mikroe_stepper_ctrl_tca9538a@70 { | ||
status = "okay"; | ||
compatible = "ti,tca9538"; | ||
|
||
reg = <0x70>; | ||
|
||
gpio-controller; | ||
ngpios = <8>; | ||
#gpio-cells = <2>; | ||
|
||
gpio-reserved-ranges = <7 1>; | ||
|
||
gpio-line-names = | ||
"M0", | ||
"M1", | ||
"DEC0", | ||
"DEC1", | ||
"TOFF", | ||
"STP", | ||
"DIR"; | ||
}; | ||
}; | ||
|
||
/ { | ||
drv8424: drv8424 { | ||
status = "okay"; | ||
compatible = "ti,drv8424"; | ||
|
||
dir-gpios = <&arduino_header 18 0>; /* D12 */ | ||
step-gpios = <&arduino_header 19 0>; /* D13 */ | ||
sleep-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>; /* D9 */ | ||
en-gpios = <&arduino_header 14 0>; /* D8 */ | ||
m0-gpios = <&mikroe_stepper_gpios 0 0>; | ||
m1-gpios = <&mikroe_stepper_gpios 1 0>; | ||
counter = <&counter2>; | ||
|
||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
#stepper-motor-cells = <0>; | ||
}; | ||
}; | ||
|
||
&timers2 { | ||
status = "okay"; | ||
counter2: counter { | ||
status = "okay"; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright (c) 2024 Navimatix GmbH | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
CONFIG_ZTEST=y | ||
CONFIG_TEST=y | ||
CONFIG_TEST_USERSPACE=y | ||
CONFIG_LOG=y | ||
CONFIG_STEPPER_LOG_LEVEL_DBG=y | ||
CONFIG_STEPPER=y | ||
CONFIG_POLL=y | ||
CONFIG_I2C=y | ||
CONFIG_GPIO=y |
Oops, something went wrong.