Hi
I was trying to configure SPI based sensor with K60 using Codewarrior 10.6. I am facing problem in reading the data. I was looking for some code for reading the register. I tried using PE components of SPI with DMA. using these components I am able to read 6 registers . The problem I am facing is all the 6 received values are not coming in order to the defined buffer. So I wanted to go with baremetal code. I tried using the example code for SPI but that didn't worked. Please look into the matter. and provide some simple code for readwrite. Thanks in advance
Kind Regards,
Amit Kumar
Hi Amit Kumar,
Could you tell me the full name of your chip and your maskset number?
If your K60 is our Kinetis 100 MHz Rev. 2.x chip, you can refer to the spi code in our KINETIS512_V2_SC sample code, the code link is :
http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS512_V2_SC&location=null&fasp..., Boot Code, Headers, Monitors, etc.&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=zip&WT_ASSET=Downloads&fileExt=.zip&Parent_nodeId=1333141411984714199192&Parent_pageType=product
There has a SPI IAR project, you can refer to the code.
After you initialize the SPI module, you should use the command from your SPI sensor to do communication, your SPI communication time sequence should be consist with your sensor datasheet.
If the communication is not OK, you should better use the logic analyzer to check the communicate wave , whether your send command is correct. I think you should not use the DMA at first until your SPI communication is ok.
Wish my answer helps you!
If you still have question ,please let me know!
jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------