Hi,
I am trying to use the LPI2C with DMA but i have the problem that it sometimes goes inside of my callback function that i use in the master configuration and sometimes not. I need to reboot the Board for it to work again. The sending and recieving seems to be inconsistent for the DMA request bit will only be enabled if the sending/receiving is completed so sometimes the callback will be ignored in the same debug session.
(the inconsistant behaviour is also present with the blocking version but after reboot i can read my temperature sensor and by Non blocking i receive false values).
Hi @snow3847,
I would recommend using the blocking method first.
Make sure you read the status code that the LPI2C_DRV_MasterSendDataBlocking() and LPI2C_DRV_MasterReceiveDataBlocking() return.
Check with the datasheet of the slave device where the Stop condition should be placed.
Once this is working, switch to the non-blocking mode.
BR, Daniel
Hello @snow3847,
This is probably the Slave device that holds the bus low.
UM10204 I2C-bus specification and user manual
https://assets.nexperia.com/documents/user-manual/UM10204.pdf
AN4803 I2C Non-Blocking Communication
https://www.nxp.com/docs/en/application-note/AN4803.pdf
i2c.c file
tI2C_fault I2C_Restore()
Regards,
Daniel
i have this when i use the picoscope(which is false because 200 is not right). Then I rebooted and i got the right temperature. I don't know why but it works now.
I am trying now to handle multiple slaves on the same bus but it not working for me so far. i cannot read the temperature anymore.Can you expalin how are multiple slaves are handled at the same time . And here is my updated code :
Hi @snow3847,
Can you measure the bus with an oscilloscope / logic analyzer?
There is a possibility that the Slave device hold the bus low, the transfer does not complete, and it requires a reboot.
Can you share the project here?
Regards,
Daniel