Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
19914: boards: complete SD Card MTD definition for several bords r=benpicco a=gschorcht

### Contribution description

This PR completes the MTD definition for the following boards:
- `seeedstudio-gd32`
- `sipeed-longan-nano` including `sipeed-longan-nano-tft`
- `waveshare-nrf52840-eval-kit`
- ESP32x boards that have an SPI SD Card interface and use `mtd_sdcard_default`

### Testing procedure

Green CI

### Issues/PRs references#19465 

Prerequisite for PR #19465 

19915: drivers/lcd: support MCU 8080 8-bit parallel mode r=benpicco a=gschorcht

### Contribution description

LCD driver ICs usually support
- SPI serial mode,
- MCU 8080 8-bit parallel mode and
- MCU 8080 16-bit parallel mode.

This PR extends the LCD display driver API to support the MCU 8080 8-/16-bit parallel modes and implements a GPIO-driven MCU 8080 8-bit parallel mode.

The following features are already working locally and will be provided as follow-on PRs for which this PR is a prerequisite.

- GPIO-driven bit-banging implementation of the 16-bit mode of the MCU 8080 parallel interface
- Enabling the display on `stm32f723e-disco` and `stm32l496g-disco` using the feature above
- Definition of a low-level API for the parallel modes using the LCD controller of the MCU
- Using FMC for the display on `stm32f723e-disco` and `stm32l496g-disco`
- Using LCD controller for the display of `esp32-wt32-sc01-plus` (PR #19917)

### Testing procedure

The PR can be tested with PR #19917 on top of this PR.
```
BOARD=esp32s3-wt32-sc01-plus make -j8 -C tests/drivers/st77xx flash
```
The following video shows the test.

**Please note** The test is pretty slow because the display has 480 x 320 pixels and the MCU 8080 8-bit parallel interface is realized by a GPIO-driven bit-banging implementation where each GPIO of the data bus is set separately. A follow-up PR will use the ESP32-S3 LCD controller and DMA for this board. This PR just defines the extension of the driver by the parallel interface and provides the bit-banging implementation for MCUs that don't have a LCD controller on chip.

https://github.com/RIOT-OS/RIOT/assets/31932013/c1e3e3d7-05d9-4ca5-8fff-9a5eaca50fba

### Issues/PRs references

19919: drivers/st77xx: introduce rotation defines r=benpicco a=gschorcht

### Contribution description

The PR introduces counterclockwise rotations for the definition of parameter `ST77XX_PARAM_ROTATION`.

It is more intuitive and universal to use `ST77XX_ROTATION_{0,90,180,270}` instead of `ST77XX_ROTATION_{ST77XX_ROTATION_{VERT,VERT_FLIP,HORZ,HORZ_FLIP}`, especially because the orientation of the display may vary with respect to the orientation of the board.

### Testing procedure

`tests/drivers/st77xx` should still work, for example:
```
BOARD=adafruit-pybadge make -C tests/drivers/st77xx flash
```
```
BOARD=esp32s3-usb-otg make -j8 -C tests/drivers/st77xx flash
```

### Issues/PRs references


19931: boards: fix documentation for GD32V boards and doxygen 1.9.4 r=benpicco a=gschorcht

### Contribution description

This PR fixes some small problems in documentation of `sipeed-longan-nano`, `sipeed-longan-nano-tft` and `seeedstudio-gd32` for doxygen 1.9.4 that is used on `doc.riot-os.org`.

Doxygen version 1.9.4 doesn't like anymore
- single double quotes as symbol for the inches unit in the text
- line breaks in `[]()` to avoid exhausting the 100 characters per line.

See https://doc.riot-os.org/group__boards__sipeed__longan__nano.html for example.

Doxygen 1.9.1 which is part of `riot-docker` container didn't have theses problems 😟

### Testing procedure

Documentation should be fixed.

### Issues/PRs references


19935: boards/nucleo64: fix SPI Arduino mapping for most boards r=benpicco a=maribu

### Contribution description

Before, the Arduino SPI mapping for all Nucleo-64 boards was incorrect. With this, the situation improves to the following:

- [x] nucleo-f030r8
- [ ] nucleo-f070rb
    - No SPI buses provided.
- [x] nucleo-f072rb
- [x] nucleo-f091rc
- [x] nucleo-f103rb
- [ ] nucleo-f302r8
    - No SPI bus at D11, D12, D13 provided
- [x] nucleo-f303re
- [x] nucleo-f334r8
- [x] nucleo-f401re
- [x] nucleo-f410rb
- [x] nucleo-f411re
- [x] nucleo-f446re
- [x] nucleo-g070rb
- [x] nucleo-g071rb
- [x] nucleo-g431rb
- [x] nucleo-g474re
- [x] nucleo-l053r8
- [x] nucleo-l073rz
- [x] nucleo-l152re
    - No SPI bus at D11, D12, D13 provided
- [x] nucleo-l452re
- [x] nucleo-l476rg
- [x] nucleo-wl55jc

The remaining offenders still need to be fixed, but that is better done one PR at a time.

### Testing procedure

- Check if the SPI device provided in the given `boards/<BOARD_NAME>/incude/periph_conf.h` is indeed `SPI_DEV(0)`, or in `periph_conf.h` the correct SPI dev is found
    - this should be fine for all boards above, except for the unchecked ones

or:

- run #19932: The SPI test should pass now

### Issues/PRs references

Bug found in #19932 (comment)

Co-authored-by: Gunar Schorcht <[email protected]>
Co-authored-by: Marian Buschsieweke <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2023
6 parents 3ce4939 + f4c23e8 + b0ec24b + af9e120 + c58d71a + 4524880 commit 99e9486
Show file tree
Hide file tree
Showing 20 changed files with 570 additions and 95 deletions.
2 changes: 1 addition & 1 deletion boards/adafruit-pybadge/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extern "C" {
#define ST77XX_PARAM_RGB_CHANNELS (128U) /**< Number of screen rgb channel (height) */

Check warning on line 76 in boards/adafruit-pybadge/include/board.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
#define ST77XX_PARAM_RGB (1) /**< RGB configuration */
#define ST77XX_PARAM_INVERTED (0) /**< Inversion configuration */
#define ST77XX_PARAM_ROTATION (ST77XX_ROTATION_HORZ_FLIP) /**< Rotation mode */
#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_90 /**< Rotation mode */
#define LCD_SCREEN_WIDTH (ST77XX_PARAM_NUM_LINES) /**< LCD screen width */
#define LCD_SCREEN_HEIGHT (ST77XX_PARAM_RGB_CHANNELS) /**< LCD screen height */
/** @} */
Expand Down
12 changes: 8 additions & 4 deletions boards/common/esp32x/include/board_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ extern "C" {
#define SPI_FLASH_DRIVE_START 0
#endif

/** Default MTD drive definition */
#define MTD_0 mtd0
#define MTD_0 mtd0 /**< Flash MTD device */
extern mtd_dev_t *mtd0; /**< Flash MTD device pointer */

/** Pointer to the default MTD drive structure */
extern mtd_dev_t *mtd0;
#if MODULE_MTD_SDCARD_DEFAULT || DOXYGEN

#define MTD_1 mtd1 /**< SD Card MTD device */
extern mtd_dev_t *mtd1; /**< SD Card MTD device pointer */

#endif /* MODULE_MTD_SDCARD_DEFAULT || DOXYGEN */

/**
* @brief MTD offset for SD Card interfaces
Expand Down
5 changes: 4 additions & 1 deletion boards/common/nucleo64/include/arduino_iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "periph/gpio.h"
#include "periph/adc.h"
#include "periph_conf.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -43,7 +44,9 @@ extern "C" {
/**
* @brief SPI_DEV(1) is connected to D11/D12/D13
*/
#define ARDUINO_SPI_D11D12D13 SPI_DEV(1)
#if !defined(ARDUINO_SPI_D11D12D13) && defined(SPI_NUMOF)
#define ARDUINO_SPI_D11D12D13 SPI_DEV(0)
#endif
/** @} */

/**
Expand Down
2 changes: 1 addition & 1 deletion boards/esp32s2-lilygo-ttgo-t8/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
#define ST77XX_PARAM_INVERTED 1 /**< Inverted mode enable */
#define ST77XX_PARAM_NUM_LINES 240U /**< Number of lines */
#define ST77XX_PARAM_RGB_CHANNELS 135U /**< Number of columns */
#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_HORZ /**< Rotation */
#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_270 /**< Rotation */
#define ST77XX_PARAM_OFFSET_X 40 /**< X offset */
#define ST77XX_PARAM_OFFSET_Y 52 /**< Y offset */
#endif
Expand Down
2 changes: 1 addition & 1 deletion boards/esp32s3-usb-otg/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
#define ST77XX_PARAM_RST LCD_RST
#define ST77XX_PARAM_NUM_LINES 240
#define ST77XX_PARAM_RGB_CHANNELS 240
#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_VERT
#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_0
#define ST77XX_PARAM_INVERTED 1
#define ST77XX_PARAM_RGB 1

Expand Down
10 changes: 4 additions & 6 deletions boards/seeedstudio-gd32/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

## Overview

The [Seedstudio GD32 RISC-V Dev Board]
(https://wiki.seeedstudio.com/SeeedStudio-GD32-RISC-V-Dev-Board/) is a
The [Seedstudio GD32 RISC-V Dev Board](https://wiki.seeedstudio.com/SeeedStudio-GD32-RISC-V-Dev-Board/) is a
development board for the GigaDevice GD32VF103VBT6 MCU with the following
on-board components:

Expand Down Expand Up @@ -147,11 +146,10 @@ All other pins are either not broken out or have no special usage.

## Flashing the Device

The board is flashed via a JTAG interface with OpenOCD (at least [release version 0.12.0]
(https://github.com/openocd-org/openocd/tree/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c)).
The board is flashed via a JTAG interface with OpenOCD (at least
[release version 0.12.0](https://github.com/openocd-org/openocd/tree/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c)).
By default, an FTDI adapter according to the configuration defined in
[`interface/openocd-usb.cfg`]
(https://github.com/openocd-org/openocd/blob/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c/tcl/interface/ftdi/openocd-usb.cfg)
[`interface/openocd-usb.cfg`](https://github.com/openocd-org/openocd/blob/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c/tcl/interface/ftdi/openocd-usb.cfg)
is assumed.
```
BOARD=seeedstudio-gd32 make -C examples/hello-world flash
Expand Down
19 changes: 19 additions & 0 deletions boards/seeedstudio-gd32/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ extern "C" {
#define LED_BLUE_PIN LED2_PIN /**< LED2 is blue */
/** @} */

/**
* @name MTD configuration
* @{
*/
#define MTD_0 mtd0 /**< MTD device for SD Card */
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
/** @} */

/**
* @name SD-Card interface configuration
* @{
*/
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0)
#define SDCARD_SPI_PARAM_CS GPIO_PIN(PORT_B, 12)
#define SDCARD_SPI_PARAM_CLK GPIO_PIN(PORT_B, 13)
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(PORT_B, 14)
#define SDCARD_SPI_PARAM_MOSI GPIO_PIN(PORT_B, 15)
/** @} */

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion boards/sipeed-longan-nano-tft/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ that is equipped with a TFT display with the following on-board components:
- USB Type C
- TF card slot
- 3 user LEDs
- 0.96" TFT display 160 x 80 pixel
- 0.96 inches TFT display 160 x 80 pixel

@image html "https://media-cdn.seeedstudio.com/media/catalog/product/cache/7f7f32ef807b8c2c2215b49801c56084/1/1/114992425_1.jpg" "Sipeed Longan Nano" width=600

Expand Down
13 changes: 6 additions & 7 deletions boards/sipeed-longan-nano/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ on-board components:
- USB Type C
- TF card slot
- 3 user LEDs
- 0.96" TFT display 160 x 80 pixel (optional)
- 0.96 inches TFT display 160 x 80 pixel (optional)

@image html "https://media-cdn.seeedstudio.com/media/catalog/product/cache/7f7f32ef807b8c2c2215b49801c56084/1/1/114992425_1.jpg" "Sipeed Longan Nano" width=600
@image html "https://wiki.sipeed.com/hardware/assets/Longan/nano/Longan_nano.124.jpg" "Sipeed Longan Nano" width=600

## Hardware:
## Hardware

| MCU | GD32VF103CBT6 | Supported |
|:----------- |:-------------------------------------- | --------- |
Expand Down Expand Up @@ -173,11 +173,10 @@ BOARD=sipeed-longan-nano-tft make -C examples/hello-world flash

### Using an external debug adapter

The board can also be flashed via a JTAG interface with OpenOCD (at least [release version 0.12.0]
(https://github.com/openocd-org/openocd/tree/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c)).
The board can also be flashed via a JTAG interface with OpenOCD (at least
[release version 0.12.0](https://github.com/openocd-org/openocd/tree/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c)).
By default, an FTDI adapter according to the configuration defined in
[`interface/openocd-usb.cfg`]
(https://github.com/openocd-org/openocd/blob/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c/tcl/interface/ftdi/openocd-usb.cfg)
[`interface/openocd-usb.cfg`](https://github.com/openocd-org/openocd/blob/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c/tcl/interface/ftdi/openocd-usb.cfg)
is assumed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROGRAMMER=openocd BOARD=sipeed-longan-nano make -C examples/hello-world flash
Expand Down
17 changes: 14 additions & 3 deletions boards/sipeed-longan-nano/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,24 @@ extern "C" {
#define LED_BLUE_PIN LED2_PIN /**< LED2 is blue */
/** @} */

#if defined(MODULE_SDCARD_SPI)
/**
* @name MTD configuration
* @{
*/
#define MTD_0 mtd0 /**< MTD device for SD Card */
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
/** @} */

/**
* @name SD-Card interface configuration
* @{
*/
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0)
#define SDCARD_SPI_PARAM_CS GPIO_PIN(PORT_B, 12)
#define SDCARD_SPI_PARAM_CLK GPIO_PIN(PORT_B, 13)
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(PORT_B, 14)
#define SDCARD_SPI_PARAM_MOSI GPIO_PIN(PORT_B, 15)
#endif
/** @} */

#if defined(MODULE_ST77XX) && defined(BOARD_SIPEED_LONGAN_NANO_TFT)
#define ST77XX_PARAM_SPI SPI_DEV(1) /**< SPI device */
Expand All @@ -81,7 +92,7 @@ extern "C" {
#define ST77XX_PARAM_INVERTED 1 /**< Inverted mode enable */
#define ST77XX_PARAM_NUM_LINES 160U /**< Number of lines */
#define ST77XX_PARAM_RGB_CHANNELS 80U /**< Number of columns */
#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_HORZ /**< Rotation mode */
#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_270 /**< Rotation mode */
#define ST77XX_PARAM_OFFSET_Y 25 /**< Vertical offset */
#endif

Expand Down
9 changes: 9 additions & 0 deletions boards/waveshare-nrf52840-eval-kit/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define BOARD_H

#include "board_common.h"
#include "mtd.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -82,6 +83,14 @@ extern "C" {
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(0, 20)
/** @} */

/**
* @name MTD configuration
* @{
*/
#define MTD_0 mtd0 /**< MTD device for SD Card */
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
/** @} */

#ifdef __cplusplus
}
#endif
Expand Down
39 changes: 35 additions & 4 deletions drivers/ili9341/include/ili9341_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,45 @@ extern "C" {
#define ILI9341_PARAM_OFFSET_Y 0 /**< Vertival offset */
#endif

#if MODULE_LCD_SPI || DOXYGEN
/** Default interface params if SPI serial interface is enabled */
#define ILI9341_PARAM_IF_SPI .spi = ILI9341_PARAM_SPI, \
.spi_clk = ILI9341_PARAM_SPI_CLK, \
.spi_mode = ILI9341_PARAM_SPI_MODE,
#else
#define ILI9341_PARAM_IF_SPI
#endif

#if MODULE_LCD_PARALLEL || DOXYGEN
/** Default interface params if MCU 8080 8-bit parallel interface is enabled */
#define ILI9341_PARAM_IF_PAR .d0_pin = ILI9341_PARAM_D0, \
.d1_pin = ILI9341_PARAM_D1, \
.d2_pin = ILI9341_PARAM_D2, \
.d3_pin = ILI9341_PARAM_D3, \
.d4_pin = ILI9341_PARAM_D4, \
.d5_pin = ILI9341_PARAM_D5, \
.d6_pin = ILI9341_PARAM_D6, \
.d7_pin = ILI9341_PARAM_D7, \
.wrx_pin = ILI9341_PARAM_WRX, \
.rdx_pin = ILI9341_PARAM_RDX,
#else
#define ILI9341_PARAM_IF_PAR
#endif

/**
* @brief Default params
*
* @note The default parameter set defined here can only be used if a single
* ILI9341 display and only one interface mode is used. If multiple
* ILI9341 displays are used or if multiple interface modes are enabled
* by the modules `lcd_spi`, lcd_parallel and `lcd_parallel_16bit`, a user
* defined parameter set @ref ILI9341_PARAMS has to be defined. In the
* latter case @ref lcd_params_t::spi must then be set to @ref SPI_UNDEF
* for displays with MCU 8080 8-/16-bit parallel interfaces.
*/
#ifndef ILI9341_PARAMS
#define ILI9341_PARAMS { .spi = ILI9341_PARAM_SPI, \
.spi_clk = ILI9341_PARAM_SPI_CLK, \
.spi_mode = ILI9341_PARAM_SPI_MODE, \
#define ILI9341_PARAMS { ILI9341_PARAM_IF_SPI \
ILI9341_PARAM_IF_PAR \
.cs_pin = ILI9341_PARAM_CS, \
.dcx_pin = ILI9341_PARAM_DCX, \
.rst_pin = ILI9341_PARAM_RST, \
Expand Down Expand Up @@ -124,7 +156,6 @@ static const uint8_t ili9341_screen_ids[] =
*/
#define ILI9341_SCREEN_NUMOF ARRAY_SIZE(ili9341_screen_ids)


#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit 99e9486

Please sign in to comment.