我在使用AM5728开发板,ccs开发环境,在配置AM5728中遇到问题,TDM模式4个slot,外围总线,有帧头没数据,XDATA一直为0,显示数据满
求大神帮忙看看!急急急急急急
下面是我的配置
void McaspTxInternalInit(uint32_t baseAddr)
{
//Global Initialization
McaspGlobalReset(baseAddr);
//2. Configure the FIFO.
McASPWriteFifoDisable(baseAddr); //禁止写FIFO
McASPReadFifoDisable(baseAddr); //禁止读FIFO
//3. Configure the local power management.
McASPSetPowerIdleConfig(baseAddr, MCASP_IDLEMODE_NOIDLE); //0x1: No-idle mode
//4. Configure the transmit format unit.
McASPTxFmtMaskSet(baseAddr, TXMASK32); //32位全部输出,不屏蔽
McASPTxFmtSet(baseAddr, MCASP_TX_SYNC_DELAY_2BIT | MCASP_TX_BITSTREAM_LSB_FIRST |
MCASP_TX_PAD_WITH_0 | MCASP_TX_SLOTSIZE_32BITS |
MCASP_TX_BUF_DMAPORT | MCASP_TX_ROT_RIGHT_NONE); //1 bit delay, 无位翻转LSB first, no PAD, 32位slot, 外围总线(PERICONFIGPORT), 循环右移0位
//5. Configure the transmit frame sync generator.
//内部帧时钟
McASPTxFrameSyncCfg(baseAddr, 0x4, MCASP_TX_FS_WIDTH_WORD, MCASP_TX_FS_INT_BEGIN_ON_RIS_EDGE); //4slot(突发 模式), single bit 同步帧宽度, 内部帧同步时钟 帧同步时钟上升沿
//6.1 Configure the transmit clock generator.
//内部位时钟
McASPTxClkCfg(baseAddr, MCASP_TX_CLK_INTERNAL, TXMIXCLKDIV_1, TXAUXCLKDIV_2); //发送:使用内部位时钟,混合时钟1分频 内部时钟2分频
McASPTxClkPolaritySet(baseAddr, MCASP_TX_CLK_POL_RIS_EDGE); //发送:使用位时钟上升沿
McASPTxHFClkPolaritySet(baseAddr, MCASP_TX_HI_FREQ_CLK_NO_INVERT); //发送高频位时钟不翻转
//6.2 Configure the transmit clock failure detect logic //TODO 检测机制
//7. Program all bits – XTDMSk.
McASPTxTimeSlotSet(baseAddr, 0x0000000F); //第0个TDMslot有效,其他屏蔽
//8. Configure the desired n-th serializer for transmit mode operation.
McASPSerializerTxSet(baseAddr, TXAXR3); //串行器AXR3作为发送器(内部时钟)
//9. Setup all active transmitters to operate in TDM mode.
McASPDITModeCtlWrite(baseAddr, MCASP_TXDITCTL_DITEN_DISABLE); //发送器TDM模式使能
//10. Configure the MCASP pins functionality.
//内部时钟
McASPPinMcASPSet(baseAddr, MCASP_PIN_AFSX| MCASP_PIN_ACLKX| MCASP_PIN_AXR(3)); //配置相应引脚为MCASP功能: AFSX AXR(2) ACLKX AXR(3)
//Configure the MCASP pins direction
//内部时钟
McASPPinDirOutputSet(baseAddr, MCASP_PIN_AFSX); // AFSX 发送帧同步时钟引脚方向:输出
McASPPinDirOutputSet(baseAddr, MCASP_PIN_ACLKX); // ACLKX 发送位时钟引脚方向:输出
McASPPinDirOutputSet(baseAddr, MCASP_PIN_AXR(3)); //AXR3引脚方向:输出 发送
//11. Optional : Configure a MCASP Tx channel for loopback operation (TDM mode only) in MCASP_LBCTL [31:0].
//不使用LOOPBACK模式
//12. Release from reset state the divider that outputs the AHCLKR clock.
//13. Poll the bit to ensure that it is successfully latched in the register.
//14. Release from reset state the divider that outputs the ACLKR clock.
//15. Poll the bit to ensure that it is successfully latched in the register.
//内部时钟
McASPTxClkStart(baseAddr, MCASP_TX_CLK_INTERNAL);
//外部时钟
// McASPTxClkStart(baseAddr, MCASP_TX_CLK_EXTERNAL);
//Global Initialization END
//Operational Modes Configuration
McaspTxPollingMethod(baseAddr); //查询模式
//Operational Modes Configuration END
}
Steven Liu1:
你这个用的是PDK RTOS SDK吧?
没具体调过这部分,不过建议可以顺着RTOS的driver guide上的follow查一下,还有就是在TRM手册中的programming model,特别是22.2.12 Setup and Initialization
processors.wiki.ti.com/…/Processor_SDK_RTOS_MCASP
processors.wiki.ti.com/…/Processor_SDK_RTOS_MCASP