How to configure hardware SPI

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to configure hardware SPI

跳至解决方案
1,629 次查看
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

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,388 次查看
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 项奖励
回复
1 回复
1,389 次查看
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 项奖励
回复