none
on SPI_Configure the 2nd parameter RRS feed

  • General discussion

  • Hi,

    BOOL SPI_Configure(DWORD context, DWORD address, DWORD config)

    I really don't know the actual purpose of what the second parameter is for?  Please explain.

    From my understanding in AM/DM37x there are four SPI channels available.  And somewhere in the document I read that the 2nd parameter is for CS (chip select).  In my case I use SPI2 and CS0.  Then what could be exact number I should pass?

    please clarify.

    Regards,

    Karthick

    Tuesday, September 8, 2015 5:16 AM

All replies

  • Hi Karthickph, 

    This address basically tell you which channel you want to use/the slave device is connected with which channel

    Tuesday, September 8, 2015 6:21 AM
  • Check code for SPI_Configure function and find what they are doing with this parameter, or read http://processors.wiki.ti.com/index.php/WinCE-BSP_ARM-A8_User_Guide#SPI_Driver link. They have some useful information there.

    Keshava G N, Software Engineer, iWave Systems, Bangalore ( http://iwavesystems.com ). mail - keshavagnATiwavesystemsDOTcom , blog - http://wec7.blogspot.com ,

    Tuesday, September 8, 2015 7:21 AM
  • That sounds like I should pass 0 then, because I use CS0 (SPI2) to address the slave device.

    the shared link I already read, but I wanted to know should I use the below functions before performing SPIWrite();

    SPILockController(hSPI, 0xFFFFF);
    SPIEnableChannel(hSPI);

    I see that in SPIWrite() function itself has enable channel call ie. SETREG32(&pSPIChannelRegs->MCSPI_CHCTRL, MCSPI_CHCONT_EN); 

    then again should invoke SPIEnableChannel such function? please clarify.

    Also, I observed that;

    spiBuffer[0] = 0x83;

    SPIWrite(hSPI, 1, spiBuffer);

    which sends the data well. I had seen through by reading SPI_TX register.

    but when I send 2 packets like;

        spiBuffer[0] = 0x09;
        spiBuffer[1] = 0x91;

    SPIWrite(hSPI, 2, spiBuffer);

    Now only 1st packet Tx correctly, but the 2nd packet had not sent.  I see the SPI_TX register read it as 0 only.

    what is the reason it fails.  Do you have any clue?

    Thanks,

    Karthick

    Tuesday, September 8, 2015 9:30 AM
  • As these issues are very much related to a particular processor, it would be useful for you to post these queries in processor (TI) forum than MSDN.

    Keshava G N, Software Engineer, iWave Systems, Bangalore ( http://iwavesystems.com ). mail - keshavagnATiwavesystemsDOTcom , blog - http://wec7.blogspot.com ,

    Tuesday, September 8, 2015 9:38 AM
  • thanks for that.
    Tuesday, September 8, 2015 9:56 AM