小弟有个板子要搞一搞。。
2.4寸的lcd,标识型号FPC-T24QT10T2(搜不到。。。。)
37Pin,不带触摸(有上件位置没上),排除掉已知的pin之后,
剩下的pin非常像是FSMC驱动方式,包括NE1、D0~D15,NOE,NWE,A16都在,剩下一根我猜是reset
然后用确定没问题的(开发板可跑可驱动lcd)代码去试试
读出ID是0x0075
这就糊涂了 ,感觉是读错了,但是完全不知道怎么继续
贴下fsmc初始化和读ID代码:
[mw_shl_code=c,true]void MX_FSMC_Init(void)
{
FSMC_NORSRAM_TimingTypeDef Timing;
/** Perform the SRAM1 memory initialization sequence
*/
hsram1.Instance = FSMC_NORSRAM_DEVICE;
hsram1.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
/* hsram1.Init */
hsram1.Init.NSBank = FSMC_NORSRAM_BANK1;
hsram1.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
hsram1.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16;
hsram1.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE;
hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
hsram1.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
hsram1.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
hsram1.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
hsram1.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
hsram1.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE;
hsram1.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
hsram1.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE;
/* Timing */
#if 0
Timing.AddressSetupTime = 2;
Timing.AddressHoldTime = 15;
Timing.DataSetupTime = 5;
Timing.BusTurnAroundDuration = 0;
Timing.CLKDivision = 16;
Timing.DataLatency = 17;
Timing.AccessMode = FSMC_ACCESS_MODE_A;
#else
Timing.AddressSetupTime = 10;
Timing.AddressHoldTime = 10;
Timing.DataSetupTime = 15;
Timing.BusTurnAroundDuration = 10;
Timing.CLKDivision = 16;
Timing.DataLatency = 17;
Timing.AccessMode = FSMC_ACCESS_MODE_B;
#endif
/* ExtTiming */
if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK)
{
Error_Handler();
}
/** Disconnect NADV
*/
__HAL_AFIO_FSMCNADV_DISCONNECTED();
}
[/mw_shl_code]
读ID代码
[mw_shl_code=c,true]uint16_t lcdReadReg(uint8_t LCD_Reg)
{
uint16_t d;
*(__IO uint16_t*)(Bank1_LCD_C) = LCD_Reg;
d = *(__IO uint16_t*)(Bank1_LCD_D);
return d;
}
void LCD_Init(void)
{
lcdReset();
// lcdWriteCmd(0x00, 0x0001);
HAL_Delay(50); // delay 50 ms
DeviceCode = lcdReadReg(0x0000);
xprintf("LCD ID:0x%04x
", DeviceCode); //打印LCD ID
。。。
}[/mw_shl_code]
一周热门 更多>