How to use LPI2C peripheral with DMA without enabling any interrupts?

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

How to use LPI2C peripheral with DMA without enabling any interrupts?

301 Views
rkhw
Contributor I

Hello,

I am working with an NXP S32K396 MCU and would like to perform an LPI2C master transaction using eDMA without enabling any interrupts. In my project, I am using the LPI2C1 peripheral.

I can successfully perform LPI2C read and write transactions using DMA when the following interrupts are enabled:

  • LPI2C1_IRQn
  • eDMA0_DMATTCD_CH16_CH17_IRQn

rkhw_0-1783969062532.pngrkhw_0-1783969062532.png

However, it appears that the RTD LPI2C DMA implementation depends on these interrupts.

In Lpi2c_Ip_MasterSendData(), the LPI2C master interrupts are always enabled by the driver:

rkhw_1-1783969133234.pngrkhw_1-1783969133234.png

In addition, the DMA TCDs configured for TX and RX by Lpi2c_Ip_MasterTxDmaConfig() and Lpi2c_Ip_MasterRxDmaConfig() always enable the DMA major-loop completion interrupt:

Lpi2c_DmaTransferList[9u].Param = DMA_IP_CH_SET_CONTROL_EN_MAJOR_INTERRUPT;

Lpi2c_DmaTransferList[9u].Value = 1U;

 

I also noticed that in other function - Lpi2c_Ip_MasterSendDataBlocking() does not appear to configure a DMA TCD for the LPI2C transfer.

I would like to perform the complete LPI2C transmit and receive transaction using DMA while keeping LPI2C1_IRQn disabled and the eDMA channel interrupt disabled.
 
If possible, could NXP provide an example for LPI2C master TX/RX using DMA with both LPI2C and DMA interrupts disabled?
 

MCU: NXPS32K396

RTD: 6.0.0

NXP Studio: 3.6.1

 

Any help would be greatly appreciated. Thanks a lot in advance!

If needed, I can attach my project.

0 Kudos
Reply
1 Reply

264 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@rkhw

From the current driver implementation, the “Lpi2c_Ip_MasterSendData()” depend on both LPI2C master interrupts and DMA major-loop completion interrupts for transfer completion and state handling.

Therefore, you cannot enable DMA without enabling interrupts. The RTD driver does not support this usage.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2394522%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20use%20LPI2C%20peripheral%20with%20DMA%20without%20enabling%20any%20interrupts%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2394522%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI%20am%20working%20with%20an%20%3CSTRONG%3ENXP%20S32K396%20MCU%3C%2FSTRONG%3E%20and%20would%20like%20to%20perform%20an%20%3CSTRONG%3ELPI2C%20master%20transaction%20using%20eDMA%20without%20enabling%20any%20interrupts%3C%2FSTRONG%3E.%20In%20my%20project%2C%20I%20am%20using%20the%20%3CSTRONG%3ELPI2C1%20peripheral%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EI%20can%20successfully%20perform%20LPI2C%20read%20and%20write%20transactions%20using%20DMA%20when%20the%20following%20interrupts%20are%20enabled%3A%3C%2FP%3E%3CUL%3E%3CLI%3ELPI2C1_IRQn%3C%2FLI%3E%3CLI%3EeDMA0_DMATTCD_CH16_CH17_IRQn%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22rkhw_0-1783969062532.png%22%20style%3D%22width%3A%20491px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22rkhw_0-1783969062532.png%22%20style%3D%22width%3A%20491px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F392138iD77113A80A12FAF4%2Fimage-dimensions%2F491x64%3Fv%3Dv2%22%20width%3D%22491%22%20height%3D%2264%22%20role%3D%22button%22%20title%3D%22rkhw_0-1783969062532.png%22%20alt%3D%22rkhw_0-1783969062532.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Erkhw_0-1783969062532.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FDIV%3E%3CDIV%3EHowever%2C%20it%20appears%20that%20the%20RTD%20LPI2C%20DMA%20implementation%20depends%20on%20these%20interrupts.%3C%2FDIV%3E%3CP%3EIn%20Lpi2c_Ip_MasterSendData()%2C%20the%20LPI2C%20master%20interrupts%20are%20always%20enabled%20by%20the%20driver%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22rkhw_1-1783969133234.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22rkhw_1-1783969133234.png%22%20style%3D%22width%3A%20934px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F392139i427576FF0CD61F27%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22rkhw_1-1783969133234.png%22%20alt%3D%22rkhw_1-1783969133234.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Erkhw_1-1783969133234.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EIn%20addition%2C%20the%20DMA%20TCDs%20configured%20for%20TX%20and%20RX%20by%20Lpi2c_Ip_MasterTxDmaConfig()%20and%20Lpi2c_Ip_MasterRxDmaConfig()%20always%20enable%20the%20DMA%20major-loop%20completion%20interrupt%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3ELpi2c_DmaTransferList%5B9u%5D.%3C%2FSPAN%3E%3CSPAN%3EParam%3C%2FSPAN%3E%3CSPAN%3E%20%3D%20%3C%2FSPAN%3E%3CSPAN%3EDMA_IP_CH_SET_CONTROL_EN_MAJOR_INTERRUPT%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ELpi2c_DmaTransferList%5B9u%5D.%3C%2FSPAN%3E%3CSPAN%3EValue%3C%2FSPAN%3E%3CSPAN%3E%20%3D%201U%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CP%3EI%20also%20noticed%20that%20in%20other%20function%20-%20Lpi2c_Ip_MasterSendDataBlocking()%20does%20not%20appear%20to%20configure%20a%20DMA%20TCD%20for%20the%20LPI2C%20transfer.%3C%2FP%3E%3CDIV%3EI%20would%20like%20to%20perform%20the%20complete%20LPI2C%20transmit%20and%20receive%20transaction%20using%20DMA%20while%20keeping%20LPI2C1_IRQn%20disabled%20and%20the%20eDMA%20channel%20interrupt%20disabled.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3EIf%20possible%2C%20could%20NXP%20provide%20an%20example%20for%20%3CSTRONG%3ELPI2C%20master%20TX%2FRX%20using%20DMA%20with%20both%20LPI2C%20and%20DMA%20interrupts%20disabled%3C%2FSTRONG%3E%3F%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3EMCU%3A%20NXPS32K396%3C%2FP%3E%3CP%3ERTD%3A%206.0.0%3C%2FP%3E%3CP%3ENXP%20Studio%3A%203.6.1%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3EAny%20help%20would%20be%20greatly%20appreciated.%20Thanks%20a%20lot%20in%20advance!%3C%2FP%3E%3CP%3EIf%20needed%2C%20I%20can%20attach%20my%20project.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2394591%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20How%20to%20use%20LPI2C%20peripheral%20with%20DMA%20without%20enabling%20any%20interrupts%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2394591%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%40%3CSPAN%3Erkhw%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFrom%20the%20current%20driver%20implementation%2C%20the%20%E2%80%9CLpi2c_Ip_MasterSendData()%E2%80%9D%20depend%20on%20both%20LPI2C%20master%20interrupts%20and%20DMA%20major-loop%20completion%20interrupts%20for%20transfer%20completion%20and%20state%20handling.%3C%2FP%3E%0A%3CP%3ETherefore%2C%20you%20cannot%20enable%20DMA%20without%20enabling%20interrupts.%20The%20RTD%20driver%20does%20not%20support%20this%20usage.%3C%2FP%3E%3C%2FLINGO-BODY%3E