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.

DM648 SPI Module is always in reset state,who can help me?

Other Parts Discussed in Thread: TMS320DM647

Hello,can you help me?

My code is refering to “TMS320DM647/DM648 DSP Serial Peripheral Interface (SPI)” Page 19,Section 2.6.2 4-Pin Mode Initialization。I find SPIGCR0 in Watch regs windows is always 0x00000000, In other word, This module is always in reset state, and there is no CPI_CLK out,can you give me some advices?Thank you very much.

CSL_SpiRegsOvly SPI_Regs;
CSL_SysRegsOvly SYS_Regs;

void SPI2_Configuration()
{
//引脚配置
 /* Pointer to register overlay structure */
 CSL_SysRegsOvly SYS_Regs=((CSL_SysRegsOvly)CSL_SYS_0_REGS);
 CSL_SpiRegsOvly SPI_Regs = ((CSL_SpiRegsOvly)CSL_SPI_0_REGS);

 CSL_FMKT(SYS_PINMUX_SPI_UART_EN,SPI_ENABLE);

#if 1
/* Pointer to register overlay structure */

//1.
 CSL_FMKT(SPI_SPIGCR0_RESET,IN_RESET);
//2.
 CSL_FMKT(SPI_SPIGCR0_RESET,OUT_OF_RESET);

//3.
#if 1
 CSL_FMKT(SPI_SPIGCR1_CLKMOD,INTERNAL);
 CSL_FMKT(SPI_SPIGCR1_MASTER,SPISOMI_INPUT_SPISIMO_OUTPUT);
#endif

//4. 
#if 1
 CSL_FMKT(SPI_SPIPC0_SOMIFUN,SPI);
 CSL_FMKT(SPI_SPIPC0_SIMOFUN,SPI);
 CSL_FMKT(SPI_SPIPC0_CLKFUN,SPI);
 CSL_FMKT(SPI_SPIPC0_SCSFUN0,SPI);
 CSL_FMKT(SPI_SPIPC0_SCSFUN1,SPI);
#endif
//5.
#if 1
 CSL_FINS(SPI_Regs->SPIFMT[0],SPI_SPIFMT_PRESCALE,5);
 CSL_FINS(SPI_Regs->SPIFMT[0],SPI_SPIFMT_CHARLEN,8);
 CSL_FMKT(SPI_SPIFMT_PHASE,NO_DELAY);
 CSL_FMKT(SPI_SPIFMT_POLARITY,LOW);
 CSL_FMKT(SPI_SPIFMT_SHIFTDIR,MSB);
#endif
//6. 
 CSL_FMKT(SPI_SPIDAT1_DFSEL,FORMAT0);
//7. 
 CSL_FINS(SPI_Regs->SPIDELAY,SPI_SPIDELAY_C2EDELAY,10);
//8. 
 CSL_FINS(SPI_Regs->SPIDAT1,SPI_SPIDAT1_CSNR,0);
//9. 
 CSL_FMKT(SPI_SPIDEF_CSDEF1,CS_1);
 CSL_FMKT(SPI_SPIDEF_CSDEF0,CS_1);
//10.Enable Interrupt 
//11.select event 
//12.
//13. 
 CSL_FMKT(SPI_SPIGCR1_SPIEN,ENABLED);
//14. 
//15.
 CSL_FINS(SPI_Regs->SPIDAT1,SPI_SPIDAT1_SPIDAT1,0x55);

#endif
}

  • 你程序中没有使能PSC SPI module, 类似下面的代码
    #include <cslr_psc.h>
    ...

    void device_init(void)
    {
     
      CSL_PscRegsOvly pscRegs = (CSL_PscRegsOvly)CSL_PSC_0_REGS;

      // deassert UART local PSC reset and set NEXT state to ENABLE
      pscRegs->MDCTL[CSL_PSC_SPI] = CSL_FMKT( PSC_MDCTL_NEXT, ENABLE )
                                   | CSL_FMKT( PSC_MDCTL_LRST, DEASSERT );
      // move UART PSC to Next state
      pscRegs->PTCMD = CSL_FMKT(  PSC_PTCMD_GO0, SET );
     
      // wait for transition
      while ( CSL_FEXT( pscRegs->MDSTAT[CSL_PSC_SPI], PSC_MDSTAT_STATE )
              != CSL_PSC_MDSTAT_STATE_ENABLE );

    }

  • hi,when your chip runs over the below codes:

    //2.
     CSL_FMKT(SPI_SPIGCR0_RESET,OUT_OF_RESET);

    What's the value of the SPIGCR0? The above codes is used to make the SPI out of reset state.If it does not work,please check the variable address.