盼盼_dRglQm · 2 天前

【Mini-F5375-OB开发板评测】使用spi_dma发送数据时,CS自动复位引起数据异常

【缘由】
我在使用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的拉升,引起数据异常。
image.png
导出数据进行分析:
首次发送数据时为
image.png
再次捕获一次:
image.png
他的CS释放是不定时的。
数据出错了LCD的图像异常:
f153b08e2967a8a286771807b1b45a2.jpg

推荐阅读
关注数
0
文章数
18
目录
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息