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 Communication

When i am compiling and building my BSP, SPI2 is not in the list of Inbuilt drivers of NK.bin.

For this i have modified the .bat file and SPI2 is added in the list. Now still i am unable to communicate

using SPI2. Does something more needs to be done in platform.c for bringing this communication up? 

  • well, for plaform.c, you need to check PinMuxSetup() if it has config your pad right,

    and check oem_pinmux.c too.

    make sure you have the clock pad input enable.

    take MCSPI3 for example:

    // OMAP_DEVICE_MCSPI3
    DEVICE_PINMUX_BEGIN(OMAP_DEVICE_MCSPI3, D0)
        DEVICE_PINMUX_ENTRY(CONTROL_PADCONF_DSS_DATA18, (INPUT_ENABLE | PULL_INACTIVE | MUX_MODE_2))/*MCSPI3_CLK*/
        DEVICE_PINMUX_ENTRY(CONTROL_PADCONF_DSS_DATA19, (INPUT_DISABLE | PULL_INACTIVE | MUX_MODE_2))/*MCSPI3_SIMO*/
        DEVICE_PINMUX_ENTRY(CONTROL_PADCONF_DSS_DATA20, (INPUT_ENABLE | PULL_INACTIVE | MUX_MODE_2))/*MCSPI3_SOMI*/
        DEVICE_PINMUX_ENTRY(CONTROL_PADCONF_DSS_DATA21, (INPUT_DISABLE | PULL_UP | MUX_MODE_2))/*MCSPI3_CS0*/
        DEVICE_PINMUX_ENTRY(CONTROL_PADCONF_DSS_DATA22, (INPUT_DISABLE | PULL_UP | MUX_MODE_2))/*MCSPI3_CS1*/
    DEVICE_PINMUX_END(OMAP_DEVICE_MCSPI3, D0)

    if you don't know which mode to set for your pad, search "Table 1-5. Core Control Module Pad Configuration Register Fields" in 3530 user manual.

     

  •  

     

     

     

    Inspite of keeping the following code the SPI clock is not observed on the pin.

    pdwMemCtrl = (PDWORD)MmMapIoSpace(pa,

    pConfig = (OMAP_SYSC_PADCONFS_REGS *) pdwMemCtrl;

    pConfig->CONTROL_PADCONF_MCSPI2_CLK = (INPUT_ENABLE | PULL_INACTIVE | MUX_MODE_0);

    pConfig->CONTROL_PADCONF_MCSPI2_SIMO = (INPUT_ENABLE | PULL_INACTIVE | MUX_MODE_0);

    /*MCSPI2_SIMO*/
    sizeof(OMAP_SYSC_PADCONFS_REGS), FALSE); /*MCSPI2_CLK*/

    pConfig->CONTROL_PADCONF_MCSPI2_SOMI = (INPUT_ENABLE | PULL_INACTIVE | MUX_MODE_0);

     

    /*MCSPI2_SOMI*/ MmUnmapIoSpace(pdwMemCtrl, sizeof(OMAP_SYSC_PADCONFS_REGS));

    Here is the initialization we are doing for touch screen spi lines..

    config = MCSPI_PHA_ODD_EDGES |

    MCSPI_POL_ACTIVEHIGH |

    MCSPI_CHCONF_CLKD(s_TouchDevice.nSPIBaudrate) |

    MCSPI_CSPOLARITY_ACTIVEHIGH |

    MCSPI_CHCONF_WL(8) |

    MCSPI_CHCONF_TRM_TXRX |

    MCSPI_CHCONF_DMAW_DISABLE |

    MCSPI_CHCONF_DMAR_DISABLE |

    MCSPI_CHCONF_DPE0;

     

    // Configure SPI channel

     

    if (!SPIConfigure(s_TouchDevice.hSPI, s_TouchDevice.nSPIAddr, config))

    if (!SPIConfigure(s_TouchDevice.hSPI, s_TouchDevice.nSPIAddr, config))

    we tried writing to spi device using  spi driver function SPIWrite one sec repeatedly and probed sclk line..
    it was observed 0.4v and goies to 0volts every once sec

    it should be 1.8v actually ..

    I am using external chip select(GPIO).But when i set this GPIO and probe the voltage level it is showing is only 0.4 v.

    do i need to do any additinnal initialization other than mentioned code?

    any ext pull up req on spi clk & data lines?

    Can you tell me why?Do I need to do anything more?

  • When i am trying to read through SPI using SPIRead it is giving timeout and read through SPI using SPIWriteRead it is reading some data without any timeout.Can anyone tell me why?

    And reading through SPI using SPIWriteRead the slave is not responding and clock is also not being observed.Anything to be done during configuration?

     

  • In which transmit/receive mode is your SPI Channel?

    MCSPI_CHCONF_TRM_TXRX -> SPI_ReadWrite
    MCSPI_CHCONF_TRM_RXONLY -> SPI_Read
    MCSPI_CHCONF_TRM_TXONLY -> SPI_Write

    In SPI-Master mode you can only trigger the clock by writing to the ChannelTX register (which will be a dummy value for RXONLY-Mode).
    See chapter 19.5.2.4 Receive-Only Mode (Half Duplex) in the OMAP35x Technical Reference ManualMaster for further information.

    Check the following source file for more information:
    \PLATFORM\COMMON\src\soc\OMAP35XX_TPS659XX_TI_V1\OMAP35XX\spi\spi.c

    // Function: SPI_Read
    // This function reads data from the device identified by the open context.
    // Note that this is only allowed for MCSPI_CHCONF_TRM_RXONLY channels

    // Function: SPI_Write
    // This function writes data to the device.
    // Note that this is only allowed for MCSPI_CHCONF_TRM_TXONLY channels

    // Function: SPI_WriteRead
    // This function writes and reads data to/from the device.
    // Both buffers must be the same length.
    // Note that this is only allowed for MCSPI_CHCONF_TRM_TXRX channels

     

  • Hi Srinivas,

    I've same problem with you! did you solve it? and how?

    any suggestion...!