firmwaremodules / STM32CubeL0

STM32Cube MCU Full Package for the STM32L0 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
1 stars 0 forks source link

Add support for Adafruit 1.8" TFT Shield V2 to STM32CubeL0 #1

Open firmwareguru opened 3 years ago

firmwareguru commented 3 years ago

Support for the newer Adafruit 1.8" TFT Shield V2 is now available for the STM32CubeL0 firmware system in this branch. The examples previously only supported the older V1 board which is no longer available (plus the SD card driver was broken - see https://github.com/STMicroelectronics/STM32CubeL0/pull/13). The V2 board adds an I2C expander to access the joystick, buttons and LCD backlight and reset IO. The expander is called the seesaw and the driver has been ported from here into a separate component under Drivers\BSP\Components.

This shield is a useful addition to the Nucleo ecosystem for building prototypes where user interaction would be helpful.

Adafruit_shield_nucleo_fm_logo

Quickstart

Setup

Solder the Arduino shield headers as shown in the shield user guide. Don't solder the 6-pin dual-row header.

The Shield has a 6-pin dual-row header beside the SD card slot that requires 3 wires to be run to the appropriate digital I/O pins to route SPI from the Nucleo to the display and SD card. Connect them to the free holes marked D11,D12,D13 at the top as follows, looking down at the 6-pin dual-row header with the shield oriented with SD card slot to the right:

Func Pin Pin Func
MISO D12 N/C
SCK D13 D11 MOSI
N/C N/C

A FAT(32) formatted SD-card hosting 128w x 160h RGB565 BMP images is required. These images can be copied from Utilities\Media\Pictures\BMP_128x160. It is more difficult to create your own as most available tools generate C-arrays of raw RBG565 image data. However, this online tool is able to convert png or jpg to bmp files of the correct 16-bit RGB565 format. The image file names must be 11-character maximum and sit in the root directory.

Lastly, attach the shield to a NUCLEO-L073RZ.

Project

An STM32CubeIDE project has been created for NUCLEO-L073RZ\Demonstrations\Adafruit_LCD_1_8_SD_Joystick. Import this project into your STM32CubeIDE workspace, build and debug it. The display will show a menu requiring use of the joystick to select the picture mode.

Integrating into another project

  1. Add USE_ADAFRUIT_SHIELD_V2 to the IDE preprocessor defines.
  2. Add BSP/Components/adafruit_seesaw/adafruit_seesaw.c to the project.
  3. Ensure HAL_I2C_MODULE_ENABLED is set in stm32l0xx_hal_conf.h and that stm32l0xx_hal_i2c.c is part of the build.
ku100-png commented 7 months ago

Thanks for this material. I also add support for Adafruit 1.8" TFT Shield V2 to NUCLEO-H745-ZI. But I also add support for buttons A,B,C on Adafruit 1.8" TFT Shield V2.