SPI communication in MC9S12ZVML motor control board

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI communication in MC9S12ZVML motor control board

27 Views
ImranAviconn
Contributor II

Hi,

I have initialized the SPI and set its ISR but I could not receive the data and below is my code. The SPI can be set on either PORT S or PORT T and I have set the SPI on both and still it is not working. Below is my sample code for initialization of SPI and its ISR, SPI is set as slave:

void SPI0_init(void){
DDRS = 0X07;
SPI0CR1 = 0xC0;
SPI0CR2 = 0x00;
// SPI0BR |= 0x07;
INT_CFADDR = 0x68;
INT_CFDATA0 = 4;
}

 

INTERRUPT void SPI0_ISR(void){
PTT_PTT1 = ~PTT_PTT1;
rx = SPI0DRL;
}

Tags (2)
0 Kudos
1 Reply

6 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @ImranAviconn,

I would recommend testing the ports in Master mode first.

There is no need to set the direction of the pins (DDRS) as this applies to the GPIO mode only.

The S12ZVM has the same SPI module (S12SPIV5) as the S12G.

Please find the example attached.

 

BR, Daniel

0 Kudos