AnsweredAssumed Answered

SPI Slave Problem with ADSP 21469

Question asked by Hfuhrhurr on Sep 25, 2012
Latest reply on Sep 26, 2012 by Hfuhrhurr

Hi,

 

I have a problem with transferring data from a Stellaris ARM CPU to the 21469 over SPI. The DSP is configured as slave.

I can successfully boot the DSP as a slave from the CPU, so in principle, the connection works fine.

However, normal data transfer after booting the DSP does not work.

I boiled down my code to a small test program just to check SPI.

Here it is

/*****************************************************************************
 * main.c
 *****************************************************************************/
#include <sysreg.h>
#include "defines.h"
#include <sru21469.h>
#include<cs_macros.h>

void Receive_data(int i);

int destination[16];
int dma_done = 0;

void main()
{
    ADSP_2146X_PLL_Init_INDIV_STEP_NOT_REQUIRED(36,2,0,2,3);
   *pSPICTL = 0;
   *pSPIDMAC = 0;
   *pSPIBAUD = 0;
   *pSPIFLG = 0;
   
      
   interrupt(SIG_SPIH, Receive_data);
   
   *pIISPI = (int)destination;
   *pIMSPI = 1;
   *pCSPI = 16;

   *pSPICTL = RXFLSH | TXFLSH;
   *pSPIDMAC = FIFOFLSH;
   
   *pSPICTL =  MSBF| CPHASE| CLKPL| SPIEN | WL16 | TIMOD2 ;
   *pSPIDMAC = SPIDEN | SPIRCV | INTEN;

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

}
void Receive_data(int i)
{
   dma_done = 1;   
}

 

From the CPU, I send data by manually controlling the slave select line to be able to control the timing in detail.

With a scope, I recorded the signals data, clk, slave select (from top to bottom),

SPITiming_Slave.png

I don't see anything wrong with this, however, the data are not transferred.

The weirdest thing is, that yesterday, 3 or 4 times it worked, today, I can not reproduce that. Booting over SPI still works.

SPI rate is 50kHz, currently, but I also tested values up to 500kHz.

 

What do I miss?

 

Regards,

 

Rainer

Outcomes