Kinetis K60 SPI Weird Behavior

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

Kinetis K60 SPI Weird Behavior

959 次查看
broccolee
Contributor III

I am using TWR-K60N512, with PK60DN512Z VMD10 chip. I am trying to set up the SPI module to communicate with Adis16362 IMU (http://www.analog.com/media/en/technical-documentation/data-sheets/ADIS16362.pdf ), which uses SPI mode 3, CPOL = 1, CPHA = 1.

 

I am able to read output data such as supply voltage, product ID, accelerometer measurements!  HOWEVER, it only works the first time after a USB plug cycle, so it outputs nothing if I were to reflash the code again without doing a USB plug cycle first. Sometimes, it still outputs nothing anyway...

 

Any idea how I can troubleshoot this? I have attached my code.

 

Thanks.

Original Attachment has been moved to: SPI.c.zip

0 项奖励
回复
2 回复数

776 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

From you attached code, there only with one line at SPI_START_TRANSFER() function to clear SPI2_SR [EOQF] flag need be modified to:

SPI2_SR |= SPI_SR_EOQF_MASK ;

I checked the ADIS16362 datasheet, the SPI communication clock Max. is 2MHz. Please check the K60 SPI clock frequency if match with ADIS16362 requirement.

And I would recommend to use a SPI analyzer to check the SPI communication signals if there with any timing issue.


Wish it helps.

Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

776 次查看
broccolee
Contributor III

Thanks, I got it working already.

0 项奖励
回复