参考Starterware例程,函数内容和例程的类似,唯一不同的是DMA没有使用中断触发方式(使用EDMA3_TRIG_MODE_MANUAL).
流程如下
bspEdma3Init();//初始化DMA
SPISetUp();//初始化SPI
EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_CHA_SPI1_TX, EDMA3_CHA_SPI1_TX, 0);
SPIEnable(SOC_SPI_1_REGS);
SPIDat1Config(SOC_SPI_1_REGS,(SPI_CSHOLD | SPI_DATA_FORMAT0), SPI_OLED_CS);
SpiTxEdmaParamSet(EDMA3_CHANNEL_TYPE_DMA,EDMA3_CHANNEL_TYPE_DMA,oled_display_buffer,1024);
EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS,BSP_EDMA3_LCD_EVENT,EDMA3_TRIG_MODE_MANUAL);
因为是刷屏数据,运行的结果是只发了一个字节给显示.然后现象上就没有了.使用EDMA3GetIntrStatus(SOC_EDMA30CC_0_REGS)读取状态,一直是0.
请问是哪里配置出了问题?
Tony Tang:
确认一下SPI1通过PSC使能没有。你说的只发了一个字节给LCD是说LCD上有一个字节的变化了,还是说EDMA的参数显示传了一个字节?
Shine:
手动触发需要多次使能EDMA3EnableTransfer
/** Since the transfer is going to happen in Manual mode of EDMA3* operation, we have to 'Enable the Transfer' multiple times.* Number of times depends upon the Mode (A/AB Sync)* and the different counts.*/if (TRUE == retVal){/*Need to activate next param*/if (syncType == EDMA3_SYNC_A){numenabled = bcnt * ccnt;}else{/* AB Sync Transfer Mode */numenabled = ccnt;}for (index = 0; index < numenabled; index++){irqRaised = 0;/** Now enable the transfer as many times as calculated above.*/retVal = EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, chNum, EDMA3_TRIG_MODE_MANUAL);if (TRUE != retVal){UARTPuts ("edma3Test: EDMA3EnableTransfer Failed.\r\n", -1); break;}
user4699890:
回复 Tony Tang:
SPI1通过PSC使能的了.LCD上显示8个像素点,像素点转为数据也对得上数组里面的第一个数据.