Post Go back to editing

Re: Need a code example of slave spi-dma for 21262

Dear Jeyanthi :

                          I download your attached file 21262_SPI_Slave.zip, I have some question hope you can help me ?

1.The attached file code is for SPI slave recevice?

2.Do you have example code is for SPI slave transmit?

3.Can you give some advice to me about my problem? I really don't know where is the problem!  Thanks so much!

  http://ez.analog.com/message/25166#25166

  • Hi Pingu,

               The 21262_SPI_Slave example code uses the SPI slave in receive mode. The same code can be modified for transmit operation as below:

    void main()
    {
    *pSPICTL = 0;

    interrupt(SIG_SPIH, Transmit_data);

    *pSPICTL =  SPIEN | TIMOD1 | WL32;

    while(1)
    {
      asm("nop;");
    }
    }

    void Transmit_data(int i)
    {
    *pTXSPI =  source[int_count];
    int_count++;

    if(int_count >= N)
      *pSPICTL = 0;
    }

    Regarding the issue seen on the other post, I could see that Mitesh has suggested few things on his last post. It will be good if you can post your follow-up questions on the same post to avoid any duplication efforts.

    Hope this helps.

    Best Regards,

    Jeyanthi