How to configure hardware SPI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure hardware SPI

Jump to solution
692 Views
configurehardwa
Contributor I

Hello my friends, i have a problem with enable SPI interface (MC9S12XS128MAA), i need it to my study. This is my configuration:

DDRM=0xff;
  /* SPI0CR1: SPIE=0,SPE=1,SPTIE=0,MSTR=1,CPOL=0,CPHA=1,SSOE=1,LSBFE=0 */
  SPI0CR1 = 0x50;
  /* SPI0CR2: XFRW=1,MODFEN=1,BIDIROE=0,SPISWAI=0,SPC0=0 */
  SPI0CR2 = 0x10;                                      
  /* SPI0BR: SPPR2=0,SPPR1=0,SPPR0=0,SPR2=1,SPR1=1,SPR0=1 */
  SPI0BR = 0x07;                                      

COPCTL=0x00;

for(;:smileywink: {
SPI0DRL=0x44;  
while (SPI0SR_SPTEF!=0){}
}

I was trying with different conditions and loops.
I'm watching in osciloscope SCK port but there is nothing.

What i'm doing wrong ?
Thank You for any post.
Bye

Labels (1)
Tags (1)
0 Kudos
1 Solution
451 Views
kef
Specialist I

What port are you expecting SPI signals to be available at? By default SPI0 is routed to port S. You need to set MODRR bit 4 to route SPI0 to port M.

View solution in original post

0 Kudos
1 Reply
452 Views
kef
Specialist I

What port are you expecting SPI signals to be available at? By default SPI0 is routed to port S. You need to set MODRR bit 4 to route SPI0 to port M.

0 Kudos