我按照 datasheet 上写的步骤配置,可是墨水屏并没有点亮。因为设置比较多,也不知道哪一点配置不对。屏商没有软件技术支持,有点着急,不知道怎么查找问题
以下是我们的配置程序,希望路过的高手指点一二,多谢!
uint8_t start_SSD1627(void)
{
CommBuf.bytes[0]=SWresetLckCommW; //1.软件复位及上锁(命令)+(数据) addr=02h
CommBuf.bytes[1]=0x00; //data
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,2,AM_HAL_IOM_RAW))
{//命令+数据=16bits
return 0;
}
for (uint32_t i = 0; i < SPItimeout; i++) //等待复位结束
{//during reset,BUSY=1
if(am_hal_gpio_input_bit_read(SPIbusyGPIO)==0x00) //低为空闲
{
break;
}
am_util_delay_us(100);
}
if(am_hal_gpio_input_bit_read(SPIbusyGPIO)) //如果是超时到这一步,直接返回
{
return 0;
}
else
{
am_util_debug_printf("1.SSD1627复位ok!!\r\n");
}
CommBuf.bytes[0]=OSClkCommW; //2.内部晶振&时钟设置(命令)+(数据) addr=01h
CommBuf.bytes[1]=0x83; //turn on internal oscillator and set time base=0.5ms
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,2,AM_HAL_IOM_RAW))
{//命令+数据=16bits
return 0;
}
else
{
am_util_debug_printf("2.内部晶振&时钟设置ok!!\r\n");
}
CommBuf.bytes[0]=CPVolCommW; //3.充电泵电压及流注使能(命令)+(数据) addr=03h
CommBuf.bytes[1]=0x7b; //set V0 output voltage and set the end level
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,2,AM_HAL_IOM_RAW))
{//命令+数据=16bits
return 0;
}
else
{
am_util_debug_printf("3.充电泵电压及流注使能ok!!\r\n");
}
CommBuf.bytes[0]=CPCtrCommW; //4.充电泵控制(命令)+(数据) addr=06h
CommBuf.bytes[1]=0x05; //Enable Cap-lite charge pump and set 8x multiplier
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,2,AM_HAL_IOM_RAW))
{//命令+数据=16bits
return 0;
}
else
{
am_util_debug_printf("4. 15V充电泵使能并配置成8x!!\r\n");
}
CommBuf.bytes[0]=CCPSCommW; //5.充电泵设置(命令)+(数据) addr=37h
CommBuf.bytes[1]=0x00; //set Cap-lite charge pump option:byte1=0x00
CommBuf.bytes[2]=0x10; //byte2=0x10
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,3,AM_HAL_IOM_RAW))
{//命令+数据=24bits
return 0;
}
else
{
am_util_debug_printf("5.15V充电泵设置ok!!\r\n");
}
CommBuf.bytes[0]=AnalCtrCommW; //6.模拟控制(命令)+(数据) addr=05h
CommBuf.bytes[1]=0xd9; //turn on bias,charge pump and V1 buffer:disable discharge,disable voltage regulation on V0
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,2,AM_HAL_IOM_RAW))
{//命令+数据=16bits
return 0;
}
else
{
am_util_debug_printf("6.模拟控制ok!!\r\n");
}
CommBuf.bytes[0]=LUTset1CommW; //7.波形LUT设置1(命令)+(数据) addr=16h----波形寄存器电压
CommBuf.bytes[1]=0x3e;//0xd5; //waveform LUT setting
CommBuf.bytes[2]=0xc6;//0x7d;
CommBuf.bytes[3]=0xd0;
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,4,AM_HAL_IOM_RAW))
{//命令+数据=32bits
return 0;
}
else
{
am_util_debug_printf("7.波形LUT电压设置ok!!\r\n");
}
CommBuf.bytes[0]=LUTset2CommW; //7.1波形LUT设置2(命令)+(数据)addr=17----波形寄存器电压
CommBuf.bytes[1]=0x5f; //7.2waveform LUT setting
CommBuf.bytes[2]=0x59;
CommBuf.bytes[3]=0xf2;
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,4,AM_HAL_IOM_RAW))
{//命令+数据=32bits
return 0;
}
else
{
am_util_debug_printf("7.波形LUT设置2ok!!\r\n");
}
CommBuf.bytes[0]=LUTset6CommW; //8.波形LUT设置6(命令)----波形寄存器时间
CommBuf.bytes[1]=0x65;//0x65; //waveform LUT setting(数据)addr=1b
CommBuf.bytes[2]=0x83;//0x90;
CommBuf.bytes[3]=0x8a;//0x00;
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,CommBuf.words,4,AM_HAL_IOM_RAW))
{//命令+数据=32bits
return 0;
}
else
{
am_util_debug_printf("8.波形LUT时间设置ok!!\r\n");
}
DisDataBuf.bytes[0]=RAMdata1CommW; //9.RAM显示数据更新(命令)+(数据)addr=10
for(uint8_t i=1;i<12;i++)
{
DisDataBuf.bytes[i]=0xff;
}
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,DisDataBuf.words,12,AM_HAL_IOM_RAW))
{
return 0;
}
else
{
am_util_debug_printf("9.send display RAM data ok!!\r\n");
}
DisDataBuf.bytes[0]=DisUpdatCommW; //10.显示刷新(命令)+(数据)addr=00
DisDataBuf.bytes[1]=0xa0; //perform dispaly updata
DisDataBuf.bytes[2]=0x40;
if(AM_HAL_IOM_SUCCESS !=am_hal_iom_spi_write(SPIOModule,SPICEn,DisDataBuf.words,3,AM_HAL_IOM_RAW))
{
return 0;
}
else
{
am_util_debug_printf("10.等待显示刷新!!\r\n");
}
return 1;
} |
|