Skip to content

stm32 network interface overhaul#1309

Draft
HTRamsey wants to merge 1 commit intoFreeRTOS:mainfrom
HTRamsey:fix/stm32-network-interface
Draft

stm32 network interface overhaul#1309
HTRamsey wants to merge 1 commit intoFreeRTOS:mainfrom
HTRamsey:fix/stm32-network-interface

Conversation

@HTRamsey
Copy link
Contributor

@HTRamsey HTRamsey commented Feb 8, 2026

Few fixes, update HAL drivers, implement rest of HAL

@HTRamsey
Copy link
Contributor Author

HTRamsey commented Feb 8, 2026

/bot run formatting

{
UBaseType_t uxIPv4EndPoints = 0U;
uint32_t ulIPv4Address = 0U;
const NetworkEndPoint_t * pxEndPoint;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const NetworkEndPoint_t * -> NetworkEndPoint_t * because

error: passing argument 2 of 'FreeRTOS_NextEndPoint' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
 2848 |                              pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint ) )

#define niEMAC_MAX_INTERFACE_NAMES 16U
#define niEMAC_TX_QUEUE_LENGTH ETH_TX_DESC_CNT
#define niEMAC_TX_BUFFERS_PER_DESC 2U
#define niEMAC_TX_MAX_BUFFER_FRAGMENTS ( ETH_TX_DESC_CNT * niEMAC_TX_BUFFERS_PER_DESC )

#define niEMAC_AUTO_NEGOTIATION ipconfigENABLE
Copy link
Contributor

@Mixaill Mixaill Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add #ifndef's for

  • niEMAC_AUTO_NEGOTIATION
  • niEMAC_USE_100MB
  • niEMAC_USE_FULL_DUPLEX,
  • niEMAC_AUTO_CROSS
  • niEMAC_CROSSED_LINK

( void ) HAL_ETHEx_SetL4FilterConfig( pxEthHandle, ETH_L4_FILTER_0, &xL4FilterConfig );
#if ipconfigIS_ENABLED( niEMAC_USE_ARP_OFFLOAD )
UBaseType_t uxIPv4EndpointCount = 0U;
const NetworkEndPoint_t * pxEndPoint;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const NetworkEndPoint_t * -> NetworkEndPoint_t * because

NetworkInterface.c:3038:67: error: passing argument 2 of 'FreeRTOS_NextEndPoint' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
 3038 |                  pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint ) )


#define niEMAC_TX_MUTEX_NAME "EMAC_TxMutex"
#define niEMAC_TX_DESC_SEM_NAME "EMAC_TxDescSem"
#define niEMAC_TX_QUEUE_NAME "EMAC_TxQueue"
#define niEMAC_MAX_INTERFACE_NAMES 16U
Copy link
Contributor

@Mixaill Mixaill Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

niEMAC_MAX_INTERFACE_NAMES Causes enourmous DTCMRAM usage, should configurable and reduced by default I think.

BTW, I'm not aware of any STM32 F/H series with more than one EMAC. Is it needed for VLANs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always got this print here

To fix I need to do something like

case eMacInitComplete:
            vForceRefreshPhyLinkStatus( pxPhyObject ); // new
            if( prvGetPhyLinkStatus( pxInterface ) != pdTRUE )

.....

static void vForceRefreshPhyLinkStatus( EthernetPhy_t * pxPhyObject )
{
    vTaskSetTimeOutState( &( pxPhyObject->xLinkStatusTimer ) );
    pxPhyObject->xLinkStatusRemaining = 0U;
    xPhyCheckLinkStatus( pxPhyObject, pdFALSE );
}

@HTRamsey
Copy link
Contributor Author

Yeah this is still in progress. Many of the changes were using xEMACData to support multiple interfaces, if we drop that then I can simplify this a fair bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants