LPI2C Non Blocking ( DMA) s32k144

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPI2C Non Blocking ( DMA) s32k144

1,867 Views
snow3847
Contributor II

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).

 

Labels (2)
Tags (1)
0 Kudos
Reply
6 Replies

1,812 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply

1,811 Views
snow3847
Contributor II
I already tried non blocking and it works fine. I need the DMA version now. DMA works now but after a defined period of time the Data line is low in the picoscope and i need to reboot for it to be high again and working. any idea why?
0 Kudos
Reply

1,777 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

danielmartynek_0-1718786956248.png

 

AN4803 I2C Non-Blocking Communication

https://www.nxp.com/docs/en/application-note/AN4803.pdf

i2c.c file

tI2C_fault I2C_Restore()

 

Regards,

Daniel

 

0 Kudos
Reply

1,824 Views
snow3847
Contributor II

snow3847_0-1718635179165.png

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 : 

snow3847_1-1718635413612.pngsnow3847_2-1718635438993.pngsnow3847_3-1718635481223.png

snow3847_5-1718635519083.pngsnow3847_6-1718635543958.png

 

 

 

0 Kudos
Reply

1,836 Views
snow3847
Contributor II
 
0 Kudos
Reply

1,839 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply