Hello, i am working on a custom board using k64 and i have just accesed it via jtag,tested some basic pin I/O and it's ok.
I now have a problem accessing the MMA8451Q over I2C .
I have used the electrical schematic as advised in it's datasheet (SA0 is pulled down via 10k resistor). On the microcontroller side i am using PTE0 (I2C1_SDA) and PTE1(I2C1_SCL) both with 2k2 pull up resistors.
I have tried using the example from the sdk : cmsis_i2c_read_accel_value_transfer .
I have replaced the pins and port used in the example with my own and the console says that it is not able to find and accelerometer device.
I have also tried to modify the macro on line 22 into pointing to Driver_I2C1 instead of Driver_I2C0 and in the rest of the file into I2C1 but it gives compilation errors.
Any thoughts ?
kerryzhou would you be so kind as to lend me a helping hand once more ?
Solved! Go to Solution.
Hi Bogdan Nica,
It's very good that you find the root problem.
Do you still have any question about this topic?
If you still have question about it, please kindly let me know.
If your question is solved, please help me to mark the correct answer, just to close this case, thank you!
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Bogdan Nica,
1. check the MMA8451Q schematic:
Of course you can connect SA0 =0.
Just the slave address is different:
About the code, if you can connect the PTE24 and PTE25, then you can test it with the SDK code directly, without modification, just test whether your hardware have problems or not.
But if you can't modify your hardware, then you need to modify the code pin to PTE0 and PTE1, the I2C interface you need to modify it to I2C1.
If you still have problems, you can check the I2C bus, whether it has wave or not? If the SCK and SDA pin even don't have the wave, it means your code still have problems.
Please try it on your side at first.
If you still have question about it, please kindly let me know.
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Thank you for the help ,
It ended up being the code .
I used another example that i modified and is now accessing the accelerometer.
Thank a lot !
Hi Bogdan Nica,
It's very good that you find the root problem.
Do you still have any question about this topic?
If you still have question about it, please kindly let me know.
If your question is solved, please help me to mark the correct answer, just to close this case, thank you!
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Bogdan
Please load the attached binary file to your custom board.
Assuming you have a USB connection on the board (USB-CDC) or UART interface on PTB16/PTB17 (115kBaud) you can communicate with it and command the following:
1. Hit Enter key to see menu
2. Enter 7 and Enter to go to the I2C menu
3. Enter "acc_on" and Enter to see MMA8451Q output
The MMA8451Q is configured on I2C1 (PTE0 and PTE1) and SA0 pulled down.
It is a crystal-less configuration so will run on any K64F. I simulated it and if you can prove that it works it will represent a solution for your board and can be contained free at
https://github.com/uTasker/uTasker-Kinetis
Regards
Mark
Complete Kinetis solutions for professional needs, training and support:http://www.utasker.com/kinetis.html
uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market
Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html