Hi,
I am using K64F120 for my project. I generate the probject with MQX and PE using KDS, and works fine.
Now, I am using PE to generate I2C to read the sensor register on board using I2c Pheripheral driver. I have the following problems:
1) If I enable auto initilization for master, I can't get out initilization call...
2) If I do intilization in task and initilization is fine. When I call "I2C_DRV_MasterReceiveDataBlocking...", I can't get out this call...
Could you tell me where I am wrong? HOw to use pheripheral driver to develop my I2C application?
Thanks,
Christie
Hi Christie,
Are you using the MQX driver?? You can find an example at the paths:
C:\Freescale\Freescale_MQX_4_1\mqx\examples\i2c
Please check the attached document, this document explains the IIC driver example, what to expect from the example and a brief introduction to the IIC driver API.
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Soledad,
I am using MQX lite, not full MQX package because I want to add as less resource as possible.
I am using lite MQX with PE in KDS... I can use PE to generate GPIO pheripheral driver to drive LEDs on board.
When I generate driver for I2C, I have the problems for auto initialization.
Is it related to ISR for I2C? How can I configure ISR for I2C because there is no this option?
Thanks,
Christie
Please check the below threads:
Hi Soledad,
I am using KDS with PE. Then I add MQX, GPIO driver by using PE to create my project.
When I use the peripheral driver to add I2C and use auto initialization, it causes running problem. Then I checked and the problem is created by semaphore created in Master_init function, If I disable it, it is OK.
Then, I am using receiveBlock function to read the accelerometer on board(Add==0x3A) and get failed(==0x02).
1) Why is it failed on initialization?
2) Do you have a sample code how to use peripheral driver function calls to read/write I2C device?
Thanks,
Christie
Hi Soledad,
I tried one form sample code of KDS(Comunication Demo) using the same function call from KSDK and works fine.
Now only difference is that I am using PE to generate peripheral driver for I2C(fsl_i2c).
1) Auto initilization does not work until I remove OSA_SemaCreate(&master->irqSync, 0) in intilization rountine.
2) If I call I2C_DRV_MasterReceiveDataBlocking(), I got stuck when OSA_SemaCreate is in initilization. The call will get failed(0x02) if I remove OSA_SemaCreate...
Looks like I need to enale OSA_Sema in interrupt. But, this component does not allow me to genrate ISR...
Could you tell me if it is possible reason? And how to fix it?
Thanks,
Christie