完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
图片显示原理w25x16一次读取出5000个像素点,然后一次向彩屏中写入5000个点。但是刷屏速度比较2.4寸的显示屏需要0.5左右。采用的单片机是STM32f030.有人解决过这个方案?或者谁懂如何提高spi的通信速度?spi初始化程序如下:/*******************************************************************************
* Function Name : SPI_FLASH_Init * Description : Initializes the peripherals used by the SPI FLASH driver. * Input : None * Output : None * Return : None *******************************************************************************/ void SPI_FLASH_Init(void) { GPIO_InitTypeDef GPIO_InitStruct; SPI_InitTypeDef SPI_InitStruct; /*!< SD_SPI_CS_GPIO, SD_SPI_MOSI_GPIO, SD_SPI_MISO_GPIO, SD_SPI_DETECT_GPIO and SD_SPI_SCK_GPIO Periph clock enable */ // RCC_AHBPeriphClockCmd(FLASH_CS_PIN_SCK|FLASH_SCK_PIN_SCK|FLASH_MISO_PIN_SCK | FLASH_MOSI_PIN_SCK, ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOF| RCC_AHBPeriph_GPIOB, ENABLE); /*!< SD_SPI Periph clock enable */ RCC_APB1PeriphClockCmd(FLASH_SPI2, ENABLE); /*!< Configure SD_SPI pins: SCK */ GPIO_InitStruct.GPIO_Pin = FLASH_SCK_PIN; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_Level_3; GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(FLASH_SCK_PORT, &GPIO_InitStruct); /*!< Configure SD_SPI pins: MISO */ GPIO_InitStruct.GPIO_Pin = FLASH_MISO_PIN; GPIO_Init(FLASH_MISO_PORT, &GPIO_InitStruct); /*!< Configure SD_SPI pins: MOSI */ GPIO_InitStruct.GPIO_Pin =FLASH_MOSI_PIN; GPIO_Init(FLASH_MOSI_PORT, &GPIO_InitStruct); /* Connect PXx to SD_SPI_SCK */ GPIO_PinAFConfig(FLASH_SCK_PORT, FLASH_SCK_SOURCE, FLASH_SCK_AF); /* Connect PXx to SD_SPI_MISO */ GPIO_PinAFConfig(FLASH_MISO_PORT, FLASH_MISO_SOURCE, FLASH_MISO_AF); /* Connect PXx to SD_SPI_MOSI */ GPIO_PinAFConfig(FLASH_MOSI_PORT, FLASH_MOSI_SOURCE, FLASH_MOSI_AF); /*!< Configure SD_SPI_CS_PIN pin: SD Card CS pin */ GPIO_InitStruct.GPIO_Pin =FLASH_CS_PIN; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_Level_3; GPIO_Init(FLASH_CS_PORT, &GPIO_InitStruct); SPI_FLASH_CS_HIGH(); /*!< SD_SPI Config */ SPI_InitStruct.SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStruct.SPI_Mode = SPI_Mode_Master; SPI_InitStruct.SPI_DataSize = SPI_DataSize_8b; SPI_InitStruct.SPI_CPOL = SPI_CPOL_High; SPI_InitStruct.SPI_CPHA = SPI_CPHA_2Edge; SPI_InitStruct.SPI_NSS = SPI_NSS_Soft; // SPI_InitStruct.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16; SPI_InitStruct.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStruct.SPI_CRCPolynomial = 7; SPI_Init(SPI2, &SPI_InitStruct); SPI_RxFIFOThresholdConfig(SPI2, SPI_RxFIFOThreshold_QF); SPI_Cmd(SPI2, ENABLE); /*!< SD_SPI enable */ } w25x16的读取程序如下: /******************************************************************************* * Function Name : SPI_FLASH_BufferRead * Description : Reads a block of data from the FLASH. * Input : - pBuffer : pointer to the buffer that receives the data read * from the FLASH. * - ReadAddr : FLASH's internal address to read from. * - NumByteToRead : number of bytes to read from the FLASH. * Output : None * Return : None *******************************************************************************/ void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) { /* Select the FLASH: Chip Select low */ SPI_FLASH_CS_LOW(); /* Send "Read from Memory " instruction */ SPI_FLASH_SendByte(W25X_ReadData); /* Send ReadAddr high nibble address byte to read from */ SPI_FLASH_SendByte((ReadAddr & 0xFF0000) >> 16); /* Send ReadAddr medium nibble address byte to read from */ SPI_FLASH_SendByte((ReadAddr& 0xFF00) >> 8); /* Send ReadAddr low nibble address byte to read from */ SPI_FLASH_SendByte(ReadAddr & 0xFF); while (NumByteToRead--) /* while there is data to be read */ { /* Read a byte from the FLASH */ *pBuffer = SPI_FLASH_SendByte(Dummy_Byte); /* Point to the next location where the byte read will be saved */ pBuffer++; } /* Deselect the FLASH: Chip Select high */ SPI_FLASH_CS_HIGH(); } 附件是w25x16的驱动程序
|
|
相关推荐
8个回答
|
|
spi很定快不了,建议用sfmc
|
|
|
|
飘过 ,,,,,,,
|
|
|
|
这里面有两个因素的,一个是你的刷屏的驱动,一个是读取SPI Flash的速度。SPI速度不能太高的,不然SPI FLASH 受不了
|
|
|
|
|
|
|
|
嗯嗯,显示屏的驱动是固定自带的改不了,只能从软件方面下手 |
|
|
|
下载看看
|
|
|
|
进来学习学习!
|
|
|
|
谢谢分享
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
STM32配合可编程加密芯片SMEC88ST的防抄板加密方案设计
462 浏览 0 评论
2318 浏览 1 评论
AD7686芯片不传输数据给STM32,但是手按住就会有数据。
2121 浏览 3 评论
4752 浏览 0 评论
如何解决MPU-9250与STM32通讯时,出现HAL_ERROR = 0x01U
2264 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 22:30 , Processed in 0.781554 second(s), Total 56, Slave 48 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号