AnsweredAssumed Answered

Non DMA SPI interrupt on BF533 -- SPI in echo mode

Question asked by MikeSmithCanada on Dec 16, 2014
Latest reply on Jan 14, 2015 by jobo23

Hi

 

Trying to demonstrate a simple SPI read interrupt where the MOSI and MISO lines are connected -- echo

prior to going over and having 1 blackfin in master mode and another in slave mode -- where they are exchanging information via the SPI

 

I had to initially set IMASK = 0xFFE0 and SIC_IMASK = 0xFFFF FFFF as I could not find anything about non-DMA SPI

However, finally settled on

 

volatile int numWriteInterrupts = 0;

volatile short int SPIReadBufferValue = 0;

 

#pragma interrupt

void SPI_ReadInterrupt(void) {

    numReadInterrupts++;

    SPIReadBufferValue = *pSPI_RDBR;

}

 

void Init_MockSPI_ReadInterrupts(void){

    *pSPI_BAUD = 0x10;

    *pSPI_FLG = 0x0020;

    *pSPI_CTL = 0x1920;

    *pEVT10 = (void *) SPI_ReadInterrupt;

    *pSIC_IMASK |= 0x2000;

    *pIMASK |= 0x400;

    ssync();

}

 

Now to test

 

MOSI connected to MISO

 

If I do

*SPI_TDBR = 5;

and I see *SPI_SHADOW = 5 (and SPI_RXBR = 5) but no interrupt

 

If I do

int value = *pSPI_TDBR -- to start the interrupt chain -- then I was expecting an interrupt if I did a SPI transmit

 

However I get an infinite number of interrupts -- without having to do *pSPI_TDBR = XX which is what I expected to do given I was trying to set up an SPI echo

 

SO what concept am I missing if I don't want to get multiple interrupts when I am trying in SPI echo mode?

Meaning -- I want to get 1 SPI read interrupt only after I have transmitted a new SPI_TDBR value

 

Thanks

Mike

Outcomes