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.

spi open error

Hi,

I use omap350 + windows EC7.  Debugging the SPI driver to communicate with external device.  I get the following DEBUG msgs while writing into the spi device. 

282475 PID:400002 TID:1c9000a TRF_Init(): context Drivers\Active\48

 282475 PID:400002 TID:1c9000a +SPI_Open(0xcca18000, 0xc0000000, 0x00000003

 282476 PID:400002 TID:1c9000a -SPI_Open(rc = 0xcfc49aa0)

 282476 PID:400002 TID:1c9000a +SPI_IOControl(0xcfc49aa0, 0x00220400, 0xee531288, 16, 0xcfc49b80, 48, 0xcc40f578)

 282476 PID:400002 TID:1c9000a -SPI_IOControl(rc = 1)

 282477 PID:400002 TID:1c9000a SPI_Configure Addr = 0x1  Config = 0x103c0

 282477 PID:400002 TID:1c9000a SPI_config(0x000103c0)

 282478 PID:400002 TID:1c9000a +SPI_Write(0xcfc49aa0, 0xcc40f8d0, 0x00000001)

 282478 PID:400002 TID:1c9000a word_len(0x00000008)

 282478 PID:400002 TID:1c9000a SPI_TX_data(0x00000003)

the code which I use as follows;

#define SPI2_DEVICE_NAME         L"SPI2:"

    hSPI = SPIOpen(SPI2_DEVICE_NAME);

config = MCSPI_PHA_ODD_EDGES |
MCSPI_POL_ACTIVEHIGH |
MCSPI_CHCONF_CLKD(32) |
MCSPI_CSPOLARITY_ACTIVELOW |
MCSPI_CHCONF_WL(8) |
MCSPI_CHCONF_TRM_TXRX |
MCSPI_CHCONF_DMAW_DISABLE |
MCSPI_CHCONF_DMAR_DISABLE |
MCSPI_CHCONF_DPE0;

SPIConfigure(hSPI, 1, config);

SPIWrite(s_trf7970.hSPI, 1, 0x09);

I don't know why Clean up function called when invoking SPI_Open and it's printing -SPI_Open(rc = 0xcfc49aa0)....

Looks like due to which the spi driver can't write the value into MOSI line.  Please share your thoughts on what could be the reason it failed. (by analysing the DEBUG msgs)

Regards,

Karthick

  • All works fine now, while SPIOpen() there were no error were reported like incorrect context or failed to allocate aspi instance structure. And the flow of the code is good and it reached by default to the Cleanup function and while exiting with -SPI_Open(rc = 0xcfc49aa0).

    Looks like the problem in the sequence (may be timing issue or clock issue) which I follow to communicate with the device.

    Regards,
    Karthick