Skip to content

Commit

Permalink
Merge pull request RIOT-OS#29 from MrKevinWeiss/pr/add/spi
Browse files Browse the repository at this point in the history
 tests/periph_spi: Add test to expose spi API
  • Loading branch information
smlng authored Dec 4, 2019
2 parents fb02f8b + 336976c commit 9d418dd
Show file tree
Hide file tree
Showing 12 changed files with 656 additions and 10 deletions.
16 changes: 8 additions & 8 deletions dist/etc/conf/slstk3401a.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ HIL_DUT_TX_GPIO?="PD11/EXP-14"
HIL_DUT_TX_PORT?=3
HIL_DUT_TX_PIN?=11

HIL_DUT_NSS_GPIO?="PA9/EXT-10"
HIL_DUT_NSS_PORT?=0
HIL_DUT_NSS_GPIO?="PC9/EXT-10"
HIL_DUT_NSS_PORT?=2
HIL_DUT_NSS_PIN?=9

HIL_DUT_SCK_GPIO?="PA8/EXT-8"
HIL_DUT_SCK_PORT?=0
HIL_DUT_SCK_GPIO?="PC8/EXT-8"
HIL_DUT_SCK_PORT?=2
HIL_DUT_SCK_PIN?=8

HIL_DUT_MISO_GPIO?="PA7/EXT-6"
HIL_DUT_MISO_PORT?=0
HIL_DUT_MISO_GPIO?="PC7/EXT-6"
HIL_DUT_MISO_PORT?=2
HIL_DUT_MISO_PIN?=7

HIL_DUT_MOSI_GPIO?="PA6/EXT-4"
HIL_DUT_MOSI_PORT?=0
HIL_DUT_MOSI_GPIO?="PC6/EXT-4"
HIL_DUT_MOSI_PORT?=2
HIL_DUT_MOSI_PIN?=6

HIL_DUT_SCL_GPIO?="PC11/EXT-15"
Expand Down
12 changes: 12 additions & 0 deletions tests/periph_spi/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include ../Makefile.tests_common

FEATURES_REQUIRED = periph_spi

USEMODULE += shell
USE_JSON_SHELL_PARSER ?= 1

export HIL_SPI_DEV
export HIL_DUT_NSS_PORT
export HIL_DUT_NSS_PIN

include $(RIOTBASE)/Makefile.include
63 changes: 63 additions & 0 deletions tests/periph_spi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Periph SPI Test

This application enables you to test all available low-level SPI functions
using the RIOT shell. The `robot-test` feature requires a target board to be
connected to the hardware reference board PHiLIP.

## Automated Test Setup

Before executing the automated test, the DUT and reference hardware PHiLIP
must be setup.

### Robot Framework Setup

Follow the [setup instructions](../../README.md) and install all python
packages needed.

### PHiLIP Setup

To setup PHiLIP follow instructions on the
[PHiLIP repo](https://github.com/riot-appstore/PHiLIP#setup).

### DUT and PHiLIP Wiring Setup

Each test will need to be wired in a specific way. To wire the DUT follow
the [guide to board pinouts](http://doc.riot-os.org/group__boards.html#pinout_guide).
To wire PHiLIP check the [pinout](https://github.com/riot-appstore/PHiLIP#pinb)
for the PHiLIP version used.

This test will require that `sck`, `mosi`, `miso`, `nss` all need to be wired.
be wired to the `DUT_SCK`, `DUT_MOSI`, `DUT_MISO` and `DUT_NSS` pins on PHiLIP.
If the device has a reset pin then the optional `DUT_RST` pin on PHiLIP can be
connected.

DUT pin name | PHiLIP pin name | Required
-------------|-----------------|---------
sck | DUT_SCK | Yes
mosi | DUT_MOSI | Yes
miso | DUT_MISO | Yes
nss or cs | DUT_NSS | Yes
nrst | DUT_RST | No
gnd | GND | Yes _(sometimes usb grounds are enough)_


## Running Automated Tests

After the setup is complete use the following command to execute the robot test:

`HIL_DUT_NSS_PORT=<my_port> HIL_DUT_NSS_PIN=<my_pin>
PHILIP_PORT=<philip_serial_port> BOARD=<DUT_BOARD_NAME> make flash robot-test`

### Configuring run parameters

A number of settings can be adjusted such as changing timeouts or using the
PHiLIP reset instead of using `make reset`. This information can be found at
in the [robot framework make overrides](../README.md).

Specific parameters can be set for this test when running `robot-tests`.

ENV Name | Description | Default
-----------------|---------------------------------------|---------
HIL_SPI_DEV | The device number in the periph array | 0
HIL_DUT_NSS_PORT | The nss or cs port assignment | REQUIRED
HIL_DUT_NSS_PIN | The nss or cs pin assignment | REQUIRED
Loading

0 comments on commit 9d418dd

Please sign in to comment.