fsmc驱动tft弄了2天了,还是不行, tft驱动芯片是ili9163, 但是我用stm32的io口直接模拟,就可以显示,这说明连线没有问题,ili9163初始化也没问题,现在
就怀疑是fsmc配置的问题,但是看了这么久也没有看出问题来,快要崩溃了,哪位好心人可以帮忙看看啊。
下面是代码
#define rFSMC_BCR1 (*(volatile unsigned int *)0xA0000000) // SRAM/NOR片选控制寄存器1
#define rFSMC_BTR1 (*(volatile unsigned int *)0xA0000004) // SRAM/NOR片选时序寄存器1
#define rFSMC_BCR2 (*(volatile unsigned int *)0xA0000008) // SRAM/NOR片选控制寄存器2
#define rFSMC_BTR2 (*(volatile unsigned int *)0xA000000C) // SRAM/NOR片选时序寄存器2
#define rFSMC_BWTR2 (*(volatile unsigned int *)0xA000010C) // SRAM/NOR写时序寄存器2
void fsmc_init()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD|RCC_APB2Periph_GPIOE|RCC_APB2Periph_GPIOF|RCC_APB2Periph_GPIOG|RCC_APB2Periph_AFIO,ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC,ENABLE); //开启fsmc时钟
//下面配置的管脚有部分是外扩的sram的,关于sram的寄存器配置就不发上来了,
GPIO_InitStructure.GPIO_Pin = 0xFFB3; //PORTD 复用推挽输出
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //复用推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = 0xFF83; //PORTE 复用推挽输出
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = 0xF03F; //PORTF 复用推挽输出
GPIO_Init(GPIOF, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = 0x023F; //PORTG 复用推挽输出
GPIO_Init(GPIOG, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin =GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_SetBits(GPIOA, GPIO_Pin_0 );
//lcd_init lcd的片选连到fsmc_cs2
rFSMC_BCR2=0x00001049; //使用模式B,禁用扩展模式
rFSMC_BTR2=0x10030e0e; //地址建立时间和数据的保持时间都设得比较大
}
//************************************************************************************************************
#define command (*(volatile unsigned int *)0X64000000)
#define data (*(volatile unsigned int *)0X6400ffff)
void write_command(unsigned char addr1)
{
command=addr1;
}
void write_para(unsigned char para1)
{
data=para1;
} |