Skip to content

Commit

Permalink
shield: add TiaC SC18IS604 Arduino as a shield
Browse files Browse the repository at this point in the history
Support the TiaC SC18IS604 evaluation shield with Arduino UNO R3
connector as shield abstraction.

Signed-off-by: Stephan Linz <[email protected]>
  • Loading branch information
rexut committed Sep 12, 2024
1 parent 7396504 commit 1e1b353
Show file tree
Hide file tree
Showing 23 changed files with 644 additions and 0 deletions.
22 changes: 22 additions & 0 deletions boards/shields/tcs-604/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config MFD
default y
depends on SHIELD_TCS_604_ARD

config SPI
default y
depends on SHIELD_TCS_604_ARD

config I2C
default y if DT_HAS_NXP_SC18IS604_I2C_ENABLED
depends on SHIELD_TCS_604_ARD

config GPIO
default y if DT_HAS_NXP_SC18IS604_GPIO_ENABLED
depends on SHIELD_TCS_604_ARD

config DYNAMIC_THREAD_POOL_SIZE
default 1 if MFD_SC18IS604_ASYNC && !DYNAMIC_THREAD_ALLOC
depends on SHIELD_TCS_604_ARD && MFD_SC18IS604
5 changes: 5 additions & 0 deletions boards/shields/tcs-604/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config SHIELD_TCS_604_ARD
def_bool $(shields_list_contains,tcs_604_ard)
11 changes: 11 additions & 0 deletions boards/shields/tcs-604/doc/grove_blinky.rsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This is based on the Zephyr sample :zephyr:code-sample:`zephyr:blinky`.

.. zephyr-app-commands::
:app: zephyr/samples/basic/blinky
:build-dir: tcs_604_ard
:board: nucleo_f746zg
:shield: "tcs_604_ard;grove_btn_d4;grove_led_d3;grove_sens_bmp280;tcs_604_x_grove_testbed"
:west-args: -p always
:goals: flash
:host-os: unix
:compact:
23 changes: 23 additions & 0 deletions boards/shields/tcs-604/doc/grove_bmp280.rsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
This is based on the Zephyr sample :ref:`zephyr:bme280`.

.. zephyr-app-commands::
:app: zephyr/samples/sensor/bme280
:build-dir: tcs_604_ard
:board: nucleo_f746zg
:shield: "tcs_604_ard;grove_btn_d4;grove_led_d3;grove_sens_bmp280;tcs_604_x_grove_testbed"
:west-args: -p always
:goals: flash
:host-os: unix
:compact:

.. parsed-literal::
:class: highlight-console notranslate

[00:00:00.005,000] <inf> mfd_sc18is604: sc18is604@0: found "SC18IS604 1.0.3"
[00:00:00.011,000] <dbg> BME280: bme280_chip_init: ID OK (BMP280)
[00:00:00.040,000] <dbg> BME280: bme280_chip_init: "bme280\ @\ 77" OK
\*\*\* Booting Zephyr OS build v3.7.0-116-g98e7aa72eb04 \*\*\*
Found device "bme280\ @\ 77", getting sensor data
temp: 26.671875; press: 98.640625; humidity: 1064960.0
temp: 26.671875; press: 98.640625; humidity: 1064960.0
… … …
12 changes: 12 additions & 0 deletions boards/shields/tcs-604/doc/grove_button.rsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This is based on the Bridle sample :ref:`button-sample` in polling mode.

.. zephyr-app-commands::
:app: bridle/samples/button
:build-dir: tcs_604_ard
:board: nucleo_f746zg
:shield: "tcs_604_ard;grove_btn_d4;grove_led_d3;grove_sens_bmp280;tcs_604_x_grove_testbed"
:conf: prj-poll.conf
:west-args: -p always
:goals: flash
:host-os: unix
:compact:
19 changes: 19 additions & 0 deletions boards/shields/tcs-604/doc/helloshell.rsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. image:: img/TCS-604-ARD-Grove-wiring.jpg
:scale: 85%
:align: center
:alt: TiaC SC18IS604 Arduino Wiring

Set ``--shield tcs_604_ard`` when you invoke ``west build``
or ``-DSHIELD=tcs_604_ard`` for ``cmake``. For example:

.. zephyr-app-commands::
:app: bridle/samples/helloshell
:build-dir: tcs_604_ard
:board: nucleo_f746zg
:shield: "tcs_604_ard"
:west-args: -p always
:goals: flash
:host-os: unix
:tool: all

.. include:: helloshell_console.rsti
175 changes: 175 additions & 0 deletions boards/shields/tcs-604/doc/helloshell_console.rsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
.. rubric:: Simple test execution on target

(text in bold is a command input)

.. tabs::

.. group-tab:: Basics

.. parsed-literal::
:class: highlight-console notranslate

:bgn:`uart:~$` **hello -h**
hello - say hello
:bgn:`uart:~$` **hello**
Hello from shell.

:bgn:`uart:~$` **hwinfo devid**
Length: 8
ID: 0x8c998be1de969148

:bgn:`uart:~$` **kernel version**
Zephyr version |zephyr_version_number_em|

:bgn:`uart:~$` **bridle version**
Bridle version |version_number_em|

:bgn:`uart:~$` **bridle version long**
Bridle version |longversion_number_em|

:bgn:`uart:~$` **bridle info**
Zephyr: |zephyr_release_number_em|
Bridle: |release_number_em|

:bgn:`uart:~$` **device list**
devices:
- rcc\ @\ 40023800 (READY)
DT node labels: rcc
- reset-controller (READY)
DT node labels: rctl
- interrupt-controller\ @\ 40013c00 (READY)
DT node labels: exti
- gpio\ @\ 40022800 (READY)
DT node labels: gpiok
- gpio\ @\ 40022400 (READY)
DT node labels: gpioj
- gpio\ @\ 40022000 (READY)
DT node labels: gpioi
- gpio\ @\ 40021C00 (READY)
DT node labels: gpioh
- gpio\ @\ 40021800 (READY)
DT node labels: gpiog
- gpio\ @\ 40021400 (READY)
DT node labels: gpiof
- gpio\ @\ 40021000 (READY)
DT node labels: gpioe
- gpio\ @\ 40020C00 (READY)
DT node labels: gpiod
- gpio\ @\ 40020800 (READY)
DT node labels: gpioc
- gpio\ @\ 40020400 (READY)
DT node labels: gpiob
- gpio\ @\ 40020000 (READY)
DT node labels: gpioa
- serial\ @\ 40011400 (READY)
DT node labels: usart6 arduino_serial
- serial\ @\ 40004800 (READY)
DT node labels: usart3
- adc\ @\ 40012000 (READY)
DT node labels: adc1
- dac\ @\ 40007400 (READY)
DT node labels: dac1
- flash-controller\ @\ 40023c00 (READY)
DT node labels: flash
- i2c\ @\ 40005800 (READY)
DT node labels: i2c2
- i2c\ @\ 40005400 (READY)
DT node labels: i2c1 arduino_i2c
- pwm (READY)
DT node labels: pwm1
- spi\ @\ 40013000 (READY)
DT node labels: spi1 arduino_spi
- sc18is604\ @\ 0 (READY)
DT node labels: sc18is604_0
- sc18is604-0-i2c (READY)
DT node labels: sc18is604_0_i2c tcs_604_i2c grove_i2c
- sc18is604-0-gpio (READY)
DT node labels: sc18is604_0_gpio
- leds (READY)
DT node labels: leds
- dietemp (READY)
DT node labels: die_temp
- vbat (READY)
DT node labels: vbat
- vref (READY)
DT node labels: vref

:bgn:`uart:~$` **history**
[ 0] history
[ 1] device list
[ 2] bridle info
[ 3] bridle version long
[ 4] bridle version
[ 5] kernel version
[ 6] hwinfo devid
[ 7] hello
[ 8] hello -h

.. group-tab:: GPIO

:hwftlbl-led:`LED`: operate with one of extra connected |LED Shields|
by :rpi-pico-pio:`IO3` at :hwftlbl-con:`D3` (see wiring above):

.. parsed-literal::
:class: highlight-console notranslate

:bgn:`uart:~$` **gpio get sc18is604-0-gpio 3**
0

:bgn:`uart:~$` **gpio conf sc18is604-0-gpio 3 oh0**
:bgn:`uart:~$` **gpio set sc18is604-0-gpio 3 1**
:bgn:`uart:~$` **gpio set sc18is604-0-gpio 3 0**

:bgn:`uart:~$` **gpio blink sc18is604-0-gpio 3**
Hit any key to exit

:hwftlbl-btn:`BTN`: operate with one of extra connected |Button Shields|
by :rpi-pico-pio:`IO4` at :hwftlbl-con:`D4` (see wiring above):

.. parsed-literal::
:class: highlight-console notranslate

:bgn:`uart:~$` **gpio get sc18is604-0-gpio 4**
0

:bgn:`uart:~$` **gpio conf sc18is604-0-gpio 4 iuh**
:bgn:`uart:~$` **gpio get sc18is604-0-gpio 4**
0
:bgn:`uart:~$` **gpio get sc18is604-0-gpio 4**
1
:bgn:`uart:~$` **gpio get sc18is604-0-gpio 4**
0

.. group-tab:: I2C

There are no on-shield I2C devices. For this example the
|Grove BMP280 Sensor|_ was connected (see wiring above and
|Sensor Shields|). Scan the I2C devices:

.. parsed-literal::
:class: highlight-console notranslate

:bgn:`uart:~$` **i2c scan sc18is604-0-i2c**
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
1 devices found on sc18is604-0-i2c

The I2C address ``0x77`` is a Bosch BMP280 Air Pressure Sensor and their
Chip-ID can read from register ``0xd0``. The Chip-ID must be ``0x58``:

.. parsed-literal::
:class: highlight-console notranslate

:bgn:`uart:~$` **i2c read_byte sc18is604-0-i2c 77 d0**
Output: 0x58

.. |LED Shields| replace:: :ref:`grove_led_shield`
.. |Button Shields| replace:: :ref:`grove_button_shield`
.. |Sensor Shields| replace:: :ref:`grove_sensor_shield`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added boards/shields/tcs-604/doc/img/TCS-604-ARD.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1e1b353

Please sign in to comment.