8、GUI芯片模块
8.1 SPI 通信
8.1.1 引脚介绍
图3.1.1是普通SPI连接图,在使用SPI通信,HOLD引脚和WP脚需要接2K电阻到VCC。
图3.1.1
8.1.2 GUI 芯片指令
图3.1.2操作存储芯片指令,可供客户写驱动做参考
8.1.3 SPI驱动程序
/**
* @brief write a byte to flash
* @param data: data to write
* @retval flash return data
*/
uint8_t spi_byte_write(uint8_t data)
{
uint8_t brxbuff;
spi_i2s_dma_transmitter_enable(SPI4, FALSE);
spi_i2s_dma_receiver_enable(SPI4, FALSE);
spi_i2s_data_transmit(SPI4, data);
while(spi_i2s_flag_get(SPI4, SPI_I2S_RDBF_FLAG) == RESET);
brxbuff = spi_i2s_data_receive(SPI4);
while(spi_i2s_flag_get(SPI4, SPI_I2S_BF_FLAG) != RESET);
return brxbuff;
}
/**
* @brief read a byte to flash
* @param none
* @retval flash return data
*/
uint8_t spi_byte_read(void)
{
return (spi_byte_write(FLASH_SPI_DUMMY_BYTE));
}
/**
* @brief read data from flash
* @param pbuffer: the pointer for data buffer
* @param read_addr: the address where the data is read
* @param length: buffer length
* @retval none
*/
void spiflash_read(uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
{
FLASH_CS_LOW();
spi_byte_write(0x03); /* send instruction 0x03普通读取*/
spi_byte_write((uint8_t)((read_addr) >> 16)); /* send 24-bit address */
spi_byte_write((uint8_t)((read_addr) >> 8));
spi_byte_write((uint8_t)read_addr);
//spi_byte_write((uint8_t)0xff);//使用0x0B快速读取时需额外发送一个字节
spi_bytes_read(pbuffer, length);
FLASH_CS_HIGH();
}
/**
* @brief erase a sector data
* @param erase_addr: sector address to erase
* @retval none
*/
void spiflash_sector_erase(uint32_t erase_addr)
{
spiflash_write_enable();
spiflash_write_enable();
spiflash_wait_busy();
FLASH_CS_LOW();
spi_byte_write(0x20);//擦除指令
spi_byte_write((uint8_t)((erase_addr) >> 16));
spi_byte_write((uint8_t)((erase_addr) >> 8));
spi_byte_write((uint8_t)erase_addr);
FLASH_CS_HIGH();
spiflash_wait_busy();
}
/**
* @brief read data continuously
* @param pbuffer: buffer to save data
* @param length: buffer length
* @retval none
*/
void spi_bytes_read(uint8_t *pbuffer, uint32_t length)
{
while(length--)
{
while(spi_i2s_flag_get(SPI4, SPI_I2S_TDBE_FLAG) == RESET);
spi_i2s_data_transmit(SPI4, 0xa5);//随意值皆可
while(spi_i2s_flag_get(SPI4, SPI_I2S_RDBF_FLAG) == RESET);
*pbuffer = spi_i2s_data_receive(SPI4);
pbuffer++;
}
}
/**
* @brief read device id
* @param none
* @retval device id
*/
uint16_t spiflash_read_id(void)
{
uint16_t wreceivedata = 0;
FLASH_CS_LOW();
spi_byte_write(0x90);//0x90读取id指令
spi_byte_write(0x00);
spi_byte_write(0x00);
spi_byte_write(0x00);
wreceivedata |= spi_byte_read() << 8;
wreceivedata |= spi_byte_read();
FLASH_CS_HIGH();
return wreceivedata;
}
-
- GT-HMI Designer用户手册
- GT-HMI Engine用户手册
- 高通字库芯片开发资料
- GTDB-X7ESP高通智匠AI开发板规格书
- GTC-480480TFT40XP模块使用手册
- GTC-480272TFT43XP模块使用手册
- GTC-800480TFT50G模块使用手册
- GTC-800480TFT70GP模块使用手册
- GTC-1024600TFT101GP模块使用手册
- GT-GUI LCD 0.96寸液晶模组数据手册
- GT-GUI LCD 1.9寸液晶模组数据手册
- GT-GUI LCD 3.5寸液晶模组数据手册
- GT-GUI LCD 7.0寸液晶模组数据手册
- GUI-LCD开发板使用手册
- GT5GL128B标准GUI芯片规格书
- GT5GL64芯片产品规格书
高通字库交流群
GT-HMI交流群