【缘由】
我在使用spi按位发送时,发送数据是正常的,但是使用spi_dma发送时,会不定期CS复位。
【代码】
static void disp_flush(lv_display_t * disp_drv, const lv_area_t * area, uint8_t * px_map)
{
if(disp_flush_enabled) {
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
uint16_t *buf16 = (uint16_t *)px_map;
lcd_set_address(area->x1, area->y1, area->x2, area->y2);
lcd_write_ram();
LCD_CS(0);
LCD_WR(1);
// 计算需要传输的数据长度
uint32_t data_length = (area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1) * BYTE_PER_PIXEL;
printf("data_length:%d\r\n", data_length);
SPI_TxData_DMA_Polling(px_map, data_length);
}
/*IMPORTANT!!!
*Inform the graphics library that you are ready with the flushing*/
lv_display_flush_ready(disp_drv);
}
在执行SPI_TxData_DMA_Polling(px_map, data_length);(8位数据宽度)
我使用逻辑分析仪捕获数据,在程序没有释放CS时,会10ns的拉升,引起数据异常。
导出数据进行分析:
首次发送数据时为
再次捕获一次:
他的CS释放是不定时的。
数据出错了LCD的图像异常: