金牌会员
- 积分
- 1887
- 金钱
- 1887
- 注册时间
- 2012-10-28
- 在线时间
- 353 小时
|
发表于 2016-7-27 23:06:10
|
显示全部楼层
本帖最后由 hpdell 于 2016-7-27 23:07 编辑
你好,我是有的也是 9486的,刷屏貌似没有你说的那么慢吧,
单片机系统时钟 168MHz
fmc设置如下:
SRAM_HandleTypeDef hsram4;
/** Perform the SRAM4 memory initialization sequence LCD
LCD configured as follow:
- Data/Address MUX = Disable
- Memory Type = SRAM
- Data Width = 16bit
- Write Operation = Enable
- Extended Mode = Enable
- Asynchronous Wait = Disable
*/
hsram4.Instance = FMC_NORSRAM_DEVICE;
hsram4.Extended = FMC_NORSRAM_EXTENDED_DEVICE;
/* hsram4.Init */
hsram4.Init.NSBank = FMC_NORSRAM_BANK4;
hsram4.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE;
hsram4.Init.MemoryType = FMC_MEMORY_TYPE_SRAM;
hsram4.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_16;
hsram4.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE;
hsram4.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
hsram4.Init.WrapMode = FMC_WRAP_MODE_DISABLE;
hsram4.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS;
hsram4.Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE;
hsram4.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE;
hsram4.Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE;
hsram4.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE;
hsram4.Init.WriteBurst = FMC_WRITE_BURST_DISABLE;
/* Timing */
TimingWrite.AddressSetupTime = 4; //地址建立时间(ADDSET)为16个HCLK 1/168M=6ns*4 = 24ns ili9486 资料要求 最小15ns
TimingWrite.AddressHoldTime = 1; //地址保持时间(ADDHLD)模式A未用到
TimingWrite.DataSetupTime = 5; //数据保存时间为5个HCLK = 6ns*5 = 30ns
TimingWrite.BusTurnAroundDuration = 1;
TimingWrite.CLKDivision = 0;
TimingWrite.DataLatency = 0;
TimingWrite.AccessMode = FMC_ACCESS_MODE_C;
TimingRead.AddressSetupTime = 4; //地址建立时间(ADDSET)为16个HCLK 1/168M=6ns*4 = 24ns ili9486 资料要求 最小15ns
TimingRead.AddressHoldTime = 1; //地址保持时间(ADDHLD)模式A未用到
TimingRead.DataSetupTime = 5; //数据保存时间为5个HCLK = 6ns*5 = 30ns
TimingRead.BusTurnAroundDuration = 1;
TimingRead.CLKDivision = 0;
TimingRead.DataLatency = 0;
TimingRead.AccessMode = FMC_ACCESS_MODE_C;
HAL_SRAM_Init(&hsram4, &TimingWrite, &TimingRead);
void LCD_PutPixel(uint16_t _usX, uint16_t _usY, uint16_t _usColor)
{
LCD_SetCursor(_usX, _usY); /* 设置光标位置 */
FMC_LCD->RAM = _usColor;
}
uint16_t LCD_GetPixel(uint16_t _usX, uint16_t _usY)
{
uint16_t Color = 0;
LCD_SetCursor(_usX, _usY); /* 设置光标位置 */
FMC_LCD->REG = 0x2E;
Color = FMC_LCD->RAM; /* 第1个哑读,丢弃 */
Color = FMC_LCD->RAM; /* 第1个哑读,丢弃 */
return Color; // ili9486 控制器读点,只需要读取一次
}
现在只是读点有时感觉还有点问题,不知道该如何解决,如果使用下面的方法,情况会更糟糕。
uint16_t R = 0, G = 0, B = 0 , Color = 0;
LCD_SetCursor(_usX, _usY); /* 设置光标位置 */
FMC_LCD->REG = 0x2E;
R = FMC_LCD->RAM; /* 第1个哑读,丢弃 */
R = FMC_LCD->RAM;
B = FMC_LCD->RAM;
G = FMC_LCD->RAM;
// printf("\r\nGetPixel R %X", (uint16_t)R );
// printf("\r\nGetPixel R2 %X", (uint16_t)R2 );
// printf("\r\nGetPixel G %X", (uint16_t)G );
// printf("\r\nGetPixel B %X", (uint16_t)B );
// Color = (u16)( (u16)((B >> 3) << 11) | (u16)((G >> 2) << 5) | (u16)(R >> 3) ) ;
// Color = (u16)( (u16)((R >> 3) << 11) | (u16)((G >> 2) << 5) | (u16)(B >> 3) ) ;
Color = (((R >> 11) << 11) | ((G >> 10 ) << 5) | (B >> 11));
// printf("\r\nGetPixel 2 %X", (uint16_t)Color );
return Color;
你到时看看有没有什么好的方法读点告诉一声 !!!!!!!!!!!!!!!
|
|