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.

TM570 and MibSPI1

Other Parts Discussed in Thread: TMP121, HALCOGEN

Hello,

I am using TMS570 processor and currently working on the MibSPI1 module. My slave device is TMP121 which is Accurate Digital Temperature Sensor with SPI Interface. This sensor is connected to SC_0.

Code is generated in the HalCoGen and the setting is the same as in the example example_mibspiDma.c but CS_0 as chipselect is selected. When it is allowed to start the mibspi tranger tg 0 so the clock (SPICLK) is running.

I can´t selected the correct chipselect. CS_0 still has value of 1. Does anyone know how to switch the value of CS_0 to 0?

Thank you for all the answers.

 

Here is my main:

 

void main(void)

{

/* USER CODE BEGIN (3) */

       uint32 Count=0;

 

 

   /* - creating a data chunk in system ram to start with ... */

   loadDataPattern(D_SIZE,&TX_DATA[0]);

 

   /* - initializing mibspi - enabling tg 0 , length 127 (halcogen file)*/

   mibspiInit();

 

   /* - enabling loopback ( this is to emulate data transfer without external wires */

    //mibspiEnableInternalLoopback(mibspiREG1);

 

   /* - assigning dma request: channel-0 with request line - 1 */

   dmaReqAssign(0,1 );

 

   /* - configuring dma control packets   */

    dmaConfigCtrlPacket((uint32)(&TX_DATA),(uint32)(&(mibspiRAM1->tx[0].data)),D_SIZE);

   /* upto 32 control packets are supported. */

 

   /* - setting dma control packets */

      dmaSetCtrlPacket(DMA_CH0,g_dmaCTRLPKT);

 

   /* - setting the dma channel to trigger on h/w request */

      dmaSetChEnable(DMA_CH0, DMA_HW);

 

   /* - configuring the mibspi dma , channel 0 , tx line -0 , rxline -1     */

   /* - refer to the device data sheet dma request source for mibspi tx/rx  */

      mibspiDmaConfig(mibspiREG1,0,0,1);

 

   /* - enabling dma module */

   dmaEnable();

 

 

 

  while(1)

   {

         mibspiSetData(mibspiREG1, 1, TX_DATA);

 

          /* - start the mibspi transfer tg 0 */

          mibspiTransfer(mibspiREG1,1 );

 

           /* ... wait until transfer complete  */

          while(!(mibspiIsTransferComplete(mibspiREG1,1)))

          {

          };

 

   /* copy from mibspi ram to sys ram */

          mibspiGetData(mibspiREG1, 1, RX_DATA);

 

   }

 

      

 

   while(1); /* loop forever */

 

 

}