AnsweredAssumed Answered

SPI0 isn't interrupting on BF518F

Question asked by jpb on Feb 3, 2011
Latest reply on Feb 7, 2011 by Prashant

Hi,

 

I wrote the code below to test the SPI0 on BF518F, but the spi isn't interrupting.

I'm not sure if i am programming the register correctly.

 

 

void initSpi(void){

 

 

// Mux SPI0 CLK, MISO, MOSI, SSEL2

 

*pPORTG_MUX &= 0x3FFF;

ssync();

 

// Enable SCK, MISO, MOSI, SSEL2

*pPORTG_FER |= PG12 | PG13 | PG14 | PG15;

 

// Datasheet pg. 9-10

*pPORTH_FER |= 0x100;

*pPORTHIO_DIR &= 0xFEFF;

ssync();

 

// Baud rate

*pSPI0_BAUD = 100;

 

 

 

// SSPISSEL 2 enable

*pSPI0_FLG |= FLS2;

*pSPI0_FLG &= 0xFBFF;

 

 

 

// SPE | MSTR | CPOL | CPHA | SZ

*pSPI0_CTL = 0x4000 | 0x1000 | 0x800 | 0x400 | 0x4;

ssync();

 

 

// Register the SPI handler

register_handler(ik_ivg7, spiCallback);

 

 

// Setting Interrupt mask for SPI status

*pSIC_IMASK1 |= 0x00008000;

 

// Dummy value

*pSPI0_TDBR = 0xAA;

 

 

// Just a test

while(1)

     VDK::Sleep(1000);

}

 

 

EX_INTERRUPT_HANDLER (spiCallback)

{

     // Never called

 

     if(*pSIC_ISR1 & 0x8000){

        

     }

 

}

 

 

Best regards,

João Paulo Bodanese

Outcomes