SPI rutine

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

SPI rutine

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

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