Forum Discussion
Cyclone 10 GX Nios V Ethernet Ping Issue - UC/TCP-IP Error 20012 and TSE/mSGDMA Debugging ;
Hello,
Thank you for the detailed debug notes. The MDIO/PHY ID reads and the OSSemCreate failure inside NetSock_Init() are especially useful.
Root cause of error 20012
NET_SOCK_ERR_INIT_CONN_REQ_FAULT (20012) occurs when socket-layer initialization cannot create the connection-request semaphore(s). In uC/OS-II, OSSemCreate() returns NULL when the free event list is empty. Semaphores, mutexes, mailboxes, and message queues all consume entries from the same OS_EVENT pool, which is sized by OS_MAX_EVENTS.
The failure of the 8th OSSemCreate(0u) inside NetSock_Init() typically means earlier initialization (RTOS, Net_*_Init, drivers, and application tasks) has already used most of the 60 events, so there are not enough left for the socket layer. This does not indicate a problem with the recommended Micrium source files.
OS_LOWEST_PRIO = 80 only affects the task priority range. It does not size the event pool.
Recommended fix
In os_cfg.h, increase OS_MAX_EVENTS. Try 120 or 160 first. Some full Micrium plus application setups need more.
Rebuild and confirm NetSock_Init(&err) returns success (err == NET_SOCK_ERR_NONE).
Optionally measure peak usage by logging remaining free events before and after each major initialization step, then set OS_MAX_EVENTS with some headroom.
Also confirm that other Micrium/OS limits still match your net_cfg.h settings (socket count, connection count, buffers). The immediate blocker matches event-pool exhaustion.
About Ethernet / ping
Your MDIO success (PCS plus Marvell PHY ID 0x0141 / 0x0CC2) and TSE CSR access are good signs that PHY and MAC access are working. Until the stack finishes initialization, ping will not work regardless of DMA health. Please fix OS_MAX_EVENTS first, then validate the packet path.
After stack initialization succeeds - independent TX/RX checks before full TCP/IP
1. Link: confirm SGMII / PHY link-up, and that TSE COMMAND_CONFIG has TX/RX enabled with the correct MAC address.
2. TX-only: build one TX descriptor pointing at a known Ethernet frame in memory, submit it via TX mSGDMA and the prefetcher, check DMA status/completion with no error bits, and capture the frame on the wire.
3. RX-only: arm RX descriptors to free buffers, send a unicast or broadcast frame to the board MAC from the PC, and confirm descriptor ownership flips and the buffer contents match.
Only then reconnect the Micrium interface / TSE + mSGDMA driver and retest ping to 10.0.0.2.
If you can share your os_cfg.h values (OS_MAX_EVENTS, OS_MAX_TASKS, mutex/queue enables) and your net_cfg.h socket/connection counts after the OS_MAX_EVENTS change, we can help size the remaining Micrium resources and review the mSGDMA descriptor layout next.
Thanks
JL