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