This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TMS320F28335:XINTF 通过 DMA 写入外部 SRAM

Guru**** 2537580 points
Other Parts Discussed in Thread: CONTROLSUITE

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1309576/tms320f28335-xintf-writes-external-sram-via-dma

器件型号:TMS320F28335
主题中讨论的其他器件:controlSUITE

大家好、

以下是客户可能需要您的帮助的问题:

例程中只有读取、但没有写入。 我无法写入。 配置如下:

#include "drv_xintf.h"

Uint16 *z0startaddr = (Uint16 *)0x4000;
Uint16 *z6startaddr = (Uint16 *)0x100000;
Uint16 *z7startaddr = (Uint16 *)0x200000;

static void peripherals_xintf_init(void)
{
    SysCtrlRegs.PCLKCR3.bit.XINTFENCLK = 1;
    InitXintf16Gpio();
    
    EALLOW;
    XintfRegs.XINTCNF2.bit.XTIMCLK = 1;
    XintfRegs.XINTCNF2.bit.WRBUFF = 0;
    XintfRegs.XINTCNF2.bit.CLKOFF = 0;
    XintfRegs.XINTCNF2.bit.CLKMODE = 1;
    XintfRegs.XINTCNF2.bit.HOLD = 1;
    
    XintfRegs.XTIMING6.bit.XWRLEAD = 1;
    XintfRegs.XTIMING6.bit.XWRACTIVE = 2;
    XintfRegs.XTIMING6.bit.XWRTRAIL = 1;
    XintfRegs.XTIMING6.bit.XRDLEAD = 1;
    XintfRegs.XTIMING6.bit.XRDACTIVE = 3;
    XintfRegs.XTIMING6.bit.XRDTRAIL = 0;
    
    XintfRegs.XTIMING6.bit.X2TIMING = 0;
    
    XintfRegs.XTIMING6.bit.USEREADY = 0;
    XintfRegs.XTIMING6.bit.READYMODE = 0;
    
    XintfRegs.XTIMING6.bit.XSIZE = 3;
    EDIS;
    
    __asm(" RPT #7 || NOP");
}

/**
* @brief: DMA寄存器初始化
* @details:
* @param[in] : none.
* @param[out] : none.
* @return: none.
* @par modification:
*/
void peripherals_xintf_dmaread(Uint16 *start_addr, Uint16 *data, Uint16 len)
{
    volatile unsigned int *dmadest;
    volatile unsigned int *dmasource;
    
    CpuTimer0Regs.TCR.bit.TSS = 1; //Stop Timer0 for now
    
    dmadest = data;
    dmasource = start_addr; //Point DMA source to ADC result register base
    DMACH2AddrConfig(dmadest, dmasource);
    /*
    * 一次传输32个字,实际上为半字,
    * 1.bsize = 31:表示一帧传输31+1=32个字(WORD),
    * 2.srcbstep = 1:表示每个WORD传输完成后源地址的偏移+2,
    * 3.desbstep = 1:表示每个WORD传输完成后目的地址的偏移+2
    * */
    DMACH2BurstConfig(31, 2, 2);
    /* 1.tsize = len/32-1:表示每 len / 32 帧传输后中断一次。
    * 2.srctstep = 2:表示每一帧后,在前一帧的源地址上偏移+2。
    * 3.deststep = 2:表示每一帧后,在前一帧的目的地址上偏移+2。
    * */
    DMACH2TransferConfig(len / 32 - 1, 2, 2);
    /*
    * 里面的四个参数分别是SRC_WRAP_SIZE,SRC_WRAP_STEP,DST_WRAP_SIZE和DST_WRAP_STEP。
    * 每进行完2次burst以后,源地址回到初始位置(两次Burst正好对应4个通道每个都转换2次),
    * 每进行完1次burst,目的地址变为起始地址+1(指向DMABuf1的下一个单元)。
    * */
    DMACH2WrapConfig(0xFFFF, 0, 0xFFFF, 0);
    
    DMACH2ModeConfig(DMA_TINT0, PERINT_ENABLE,
    ONESHOT_ENABLE, CONT_DISABLE,
    SYNC_DISABLE, SYNC_SRC,
    OVRFLOW_DISABLE, THIRTYTWO_BIT,
    CHINT_END, CHINT_ENABLE);
    
    StartDMACH2();
    CpuTimer0Regs.TIM.half.LSW = 512; //load low value so we can start the DMA quickly
    CpuTimer0Regs.TCR.bit.SOFT = 1; //Allow to free run even if halted
    CpuTimer0Regs.TCR.bit.FREE = 1;
    CpuTimer0Regs.TCR.bit.TIE = 1; //Enable the timer0 interrupt signal
    CpuTimer0Regs.TCR.bit.TSS = 0; //restart the timer 0

}
/**
* @brief: DMA寄存器初始化
* @details:
* @param[in] : none.
* @param[out] : none.
* @return: none.
* @par modification:
*/
void peripherals_xintf_dmawrite(Uint16 *start_addr, const Uint16 *data, Uint16 len)
{
    volatile unsigned int *dmadest;
    volatile unsigned int *dmasource;
    
    CpuTimer1Regs.TCR.bit.TSS = 1; //Stop Timer0 for now
    
    dmadest = start_addr;
    dmasource = data; //Point DMA source to ADC result register base
    DMACH3AddrConfig(dmadest, dmasource);
    /*
    * 一次传输32个字,实际上为半字,
    * 1.bsize = 31:表示一帧传输31+1=32个字(WORD),
    * 2.srcbstep = 1:表示每个WORD传输完成后源地址的偏移+2,
    * 3.desbstep = 1:表示每个WORD传输完成后目的地址的偏移+2
    * */
    DMACH3BurstConfig(31, 2, 2);
    /* 1.tsize = len/32-1:表示每 len / 32 帧传输后中断一次。
    * 2.srctstep = 2:表示每一帧后,在前一帧的源地址上偏移+2。
    * 3.deststep = 2:表示每一帧后,在前一帧的目的地址上偏移+2。
    * */
    DMACH3TransferConfig(len / 32 - 1, 2, 2);
    /*
    * 里面的四个参数分别是SRC_WRAP_SIZE,SRC_WRAP_STEP,DST_WRAP_SIZE和DST_WRAP_STEP。
    * 每进行完2次burst以后,源地址回到初始位置(两次Burst正好对应4个通道每个都转换2次),
    * 每进行完1次burst,目的地址变为起始地址+1(指向DMABuf1的下一个单元)。
    * */
    DMACH3WrapConfig(0xFFFF, 0, 0xFFFF, 0);
    
    DMACH3ModeConfig(DMA_TINT0, PERINT_ENABLE,
    ONESHOT_ENABLE, CONT_DISABLE,
    SYNC_DISABLE, SYNC_SRC,
    OVRFLOW_DISABLE, THIRTYTWO_BIT,
    CHINT_END, CHINT_ENABLE);
    
    StartDMACH3();
    CpuTimer1Regs.TIM.half.LSW = 512; //load low value so we can start the DMA quickly
    CpuTimer1Regs.TCR.bit.SOFT = 1; //Allow to free run even if halted
    CpuTimer1Regs.TCR.bit.FREE = 1;
    CpuTimer1Regs.TCR.bit.TIE = 1; //Enable the timer0 interrupt signal
    CpuTimer1Regs.TCR.bit.TSS = 0; //restart the timer 0

}

__interrupt void local_dintch2_isr(void)
{
    PieCtrlRegs.PIEACK.bit.ACK7 = 1;
}

__interrupt void local_dintch3_isr(void)
{
    PieCtrlRegs.PIEACK.bit.ACK7 = 1;
}


/**
*@ Description:初始化ADC中包含的所有配置
* @param 无.
* @return 无
*/
void drv_xintf_init(void)
{
    EALLOW; // Allow access to EALLOW protected registers
    PieVectTable.DINTCH2= &local_dintch2_isr;
    PieVectTable.DINTCH3= &local_dintch3_isr;
    EDIS; // Disable access to EALLOW protected registers
    
    IER = M_INT7 ;
    EnableInterrupts();
    EINT;
    
    DMAInitialize();
    peripherals_xintf_init();
}

--

谢谢、此致

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    耶鲁大学

      我们不能在 e2e 上支持调试客户代码。 请让客户参考我们提供的示例。 具体为 C:\ti\controlSUITE\device_support\F2833x\v142\DSP2833x_examples_ccsv5\dma_xintf_to_ram。