Skip to main content
Explorer II
September 5, 2024
Solved

NUCLEO-F401RE and LCD/TFT screen (ST7789+XPT2046 drivers)

  • September 5, 2024
  • 2 replies
  • 1864 views

Hello ST Community,

 

I am connecting you because I am trying to use a Waveshare LCD/TFT screen (https://www.waveshare.com/2.8inch-tft-touch-shield.htm) which uses the ST7789 (lcd) and XPT2046 (TFT) chips. I can make it work with an Arduino Leonardo board. However, I cannot implement it with the NUCLEO-F401RE board. More precisely, I can implement the backlight (by driving a GPIO), but the SPI communication does not seem to be working. Would you be able to confirm that pins PA5 should be used for SCLK, PA6 for MISO, PA7 for MOSI and PB4 to PB6 for: SD_CS, TP_CS and LCD_CS ?

  There are several git repo with different code drivers version, but not sure about SPI1 pinout.

 

Do you have a link to a driver that can be used with the NUCLEO-F401RE board or any advices for debugging ?

 

Thank you very much for any help you can give me.

 

Best regards,

    This topic has been closed for replies.
    Best answer by Peter BENSCH

    The ZIP with the source codes from Waveshare also contains the ioc files of the projects for STM32, which are based on STM32F103 but can be converted to STM32F401.

    PA5 is already assigned to LD2 on the NUCLEO, but you can easily change this by opening SB21, for example, and thus disconnecting LD2. If you then set pin PA5 to Reset_State again with STM32CubeMX or STM32CubeIDE, you can easily set SPI1 to full-fuplex master and thus assign MOSI, MISO and SCK.

    2 replies

    Graduate II
    September 5, 2024

    The pin assignments should be derived from the NUCLEO-F401RE User Manual, or Schematic under the CAD Resources tab on the product page.

    https://www.st.com/en/evaluation-tools/nucleo-f401re.html

    D13 PA5 SCLK

    D12 PA6 MISO

    D11 PA7 MOSI

    D10 PB6 LCD_CS

    D9 PC7 LCD_BL

    D5 PB4 SD_CS

    D4 PB5 TP_CS

    Should be several drivers you could port to the platform

    Use the SPI TransmitReceive function to get good timing with respect of GPIO for CS going LOW/HIGH

    Technical Moderator
    September 5, 2024

    The ZIP with the source codes from Waveshare also contains the ioc files of the projects for STM32, which are based on STM32F103 but can be converted to STM32F401.

    PA5 is already assigned to LD2 on the NUCLEO, but you can easily change this by opening SB21, for example, and thus disconnecting LD2. If you then set pin PA5 to Reset_State again with STM32CubeMX or STM32CubeIDE, you can easily set SPI1 to full-fuplex master and thus assign MOSI, MISO and SCK.

    Explorer II
    September 6, 2024

    Thank you Peter and Tesla De Lorean for your support. Your proposals help me to fix the issue.