SPI communication, clocking data from a Slave device

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

SPI communication, clocking data from a Slave device

1,293 次查看
DannyP
Contributor I

Hi,

 

I have been working on the SPI bus on the MC9S08. The writing to the slave works, whereas I am having a few problems with the reading part.

I see the command I send to the slave to go to read mode correctly sets the MISO line low and it is waiting for the SPI clock to spit out some data.

My question therefore is quite simple: Is it correct that to generate the SPI clock for every byte on I want to receive, I have to write a dummy byte into the SPID register and send it? I can't seem to find another way to generate the SPI clock.

 

Thanks in advance for any hints

标签 (1)
0 项奖励
回复
2 回复数

1,002 次查看
bigmac
Specialist III

Hello, and welcome to the forum.

 

Refer to one of the posts within this recent thread for a basic SPI master communications code example.  It provides a single function that is capable of both send and receive SPI operations.

 

Regards,

Mac

 

0 项奖励
回复

1,002 次查看
rocco
Senior Contributor II

Hi Danny,

 

Welcome to the forum.


. . . Is it correct that to generate the SPI clock for every byte on I want to receive, I have to write a dummy byte into the SPID register and send it?

Yes.

0 项奖励
回复