S32K388 GMAC0 Eth_43_GMAC driver transmitting help Hi, I'm using the following configuration: S32K388EVB-Q289 S32DS 3.6.8 RTD 7.0.1 As mentioned in a previous post, S32K388 GMAC0 Eth_43_GMAC driver not getting RX interrupt . I used the provided Eth_InternalLoopback_S32K388 example project as base, and modified it so that it can receive frames from my PC through a media converter. Now I'm trying to get the other way going, i.e. transmitting an ethernet frame from S32K388 eval board back to my PC. I am running wireshark on my PC to capture the frame. The frame that I'm trying to send is a broadcast frame with MAC address FF:FF:FF:FF:FF:FF. However, I was only able to get 1 frame on my PC in multiple tries, i.e. it is not consistent. @PavelL, can you kindly help again with this issue? Thanks. Re: S32K388 GMAC0 Eth_43_GMAC driver transmitting help Hello @James_Zhang_SE ,
I reviewed your project and found only a few minor configuration differences, none of which appear to affect Ethernet transmission.
Could you please clarify what you mean by receiving only one frame in multiple tries? For example, do you observe one frame after each complete power cycle of the board or only occasionally after several power cycles or debug sessions? Also, are you running the application continuously in the debugger or restarting it before each transmission attempt?
The application calls Eth_43_GMAC_Transmit() only once and then enters the infinite while (1) loop. Therefore, only one transmitted frame is expected per application run.
The inconsistent behavior may be caused by the Ethernet PHY link not being established when the transmission is requested. The frame is transmitted immediately after the GMAC controller is set to active mode, without checking the PHY link status. If the TJA1120 link is not yet up, the only transmitted frame may be lost.
Please try waiting until the PHY reports link-up before calling Eth_43_GMAC_ProvideTxBuffer() and Eth_43_GMAC_Transmit(). An example of reading the TJA1120 link status can be found in device.c, using bool get_device_link_status(uint8_t u8TrcvIdx);
This function is used by the S32K388_gptp_ds example included in SW32K3xx_M7_gPTP_1.1.0_CD01_D2602_DesignStudio_updatesite.zip, which is suitable for S32K3 RTD 7.0.1.
As a simple initial test, you can also add a sufficiently long delay before the transmission. If this makes the frame appear consistently, it would confirm that the issue is related to PHY link establishment.
Best regards,
Pavel Re: S32K388 GMAC0 Eth_43_GMAC driver transmitting help Hi Pavel, Thank you for the prompt response! I tried a couple of things today: I tested the same hardware setup using the TCP/IP stack example. With that example, everything works properly, and I am able to receive echo responses on my PC from the S32K388 evaluation board. In my application, I placed a breakpoint immediately after: Eth_43_GMAC_SetControllerMode(EthConf_EthCtrlConfig_EthCtrlConfig_0, ETH_MODE_ACTIVE); After reaching the breakpoint, I waited for a while and then manually continued with Eth_43_GMAC_ProvideTxBuffer(). Unfortunately, I still did not receive any transmitted frame on the PC side. Regarding the behavior I described previously, each time I test the application I power-cycle both the media converter and the evaluation board. I then use the embedded debugger to load the application and start execution. So far, I have observed two successful transmissions, but I have not been able to determine what was different in those two cases or why the frames were transmitted successfully. All of my other attempts, including the tests I performed today, have been unsuccessful. I really appreciate your help with this issue so far. I’m still trying to understand what might be causing this behavior, and I would greatly appreciate any further guidance or suggestions you may have. Re: S32K388 GMAC0 Eth_43_GMAC driver transmitting help Hello @James_Zhang_SE ,
Thank you for the detailed update. The fact that the TCP/IP stack example works correctly with the same hardware setup confirms that the basic hardware path, GMAC interface and Ethernet link are operational.
I modified the main.c file of my internal loopback example to wait explicitly for link-up before transmitting the frame. I tested this implementation on my S32K388EVB-Q289 and after every power-up I can consistently see the transmitted frame in Wireshark.
I also tested the following sequence:
Disconnect the cable between GMAC0 and the media converter.
Power up the S32K388 evaluation board and start the application.
Reconnect the cable to the media converter.
After reconnecting the cable, the application detects the link and the transmitted frame appears in Wireshark as expected.
My hardware setup is:
S32K388EVB-Q289 GMAC0 ↔ TE-1402 media converter configured for 1 Gbit/s and Follower mode ↔ USB-to-Ethernet adapter ↔ Dell laptop running Windows 11
I share my modified main.c, the corresponding .mex configuration file and mex_diff.html so that you can compare my configuration with yours more easily. Please replace the provided files as appropriate, run Update Code in S32 Design Studio and then rebuild the project before testing it.
There may still be a configuration detail in my .mex file that is important for reliable transmission. Therefore, I recommend first testing the shared configuration without further modifications. If it works on your setup, you may then use mex_diff.html to identify the relevant difference between the two configurations.
Best regards,
Pavel Re: S32K388 GMAC0 Eth_43_GMAC driver transmitting help Hello @James_Zhang_SE ,
Can you see frames in Wireshark with cable connected before board power-up?
I assume that hardware connection etc. is correct if lwIP example works on you board.
In your case, I would suspect the "receiver" side:
1. Check if Wireshark runs in promiscuous mode:
2. Use another device to capture frames, e.g. laptop with Linux. I use S32G-VNP-RDB2 with Linux BSP or Demo EthernetAnalyzer FRDM-A-S32K344 RTD 7.0.1 to capture frames when I'm in doubt with Wireshark on windows.
3. Set the DST MAC in your frame to MAC address of your ethernet adapter.
Best regards,
Pavel Re: S32K388 GMAC0 Eth_43_GMAC driver transmitting help Hi Pavel, Today I have tested with the files you have shared. I replaced both files as is and debugged using the same procedure that you have mentioned. i.e. Disconnect the cable between GMAC0 and the media converter. Power up the S32K388 evaluation board and start the application. Reconnect the cable to the media converter. However, I'm still not seeing any frames being captured in the Wireshark. For both previously and after replacing the files, I'm able to hit the breakpoint in EthIf_TxConfirmation(). Can you think of any other factor/possible cause/difference in setup that might impact the frame transmission? I really appreciate your help with this issue. Re: S32K388 GMAC0 Eth_43_GMAC driver transmitting help Hi Pavel, After quite a bit of troubleshooting, I was finally able to narrow down the issue, although I still haven't determined the exact cause. I tried using a USB-to-Ethernet adapter and captured the traffic directly on that Ethernet interface. With this setup, I can now see the broadcast frames transmitted by the S32K388 in Wireshark. This confirms that the S32K388 is transmitting the frames successfully. Thank you very much for all your help and suggestions throughout this troubleshooting process. I really appreciate your support.
記事全体を表示