cancel
Showing results for 
Search instead for 
Did you mean: 

ESP32/STM32 SPI with ST7701S: first command not sent, sequence stops

Ameni
Associate II

 

Hello,

I am using an ST7701S LCD over 3-wire SPI (CS, SCK, SDA) with my STM32.

When I send the initialization commands from my ESP, I noticed the following:

  • The first command of the sequence is not sent.

  • The program seems to stop at the second stage, around the 100th command.

SPI is configured in master mode, polling (no DMA, no interrupts).

Example of the write function:

void ST7701_Write(uint8_t dc, uint8_t data) {
uint16_t value = ((dc & 0x01) << 8) | data;
HAL_GPIO_WritePin(LCD_CS_GPIO_Port, LCD_CS_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi2, (uint8_t *)&value, 1, HAL_MAX_DELAY);
HAL_GPIO_WritePin(LCD_CS_GPIO_Port, LCD_CS_Pin, GPIO_PIN_SET);
}

Questions:

  1. Could the first command being skipped be due to HAL/SPI initialization or state?

  2. What is the recommended method to ensure all commands are reliably sent over 3-wire SPI to ST7701S?

Thank you for your help.

1 REPLY 1
mƎALLEm
ST Employee

Hello,

In next time please use </> to share a code. Please read How to write your question to maximize your chances to find a solution

I invite you to edit your post to comply with the community rule.

Thank you for your understanding.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.