uCdimm SPI1 bus

From: Sriram Chadalavada (swenggsri_at_yahoo.com)
Date: 11/22/04

  • Next message: sudheervemana: "packages required for linux kernel 2.6.9"
    Date: 21 Nov 2004 16:33:52 -0800
    
    

    Dear group members,

         I am running uClinux 2.4.x kernel (20040408 distribution) on
    Arcturus uCdimm (uCevolution board) and trying to test the SPI1 bus.

    On sending 0xFF bytes repeatedly on the SPI1 bus, I am not able to
    observe any clock transitions on the SPICLK1 line(on a scope and
    multimeter). It changes from high to low only once at the very
    beginning and that's it, remains constant.

    Also, the SPI output line is constantly high whether I send 0xFF or
    0x00 data.
    There is an SPI enable line (general purpose I/O pin) that is set
    correctly though to high.

    Can somebody with experience help me out here? Am I missing something
    here? We have not connected the slave device and the uCdimm runs as
    SPI master at fastest possible 4MHz (SYSCLK/8).

    PLease review the C code (for more details) that I wrote to send a
    string of characters on the bus.

    Thanks in advance,
    Sriram

    void spiInit()
    {

    /* Since General Purpose I/O Port J 0-3 pins are multiplexed with
    SPI1 bus pins, clear them to SPI mode */
    /* by modifying the PJSEL register as follows */
      PJSEL &= 0xF0;

    //Initialize SPI Control/Status register
      SPICONT1 = 0;

      //Intialize remaining bits of the control register
      SPICONT1 |= 0x0407; // Mode is set to master, Data ready signal is
    not used, SS Polarity and waveform select bits cleared, bit count is
    8.

    SPICONT1 &= 0x0EFF;; //Set bitrate to SYSCLK (16.58 MHz) by 4 ~
    4MHz(maximum value). After reset, this is the default value.

      //Set ENABLE bit in the SPICONT1 register
      SPICONT1 |= 0x0200;

    /* Initialize the SPI1 sample period control register
     * Make the number of clock periods inserted between data
    transactions in master mode equal to '1'.
    */
      SPISPC = 0x01;
    }

    /* Function: Static function to send given data over SPI1 bus.
       Parameters: sendData - Data to be transmitted, numSendBytes -
    Number of bytes to be sent, sp - Status pointer
       Return value: None
    */
    static void spi1RawSend(unsigned char *sendData, int numSendBytes,
    SPIStatus_t *sp)
    {

      unsigned int count;

      for (count=0; count<numSendBytes; count++)
        {
          //Wait until last SPI transaction is completed or the number of
    data words in TxFIFO is 0.
          while (SPICONT1 & 0x0100);

          //Fill data register with the next byte of data.
          SPITXD = sendData[count];

          //Set XCH bit in the SPICONT1 register. Start writing.
          SPICONT1 |= 0x0100;
        }

    }


  • Next message: sudheervemana: "packages required for linux kernel 2.6.9"
  • Quantcast