S32K344 RMII Debugging

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

S32K344 RMII Debugging

跳至解决方案
2,769 次查看
jay12
Contributor II

Hi,

 

I'm debugging an issue with the S32K344 on the RMII interface on a custom board.

The S32K344 is setup as the MAC and is connected to a switch port that is acting like a PHY.

The switch port is providing the 50MHz reference clock to the S32K344. 

 

There seems to be some kind of data corruption when the data goes through the MAC layer on the S32K3.

 

Probing the RMII lines on the board and using a logic analyzer, I'm able to reconstruct a valid ARP packet coming out of the switch and into the S32K344. However, the data the S32K344 the data seems to receive is invalid. Since the data on the wire is okay, I'm thinking the corruption is either happening when the S32K344 is sampling the data or in the settings on the MAC.

 

On the S32K344 TX side of things the data that comes out on the wire is corrupted . 

 

If I turn off CRC checking on the switch, the corrupted packet can be seen via wireshark. If I turn off CRC checking on the S32K344, the corrupted packet is able to make it to the application. 

 

We used a similar code setup on the MR-CANHUBK344 and were successful.

 

Any help or knobs to turn on the S32K344 side would be appreciated!

 

Thank you!

标记 (2)
1 解答
2,724 次查看
Siyan
Contributor III
I have solved a similar problem by reconfiguring the MCU clock after the switch clock can be provided stably to the S32K. Maybe you should try on your side and see if it works.

在原帖中查看解决方案

16 回复数
2,213 次查看
jay12
Contributor II

We were able to determine that we were splitting the GPIO initialization up into two parts. First, initialize everything related to the FS26 and kick/feed the watchdog for the initial 256ms window. This would happen before the external RMII clock was provided which caused the issue.

 

So it ended up being a simple bug on our end.

 

Thanks everyone for the support on this!

0 项奖励
回复
2,732 次查看
jay12
Contributor II

Thanks for the link.

For pin mapping we did:

PTC0: RXD0

PTC1: RXD1

PTC2: TXD0

PTD7: TXD1

PTC14: RX_ER

PTC15: RX_DV

PTD11: TX_CLK

PTD12: TX_EN

 

When the S32K3 sends out an ARP, the data on the wire is odd. Here is a scope screenshot of what the beginning of the ethernet frame looks like (preamble, SFD, destination MAC):

jay12_0-1710820256902.png

 

Channel 1: TXD0

Channel 2: TXD1

 

The destination MAC address is supposed to be FF:FF:FF:FF:FF:FF as it's a broadcast. However, looking at the wire we see: FD:FF:FF:FF:FF:FF.

Is there a way to look at the ethernet frame before it's transmitted by the MAC? Could there be something weird happening with DMA with the descriptors? Any advice on debugging this would be appreciated. 

Thank you,

Jay Fetter

 

0 项奖励
回复
2,725 次查看
Siyan
Contributor III
I have solved a similar problem by reconfiguring the MCU clock after the switch clock can be provided stably to the S32K. Maybe you should try on your side and see if it works.
2,702 次查看
jay12
Contributor II

I tried adding a long delay between the switch initialization and the Clock_Ip_Init function call and I'm still seeing this issue.

 

Some more example packets:

jay12_0-1710878877995.pngjay12_1-1710878898076.png

 

2,642 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

try to increase slew rate/drive strength for TX signals in Pins tool as well.

BR, Petr

0 项奖励
回复
2,635 次查看
jay12
Contributor II

Tried that as well.

 

Is there any way to view the transmit queue in the MAC layer? Any way to observe what is getting pushed out the wire?

 

I was looking at the MTL registers and trying to figure out how to use the debug register (C08h, MTL_DBG_CTL), but was a bit confused.

0 项奖励
回复
2,594 次查看
jay12
Contributor II

Comparing the pins between the T-Box and our board:

 

FunctionOur BoardT-Box
RXD0PTC0PTC0
RXD1PTC1PTC1
RX_ERPTC14PTC14
RX_DVPTC15PTC17
TXD0PTC2PTC2
TXD1PTD7PTD7
TX_ENPTD12PTD12
TX_CLKPTD11PTD11

 

Only difference is RX_DV. Looking at the pinmux, both PTC15 and PTC17 can be: EMAC_MII_RMII_RX_DV. 

 

Have there been any software driver updates in recent months that could affect the EMAC?

0 项奖励
回复
2,515 次查看
Daniel_Wax
NXP Employee
NXP Employee

post the studio project that sets up the ethernet

0 项奖励
回复
2,478 次查看
jay12
Contributor II

I'll have to check per company policy on sharing source code. 

 

What files would be most important to look at since individual files may be easier?

 

0 项奖励
回复
2,404 次查看
Daniel_Wax
NXP Employee
NXP Employee

The ethernet interface setup and init may be useful

 

Ill check out the ref manual for TX packet content.  I dont think there is a feature like that.  BTW have you checked out loopback just to see if thats clean?  So you want to see TX for loopback verification?

标记 (1)
0 项奖励
回复
2,392 次查看
jay12
Contributor II

Uploaded project to a private case.

 

I don't think you can do internal loopback in RMII mode. We did an experiment where we allowed to switch to route packets sent on the S32K3's port back to itself (i.e. S32K3 -> Switch Port X -> S32K3) and the data was still malformed.

What would be the lowest memory layer that we could observe the packet? Would it be in the Gmac_Ip_SendFrame function? I'm just confused on how to explain the behavior we're seeing.

There is a difference in the S32K3 package between the MR-CANHUB (QFP) and our board (BGA).

 

0 项奖励
回复
2,372 次查看
Daniel_Wax
NXP Employee
NXP Employee

I was looking at our eval board where we connect to one of our phys that supplies the clock for RX and even though its an external clock we still setup the RX clock to be enabled in the clock setup.

 

You project does not enable this RX clock.  maybe you can try that?

 

Daniel_Wax_0-1711492164569.png

 

0 项奖励
回复
2,390 次查看
Daniel_Wax
NXP Employee
NXP Employee

Im not sure where this private case is located.  

I found it in nxp.support.com.  Ill start looking at it.  So with the project you uploaded the same corruption happens?

I was talking about this loopback

Daniel_Wax_0-1711490906766.png

I now see we also call EMAC GMAC from the driver setup standpoint

GMAC registers are not applicable ... only EMAC  100Mbit only  no Gigabit

There are some registers that may be useful.  I See others as well

Daniel_Wax_0-1711472322622.png

 

Package pinout differences are indicated in the ref manual.  Its the same die if both part numbers are S32K344

 

@JD_Wilson 

0 项奖励
回复
2,330 次查看
jay12
Contributor II

Some updates, we are definitely seeing extra nibbles in our RMII TX data. 

However, even with the data on the wire being corrupted, we sometimes see a CRC that would match the packet that was intended to be sent out. Which would imply to me that the correct packet is reaching that MAC.

 

Here is a graph showing the extra clock cycles we see based on the packet size. 

For example, for a 60Byte ARP packet, we are expecting to see 72Bytes on the wire (7B Preamble + 1B SFD + 4B CRC). 72Bytes * 20ns/(di-bit) * 4 (di-bit) / Byte = 5760ns.

However, when we measure on the wire we see 5980 ns for the frame. This was measured using the DV signal.

jay12_0-1711655221745.png

 

 

We've tried looking at the registers, comparing the clocks, power supplies, not sure how to explain the extra nibbles.

The full label on the chip we are using:
S32K344HMS 1P55A CTAK2228V

0 项奖励
回复
2,316 次查看
jay12
Contributor II

Looking a bit more into the extra clock cycles, if I take the measured packet transmit time and back-calculate what an expected clock frequency for it would be I get a clock frequency of:
48.25 +/- 0.045MHz.

 

The clock I'm providing for EMAC_RMII_TX_REF is a solid 50MHz so I'm wondering if it could be something in the clock configuration?

 

This could be grasping at straws here, but we're getting desperate.

0 项奖励
回复
2,748 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

maybe you can referr to S32K3-T-BOX board (https://www.nxp.com/design/design-center/designs/s32k3-automotive-telematics-box-t-box-reference-des...), which has SJA1110 connected to S32K3 using RMII as well. You can check its schematic and available example projects.

BR, Petr

0 项奖励
回复