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 on OMAP 4460

Other Parts Discussed in Thread: 4460, SYSCONFIG

I am manually setting up the SPI1 CS0 ports of an OMAP 4460.  I think I am very close.  The status byte of this channel indicates I have transmitted "something".  But I have been monitoring the SPI1 Clock and Master-Out lines with an oscilloscope and have seen nothing.  I see in a block diagram on page 4774 of the 4460's TRM that there are 2 signals that can "cut off" the SPI from the outside world.  They are labelled SPIMASTERGZEN and SPIDATAGZEN.  But, try as I might, I can not find where I can control any such named "control signals".  These strings just do not show up anywhere else in the 4460's TRM.  Does anyone know of an alias I can search for.  Or, better, what register and bit I need to manipulate to get the SPI signals (if that is my problem) out to the world?

-thanks

  • Hi,

    Did you check the pad configuration in the control module chapter. Because although the SPI is appearing to transmit data the data had never pass through the pads.

    CONTROL_CORE_PAD0_I2C4_SDA_PAD1_MCSPI1_CLK[31:16]              MODE1

    CONTROL_CORE_PAD0_MCSPI1_SOMI_PAD1_MCSPI1_SIMO[15:0]      MODE1

    CONTROL_CORE_PAD0_MCSPI1_SOMI_PAD1_MCSPI1_SIMO[15:0]      MODE1

    CONTROL_CORE_PAD0_MCSPI1_CS0_PAD1_MCSPI1_CS1[15:0]            MODE1

    For more information see files - arch/arm/mach-omap2/mux44xx.c

     arch/arm/mach-omap2/omap_hwmod_44xx_data.c

    Check also the PRCM configuration. To activate SPI module - 

    CM_L4PER_MCSPIx_CLKCTRL[1:0] MODULEMODE
    - 0x2 Module is explicitly enabled. Interface clock (if not used for functions) may be gated according to the clock domain state. 

    Set the clock signals for SPI module -

    PER_48M_FCLK and PER_L4_ICLK. These signals must be configured by DPLL_PER and DPLL_CORE respectively.

    Also take a look at this article for reference http://www.omappedia.com/wiki/PandaBoard_SPI

    Regards,

    Boyko

  • Thank you for your help Boyko.  Unfortunately things have regressed and I have lost the indication that the SPI1 device in the OMAP 4460 is done sending data.  I hate to do dump each register write into a thread but I am nearing a point where I can not see the trees in the forest.  I will try and add as much of my understanding to each memory write as comment.  Perhaps I might yet be able to control the SPI1 device on the OMAP 4460.  At the very least I am hoping that you or other will see were I have skipped over a key setting:

    # Turn on clocks to SPI1 section of OMAP (CM_L4PER_MCSPI1_CLKCTRL)
    sudo omapconf write 0x4a0094f0 0x00030002

    ...I'm going to have to finish this in the next post...

  • Here are my current set of write commands that do not work.  I am looking at the SPI1 MOSI and SPI1 Clock outputs with a scope as I type these commands in.  I see nothing.  Again, I can flip the pins to the GPIO feature inside the OMAP and send out 1's and 0's on these same two pins.  So I do not think I have the wrong pins:


    -------------------------

    # Turn on clocks to SPI1 section of OMAP (CM_L4PER_MCSPI1_CLKCTRL)
    sudo omapconf write 0x4a0094f0 0x00030002

    # (R:) Master (not slave) MCSPI_MODULCTRL
    sudo omapconf write 0x48098128 0x00000001

    # (R:) Control of SPI1 MODE:
    sudo omapconf write 0x4A0094F0 0x00000002

    # Master Transmit-Only Mode (Half Duplex): [4]
    # R: Enable SPI1/CS0 MCSPI_CHxCTRL
    sudo omapconf write 0x48098134 0x00000001

    # (R:) Make sure we are connecting the SPI feature to physical pins:
    # Set SPI1 clock to SPI1 clock
    sudo omapconf write 0x4a100130 0x00000000
    # Set SPI1 SIMO to SPI1 SIMO
    # Set SPI1 SOMI to SPI1 SOMI
    sudo omapconf write 0x4a100134 0x00000000
    # Set SPI1 Chip Select to SPI1 Chip Select
    sudo omapconf write 0x4a100138 0x00000000

    # SPIDAT[0] selected for xT
    sudo omapconf write 0x4809812C 0x0a012897

    # R: The MCSPI_TXx (1st) register (write some test data):
    sudo omapconf write 0x48098138  0x0555A0A0
    -------------------------


    If anyone sees where I have made a mistake or have skipped over a register please let me know.  I'll be more than glad to test any suggestions out and create a follow up post should things start working.

    -thanks

  • Boyko, I think you want me to also configure 0x4a00814c and 0x4a00412c which areCM_AUTOIDLE_DPLL_PER and CM_CLKSEL_DPLL_CORE (I think) respectively.  Are these the registers you called out in your post above.   I am looking the the 4460 specifications and do not understand how they work or how they could turn on the Functional and Interface clocks to the SPI1 feature of the OMAP.  Can you point me in the correct direction here?


    -thanks

  • We have modified the script and gave it another go.  We noticed that the chip enable goes from lo to hi for about 2 seconds.  And the clock line does the same.   But we never see the expected additional clock transitions.  We still are not seeing any data coming out of the MOSI (aka SIMO) port pin.  Here is our updated script:

    --------------------

    # Set SPI1 clock to SPI1 clock
    ## For coded version, Need to read the lower word and not change
    # sudo omapconf write 0x4a100130 0x00000007
    sudo omapconf write 0x4a100130 0x00180007

    # Map SPI1 data lines
    sudo omapconf write 0x4a100134 0x00000000

    # Set SPI1 Chip Select to SPI1 Chip Select
    sudo omapconf write 0x4a100138 0x00070000

    # Turn on clocks to SPI1 section of OMAP (CM_L4PER_MCSPI1_CLKCTRL)
    ## Lets write 0x000000002
    sudo omapconf write 0x4a0094f0 0x00030002

    ## Need to soft reset the SPI module
    ## Clockactivity= 3 OCP and functional clocks are maintained
    ## SIdleMode = 1 idel request is ignored and the module keeps on behaving normally
    ## ENAWAKEUP = 1
    ## SOFTRESET = 1
    ## AUTOIDLE  = 0 OCP clock is free-running

    sudo omapconf write 0x48098110 0x0000030E

    ## In the code version, need to read the sysconfig register to determine when the reset is done.
    ## For this script, a short delay will work
    sleep 1
    ##### SPI Transmit Mode Initialization #####
    ## MCSPI_CH0CONF  8-bit word
    sudo omapconf write 0x4809812C 0x00022380
    ## MCSPI_CH0CONF  16-bit word
    ##sudo omapconf write 0x4809812C 0x00022780

    ## MCSPI_MODULCTRL
    sudo omapconf write 0x48098128 0x000000001
    # Make Slave Mode
    # sudo omapconf write 0x48098128 0x000000005

    ## load data into the transmit register
    sudo omapconf write 0x48098138 0x000000A9

    ## MCSPI_CH0CTRL - enable the SPI
    sudo omapconf write 0x48098134 0x00000001

    ## MCSPI-IRQSTATUS
    ## No need to write to this register; defaults are correct

    sleep 1

    ## MCSPI_CH0CTRL - disabled the SPI
    sudo omapconf write 0x48098134 0x00000000

    --------------------


    If anyone see a problem I would be more than happy to hear about it.


    -thanks!

  • Hi, Can you check the status of:
    PM_L4PER_PWRSTCTRL[1:0]POWERSTATE
    CM_L4PER_CLKSTCTRL[1:0]CLKTRCTRL
    ( you can get a clear picture of the required registers, using the CTT tool)
    Regards,
    Boyko
  • Hi Boyko,  thanks for answering.  Here are the values for PM_L4PER_PWRSTCTRL[1:0]POWERSTATE andCM_L4PER_CLKSTCTRL[1:0]CLKTRCTRL  you asked about:

    $ sudo omapconf read 0x4A307400
    000F0101

    $ sudo omapconf read 0x4A009400
    00060103

    It looks like the POWERSTATE is "RETENTION state".  I think I will try "ON State" to see if it makes a difference.  And it looks like CLKTRCTRL is "HW_AUTO".  I think that is the best state to be in for our purposes.  What do you think?

    -thanks

     

  • Hi,

    It seems the problem is exactly because it is in RETENTION state, waking it up (from the PRCM registers) will be enough.

    So you could set NO_SLEEP and then change the state manually.

    Regards,

    Boyko