SPI communication, clocking data from a Slave device

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

SPI communication, clocking data from a Slave device

747 Views
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

Labels (1)
0 Kudos
2 Replies

456 Views
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 Kudos

456 Views
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 Kudos