Announcement

Collapse
No announcement yet.

SPI comunication

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SPI comunication

    Hi



    Recently I bought uLCD-70DT and I’m trying to send 16bits at same time with SPI protocol.

    The code that I’m using is:



    #platform "uLCD-70DT"

    #inherit "4DGL_16bitColours.fnc"



    func main()

    gfx_ScreenMode(LANDSCAPE) ; // change manually if orientation change

    // SPI configuration /////////////////////////////////

    SPI1_Init(SPI_SPEED5,SPI16_MODE_0); //speed 1Mhz and mode 1 read and mode 1 write

    SPI1_SCK_pin(PA3);

    SPI1_SDI_pin(PA0);

    SPI1_SDO_pin(PA1);



    repeat

    pin_LO(PA6); //Enable CS_SPI_A

    SPI1_Write(0x1234);

    pin_HI(PA6); //Disable CS_SPI_A

    pause(200);

    forever

    endfunc



    I checked with scope with digital analyser and there are only 8 bits sent “0x34”.

    Somebody has any suggestion?

    Thanks

  • #2


    Hi: I think you may need to send two separate "SPI1_Write" writes, one for each byte,don't hold me to this just throwing out a quick suggestion.

    Bob

    Comment


    • #3


      Hi

      Thanks a lot for the answer.

      I tried send two bytes in separate lines, however it doesn't work.
      First, it send 8bits, then apply 4us delay and finally send the last 8bits.

      Jordi

      Comment


      • #4


        Jordi: Are you saying that it is now working?

        Bob

        Comment


        • #5


          Hi

          It is not working because it doesn't send the 16 bit togheter.

          thanks
          Jordi

          Comment


          • #6


            Bonjour ,
            OH YES I try the same thing I see ONLY THE MODE 0 8 BITS is correct
            ALL other modes are mode 0 8 bits !! it is very unfortunate
            may be in the future other modes exist?
            I ask ESP for this problem in december 2013
            to solve the problem
            send separatly 2 bytes

            var myvar;
            SPI1_Init(SPI_SPEED5,SPI8_MODE_0)
            ...
            ...

            repeat
            SPI1_Write(myvar>>8); // hi byte
            SPI1_Write(myvar

            Comment


            • #7


              Hi
              sorry I made a mistake in my last reply
              //Enable CS_SPI_A
              SPI1_Write(myvar>>8); // hi byte
              SPI1_Write(myvar&0xFF); // lo byte
              //Disable CS_SPI_A
              Jean michel

              Comment


              • #8


                This issue has been reported and be verified in the next day or so.

                For the moment I recommend using 8bit SPI
                Mark

                Comment


                • #9


                  Hmm, perhaps a bit worse than previously thought.

                  Basically only modes SPI8_MODE_0 and SPI8_MODE_1 working for SPIx_Init()
                  Mark

                  Comment

                  Working...
                  X