S32K312 RTD 5.0.0 LPI2C & FlexIO I2C Using DMA

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K312 RTD 5.0.0 LPI2C & FlexIO I2C Using DMA

540 次查看
acnhyxgxl1
Contributor II

Dear NXP Experts:

My current project requires I2C and using DMA. However, I refernced this article and tried to copy the configuration to RTD 5.0.0 HF01 and it didn't work out.

Hardware setting:

MCU: S32K312-Q172 EVB

External I2C master: FT4222(I2C master, 900KHz)

Pull-up resistor: 4.7 KOhm

Software setting:

SDK: RTD 5.0.0 HF01

Configuration:

Clock: FIRC 48 MHz

Objective Target:

(1) One FlexIO I2C master(using DMA) baudrate: 400 KHz

(2) One LPI2C master(using DMA) baudrate: 400 KHz

(3) One LPI2C slave in fast mode(cater to 900Khz)

1. I config DMA module in S32DS IDE, but some files, such as Dma_Ip_Types.h is not generated and some file content doesn't match my setting.(See below figure)

acnhyxgxl1_0-1757689399716.png

 

acnhyxgxl1_1-1757689419828.png

 

2. I copy the missing file from the example code and compile my project, nevertheless, my logic analyzer shows that no I2C signal was sent, despite `I2c_GetStatus` returns SUCCESS_STATUS`.

 

3. Is there any recommend setting about I2c_RequestType when doing a sending or receiving tasks?

My configuration is attached, please take a look and give me some guidance.

 

标记 (5)
0 项奖励
回复
4 回复数

521 次查看
VaneB
NXP TechSupport
NXP TechSupport

Hi @acnhyxgxl1 

First, it is important to mention that we do not recommend combining IP drivers with MCAL drivers, as IP drivers are not AUTOSAR-compliant. If you are using IP drivers, MCAL drivers should only be used for specific dependencies, such as DMA configurations.

Also, please note that modifying the RTDs falls outside our support scope. Instead of copying and editing the source code directly, we kindly ask you to share the steps you followed and include screenshots or images showing the situation before the issue occurred. This will help us better analyze the cause of the missing components.

Lastly, we recommend referring to the I2C example codes included with the RTDs. You can find them under the following names:

  • I2c_Example_S32K358 – for MCAL drivers
  • I2c_Ip_Example_S32K358 – for IP drivers

Additionally, I recommend reviewing the S32K3_S32M27x I2C Driver Integration Manual and the User Manual included with the RTDs. These documents provide detailed information about the driver, including its limitations, hardware and software requirements, usage instructions, and configuration guidelines.

You can typically find these documents at the following location: C:\NXP\S32DS.3.6.2\S32DS\software\PlatformSDK_S32K3\RTD\I2c_TS_T40D34M60I0R0\doc

 

BR, VaneB

0 项奖励
回复

468 次查看
acnhyxgxl1
Contributor II

Thanks for the instant reply @VaneB !

I modified my code and use MCAL driver for clear presentation(except UART_Ip for console debugging)

Before switch to DMA, I've verified my pin config and setting work normally in I2C interrupt mode.

Hardware:

MCU:  S32K312EVB-Q172 

Pull-up resistor: 4.7 KOhm

Software setting:

SDK: RTD 5.0.0 HF01

Configuration:

Clock: FIRC 48 MHz

I2C Objective Goal: (Simplified this time)

1. Channel 0: LPI2C slave using DMA

2. Channel 1: I2C master using DMA with baudrate: 200 KHz

 

I think RTD 5.0.0 might has some code generating issues, here's my step-by-step setting

Step0: Here's my original Peripheral config.(Only timer, interrupt, port, i2c and UART for debugging). This part works fine before switching to DMA mode. I didn't change I2C Asynchronous Method to USING_DMA just to verify my config has no other issue.

acnhyxgxl1_0-1757928095490.png

Step1: Add DMA and RM modules.

acnhyxgxl1_1-1757928138584.png

Step2: Setup DMA module by enable DMA support

acnhyxgxl1_2-1757928194789.png

Step3: Add 4 DMA logic channels(as this article, using HW CH0, 1 and CH 6, 7)

acnhyxgxl1_3-1757928314798.png

Step4: Add IRQ to platform module

acnhyxgxl1_4-1757928358221.png

Step5: Enable dma mux in RM module(resource manager CDD)

acnhyxgxl1_5-1757928430978.png

Step6: Add 4  Dma_Mux_Module_Config(as RTD 3.0.0 example code)

acnhyxgxl1_6-1757928479481.png

Step7: GUI shows no error in Step1~6

acnhyxgxl1_7-1757928519455.png

Step8: Code generation and code compile. Sadly error orruces

acnhyxgxl1_8-1757928591942.png

Here's the side-by-side comparison between the generated code of RTD 3.0 and 5.0

In Dma_Ip_Cfg.h

acnhyxgxl1_9-1757928657710.png

In Dma_Ip_Cfg.c

acnhyxgxl1_10-1757928689288.png

 

Please kindly point out the mistake in my configuration. Generated code is attached.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0 项奖励
回复

462 次查看
acnhyxgxl1
Contributor II

Allow me to correct myself.

I forgot to setup the Mcl module, missing config shows up after proper configuration.

Missing Step: Enable DMA support and config dma logic channel in Mcl module.

acnhyxgxl1_0-1757941992194.png

However, issue still occure. I2C clock and data pulled low after transmit 2 bytes.

1. Set Lpi2c slave using DMA(as Manipulated Variable), Flexio I2c master still using interrupt(as Control Variable).

2. Send 8 bytes of data{0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00}

3. LA shows only write frame and 1st byte of data send, then both SDA & SCL pulled low.

acnhyxgxl1_1-1757942376870.png

 

Fixed code and LA file are attached. Please give me some direction about how to fix this.

BR

 

 

 

0 项奖励
回复

389 次查看
VaneB
NXP TechSupport
NXP TechSupport

Hi @acnhyxgxl1 

I have reviewed your current configurations and would like to share a few observations:

  • You have included both the Dma_Ip and Mcl drivers. Please note that the DMA configurations are already encapsulated within the Mcl driver, so the Dma_Ip driver can be removed to avoid redundancy. The same applies to Siul2_Port and Port. Only the Port driver is necessary.
  • The I2C is currently configured in Standard Mode, which supports up to 100 kbps. However, the FlexIO I2C is set with a baud rate of 500 kbps, which exceeds the standard mode limit. Please ensure both configurations are aligned.
  • You have enabled the LPI2C0_IRQn, but since I2C instance 0 is configured to use DMA, this interrupt is not required. Only the interrupts corresponding to the assigned DMA channels should be enabled.
0 项奖励
回复