RT,如果可以,这样初始化为什么为什么udma一直为STOP状态
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
GPIOPinConfigure(GPIO_PG0_I2C1SCL);
GPIOPinConfigure(GPIO_PG1_I2C1SDA);
GPIOPinTypeI2CSCL(GPIO_PORTG_BASE, GPIO_PIN_0);
GPIOPinTypeI2C(GPIO_PORTG_BASE, GPIO_PIN_1 );
I2CMasterInitExpClk(I2C1_BASE, ui32SysClock, true); //开启时钟
HWREG(I2C1_BASE + I2C_O_MTPR) = 0x09;
I2CMasterEnable(I2C1_BASE);
I2CTxFIFOConfigSet(I2C1_BASE,I2C_FIFO_CFG_TX_MASTER_DMA);
// I2CTxFIFOConfigSet(I2C1_BASE,I2C_FIFO_CFG_TX_MASTER);
// I2CMasterBurstLengthSet(I2C1_BASE,noise_NUM);
I2CMasterSlaveAddrSet(I2C1_BASE, 0x4D, false); //从机地址
//----------------------------------------------
I2CMasterIntEnable(I2C1_BASE);
I2CMasterIntEnableEx(I2C1_BASE,I2C_MASTER_INT_TX_DMA_DONE);//|I2C_MASTER_INT_TX_FIFO_EMPTY); //每次传输完成产生中断
//----------------------------------------------
ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_UART0TX, //i2c1与uart公用一个UDMA通道 UDMA_ATTR_USEBURST |
UDMA_ATTR_HIGH_PRIORITY |
UDMA_ATTR_REQMASK);
// ROM_uDMAChannelAttributeEnable(UDMA_CHANNEL_UART0TX,UDMA_ATTR_USEBURST); //ÕâÀï²»ÓÃÌØÊâÉèÖÃ
ROM_uDMAChannelControlSet(UDMA_CHANNEL_UART0TX | UDMA_PRI_SELECT,
UDMA_SIZE_8 | UDMA_SRC_INC_8 | UDMA_DST_INC_NONE | UDMA_ARB_4);
ROM_uDMAChannelTransferSet(UDMA_CHANNEL_UART0TX| UDMA_PRI_SELECT,
UDMA_MODE_BASIC,
(void *)DataTx,
(void *)(I2C1_BASE + I2C_O_FIFODATA),
noise_NUM);
ROM_IntEnable(INT_UDMAERR);
ROM_IntEnable(INT_UDMA);
ROM_uDMAChannelEnable(UDMA_CHANNEL_UART0TX );
ROM_uDMAChannelAssign(UDMA_CH9_I2C1TX);
I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_FIFO_BURST_SEND_START); //¿ªÊ¼²úÉúÔëÉù
此帖出自
小平头技术问答
一周热门 更多>