S32K118 FlexIO I2C with DMA

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

S32K118 FlexIO I2C with DMA

824 Views
seanwu
Contributor IV

Dear sir,

Now I am using FlexIO to be 2 I2C masters with DMA. I will reset I2C1 master(DMA channel is 2 and 3) if it is always BUSY. And then I will do FLEXIO_I2C1_DRV_MasterDeinit() and then  do FLEXIO_I2C1_DRV_MasterInit() to reset I2C1. Now I have a question is I should reset DMA(channel 2 and 3)? And if should, how to just reset DMA(channel 2 and 3)?

 

Thanks.

BR,

Sean Wu

Tags (1)
0 Kudos
Reply
7 Replies

787 Views
seanwu
Contributor IV

Dear sir,

I am using S32DS 3.5, and SDK is S32K118 SDK 4.0.1.

Thanks.

BR,

Sean Wu

0 Kudos
Reply

775 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Dear Sean Wu,

Why don't you use the FLEXIO_I2C_DRV_MasterTransferAbort()?

It also disables the DMA in FLEXIO_I2C_DRV_MasterEndTransfer().

 

Regards,

Daniel

0 Kudos
Reply

772 Views
seanwu
Contributor IV

Dear sir,

Thanks for your reply. Below are my steps to reset I2C1 when always busy. And you said DMA is disabled in FLEXIO_I2C_DRV_MasterTransferAbort(), and after reset I2C1, I should init DMA again?

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FLEXIO_I2C_DRV_MasterTransferAbort(&i2cMasterState[0U]);

FLEXIO_I2C_DRV_MasterDeinit(&i2cMasterState[0U]);

FLEXIO_I2C_DRV_MasterInit(INST_FLEXIO_I2C_CONFIG_1, &Flexio_i2c_Config0, &i2cMasterState[0U]); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Thanks.

BR,

Sean Wu.

0 Kudos
Reply

754 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Dear @seanwu,

There is no need to deinit DMA.

And I think there is no need to deinit the FLEXIO_I2C_DRV_Master either if you use the FLEXIO_I2C_DRV_MasterTransferAbort() function.

 

Regards,

Daniel

0 Kudos
Reply

736 Views
seanwu
Contributor IV

Dear sir,

So I just use FLEXIO_I2C_DRV_MasterTransferAbort() function to exit I2C Busy status?

I don't need to deinit/init DMA and FLEXIO_I2C_DRV_Master, right? And after FLEXIO_I2C_DRV_MasterTransferAbort() function, I can FLEXIO_I2C_DRV_MasterSendDataBlocking directly, right?

Thanks.

BR,

Sean Wu

0 Kudos
Reply

724 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @seanwu,

This should be enough to restore the S32K1xx I2C Master.

But it can be BUSY because the bus is held low by the Slave device.

Refer to UM10204 I2C-bus specification and user manual

Section 3.1.16 Bus clear

https://assets.nexperia.com/documents/user-manual/UM10204.pdf

 

SW for reference:

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

tI2C_fault I2C_Restore()

 

Regards,

Daniel

 

0 Kudos
Reply

797 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @seanwu,

What version of the drivers do you use?

 

Thank you,

BR, Daniel

0 Kudos
Reply