eve4-bt817 & qspi driver lcd
Posted: Fri Aug 16, 2024 4:04 am
Hello, I am using `https:// github.com/matrixorbital/eve2-library` to drive the LCD screen. The QSPI protocol connection I use will be connected to the BT817. It was changed to QSPI, but it didn't seem to play any role, and still could not light up the screen:
`` `c
/*
* hw_api.c
*
* Created on: Mar 4, 2020
* Author: ray
*/
#include "hw_api.h"
#include "main.h"
extern QSPI_HANDLETYPEF HQSPI1;
extern void mx_spi1_init ();
void Hal_spi_enable (VOID)
{{
Hal_gpio_writepin (GPIOA, GPIO_PIN_2, 1);
}
void Hal_SPI_DISable (VOID)
{{
Hal_gpio_writepin (GPIOA, GPIO_PIN_2, 0);
}
volatile int Lastresult = 0;
void Hal_SPI_WRITEBUFFER (UINT8_T *Buffer, UINT32_T Length)
{{
Hal_spi_enable ();
hqspi1.instance-> dlr = length-; // Configure data length
volatile int result = Hal_qspi_transmit (& hqspi1, buffer, 1000); // Send data
Hal_spi_disable ();
}
void Hal_SPI_READBUFFER (UINT8_T *Buffer, UINT32_T LENGTH)
{{
// Eveires One Dummy Read/Write Before Actual Data Can Be Read
Buffer [0] = 0;
hqspi1.instance-> dlr = length-1;
volatile int result = Hal_qspi_transmit (& hqspi1, buffer, 1000);
HAL_QSPI_RECEIVE (& HQSPI1, Buffer, 1000);
}
UINT8_T HAL_SPI_WRITE (UINT8_T DATA)
{{
hqspi1.instance-> dlr = data-1; // Configure data length
If (HAL_QSPI_TRANSMIT (& HQSPI1, & Data, 1000) == Hal_ok) Return 0; // Send data
else Return 1;
}
void Hal_eve_reset_hw (void)
{{
Hal_gpio_writepin (EVE_PD_GPIO_PORT, EVE_PD_PIN, 0);
HAL_GPIO_WRITEPIN (GPIOA, GPIO_PIN_2, 0); // CS PIN
Hal_delay (50);
Hal_gpio_writepin (EVE_PD_GPIO_PORT, EVE_PD_PIN, 1);
Hal_gpio_writepin (GPIOA, GPIO_PIN_2, 1);
Hal_delay (100);
}
`` `
Can you help me see where there is a problem? My engineering file is generated by CubemX. If I need the engineering source file, I will attach it again.
I hope you can help me look at the code, or provide a QSPI version. I have had a headache for several days. I am not familiar with QSPI. The content of the relevant code on the Internet is very small. I hope to get your help. Thank you very much! Intersection
`` `c
/*
* hw_api.c
*
* Created on: Mar 4, 2020
* Author: ray
*/
#include "hw_api.h"
#include "main.h"
extern QSPI_HANDLETYPEF HQSPI1;
extern void mx_spi1_init ();
void Hal_spi_enable (VOID)
{{
Hal_gpio_writepin (GPIOA, GPIO_PIN_2, 1);
}
void Hal_SPI_DISable (VOID)
{{
Hal_gpio_writepin (GPIOA, GPIO_PIN_2, 0);
}
volatile int Lastresult = 0;
void Hal_SPI_WRITEBUFFER (UINT8_T *Buffer, UINT32_T Length)
{{
Hal_spi_enable ();
hqspi1.instance-> dlr = length-; // Configure data length
volatile int result = Hal_qspi_transmit (& hqspi1, buffer, 1000); // Send data
Hal_spi_disable ();
}
void Hal_SPI_READBUFFER (UINT8_T *Buffer, UINT32_T LENGTH)
{{
// Eveires One Dummy Read/Write Before Actual Data Can Be Read
Buffer [0] = 0;
hqspi1.instance-> dlr = length-1;
volatile int result = Hal_qspi_transmit (& hqspi1, buffer, 1000);
HAL_QSPI_RECEIVE (& HQSPI1, Buffer, 1000);
}
UINT8_T HAL_SPI_WRITE (UINT8_T DATA)
{{
hqspi1.instance-> dlr = data-1; // Configure data length
If (HAL_QSPI_TRANSMIT (& HQSPI1, & Data, 1000) == Hal_ok) Return 0; // Send data
else Return 1;
}
void Hal_eve_reset_hw (void)
{{
Hal_gpio_writepin (EVE_PD_GPIO_PORT, EVE_PD_PIN, 0);
HAL_GPIO_WRITEPIN (GPIOA, GPIO_PIN_2, 0); // CS PIN
Hal_delay (50);
Hal_gpio_writepin (EVE_PD_GPIO_PORT, EVE_PD_PIN, 1);
Hal_gpio_writepin (GPIOA, GPIO_PIN_2, 1);
Hal_delay (100);
}
`` `
Can you help me see where there is a problem? My engineering file is generated by CubemX. If I need the engineering source file, I will attach it again.
I hope you can help me look at the code, or provide a QSPI version. I have had a headache for several days. I am not familiar with QSPI. The content of the relevant code on the Internet is very small. I hope to get your help. Thank you very much! Intersection