SPI rutine

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

SPI rutine

Jump to solution
604 Views
Alek
Contributor I

Hi all, I am new in code warrior, I need help. I am using a QG8 and I need a rutine for SPI, I need to connect the qg8 at other device for SI, and I dont know how to made this rutine.

 

Thanks

Labels (1)
Tags (1)
0 Kudos
1 Solution
358 Views
Jim_P
Contributor III

you are asking a lot

 

first figure out the message packaging that you need - - - number of bytes,  start character, termination character

and method for packet reset so if something gets lost, the packet can recover and be looking for starting byte.

 

setup the SPI on both micro's - - - such that clock rates are within spec's of both devices - - typically have to be 1/4 of buss clock speed. for the receiver/slave. 

 

Read the SPI document for the micro.

 

Realize that each time you send a byte you receive a byte. And many times what you receive is garbage - - -

in code give time for the receiver to receive each byte and respond - - - -

 

a write to the SPI data register triggers the SPI byte transfer - - one byte out and one byte in.

great for high speed micro to micro

but also great for all of the one chip interface chips - - - A/D, D/A etc.

 

View solution in original post

0 Kudos
1 Reply
359 Views
Jim_P
Contributor III

you are asking a lot

 

first figure out the message packaging that you need - - - number of bytes,  start character, termination character

and method for packet reset so if something gets lost, the packet can recover and be looking for starting byte.

 

setup the SPI on both micro's - - - such that clock rates are within spec's of both devices - - typically have to be 1/4 of buss clock speed. for the receiver/slave. 

 

Read the SPI document for the micro.

 

Realize that each time you send a byte you receive a byte. And many times what you receive is garbage - - -

in code give time for the receiver to receive each byte and respond - - - -

 

a write to the SPI data register triggers the SPI byte transfer - - one byte out and one byte in.

great for high speed micro to micro

but also great for all of the one chip interface chips - - - A/D, D/A etc.

 

0 Kudos