FreeRTOS+TCP with no PHY

Hi,
we are using a RTOS+TCP V2.3.3 port for a STM32H7 which works very well so far. However due to the semiconductor shortage we could not assemble ethernet PHYs on our boards.
We lately started to use the ITCM with MPU protection, and debugging revealed that this lead to hard faults from the network stack side.
NULL was accessed from some descriptor fields here:

The HAL ETH Init failed, and did not set some pointers to their proper values. I’m wondering why the return value of the HAL is ignored here:

Is there any way we can safely shut down the network stack? Are there any reasons xHalEthInitStatus is unused?

Thanks for your help!

Hello @Dweb_2,

I am not entirely sure why was the return ignored. However, you should be able to get around this problem by checking for errors. Thus, if you add the below edits here, then it should work.

@@ -234,6 +234,8 @@ BaseType_t xNetworkInterfaceInitialise( void )
        /* Only for inspection by debugger. */
        ( void ) xHalEthInitStatus;

+      if( xHalEthInitStatus == HAL_OK )
+      {
            /* Configuration for HAL_ETH_Transmit(_IT). */
            memset( &( xTxConfig ), 0, sizeof( ETH_TxPacketConfig ) );
            xTxConfig.Attributes = ETH_TX_PACKETS_FEATURES_CRCPAD;
@@ -299,6 +301,11 @@ BaseType_t xNetworkInterfaceInitialise( void )
            {
                xMacInitStatus = eMACFailed;
            }
        }
+       else
+       {
+          xMacInitStatus = eMACFailed;
+       }
    } /* ( xMacInitStatus == eMACInit ) */

Let me know if that works for you.

Thanks,
Aniruddha

1 Like

Hi,
thanks for your quick response! This snippet seems to have solved the issue.
Is there a chance this fix will be included in future versions of the STM32H7 port for FreeRTOS+TCP?
Many thanks, Aniruddha!

@kanherea do you think this would be possible?

Is there a chance this fix will be included in future versions of the STM32H7 port for FreeRTOS+TCP?

Sure that is possible. If you like, you can create a pull-request your self, in case we can help you with the details.

It is also possible that Aniruddha or I prepares a PR to change the driver.

Thanks

Thanks @htibosch for your quick response! Honestly I’m not really familiar with GitHub :slightly_smiling_face:

@Dweb_2, I finally created a PR for the above issue, see PR #465

I don’t the proper hardware at my present location, and I would be glad if you can do a test.

Thanks @htibosch. In the meantime we could assemble the missing PHY. I would need to de-solder the component to test it again.

I would need to de-solder the component to test it again.

Oops, please don’t. Just compile and run the application if you like, that would be fine. Thanks, Hein

Hi, sorry for reopening this. Could you check if the proposed changes from this thread (respectively this PR: IPv4/single: STM32H7xx driver check result of HAL_ETH_Init by AniruddhaKanhere · Pull Request #479 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub) are currently properly in the main branch/release? Looks to me like some commit in the past reverted it again (see my comment on github).

Hi @Dweb_2,
Thanks for reporting this to us. That commit seems got reverted by mistake.
Would you like to contribute a PR to fix it? Or I can raise PR to fix it.

Thanks!

1 Like

I will check what has happened to mentioned PR, and create a new PR for it.
Thanks for reporting

Hi @Dweb_2,
Note that PR#1035 has been created by @htibosch. It’s now under verifying. Feel free to leave your comment on it.

Thanks.

Edit: PR has been merged

1 Like

The problem got solved about a week ago in PR #1035: “STM32H7xx driver check result of HAL_ETH_Init v3”.