Initialization Issues

Is your Network Application Compiling?

File Missing Errors

If your compiler return missing file error, refer to section Building and Running the Sample Application to include all µC/TCP-IP stack necessary files to your project and also files from the prerequisite modules. You will also need to add the corresponding paths to your C compiler settings. 

Configuration Errors

If you encounter a compiler error of the type 'not #define'd in ...' or 'NET_CFG_XXX MUST be set to ...', you have a missing configuration macro or one that is not defined correctly (See section Network Stack Configuration).

Memory Errors

If your compiler returns a memory related error, verify that your MCU memory map is adequate, that your MCU as enough ROM to support the addition of the µC/TCP-IP stack code and also that you have enough RAM to run your Network application. µC/TCP-IP stack can be much RAM-costly depending on the number network buffers your application needs, the number of network interface you have to configured, the network tasks' stack size you configured, etc.

Refer to section LIB Memory Heap Configuration for more  details on memory heap allocation necessary for µC/TCP-IP stack. 

Refer to section Network Tasks Configuration for more details on the required network tasks configuration.

Port Errors

 

Is the µC/TCP-IP Stack Initialized Successfully?

RTOS working properly

µC/TCP-IP stack is made to run over a RTOS. Before adding the TCP/IP stack to your project, be sure that your project has correctly initialized the OS, created a starting task and started the OS. 

If your OS doesn't tick, the issue is probably with your BSP.

Initialization of prerequisite modules

Your Board Support Package module must be initialize prior to the TCP/IP stack. Refer to function BSP_Init() in your BSP files for more details.

The CPU and Memory modules must also be initialize before the TCP/IP stack. Refer to functions CPU_Init() and Mem_Init() for more details. 

Calling Net_Init() Function

  1. If the target crashes after calling Net_Init , your start task stack size is probably insufficient and must be increase.
  2. If the function exits with an error, the problem could be related to the OS configuration or OS objects initialization or Memory configuration (Heap size). The error code return should help you narrowed down the issue. Refer also to section Network Tasks Configuration for more details on the network tasks configuration.

Calling NetIF_Add() Function

If the function doesn't return

  1. Verify that your driver Base Address is correct (see section Network Interface Configuration).
  2. Could also be a problem with your BSP Clock or GPIO configuration (see section Network Board Support Package).

If the target crashes before returning

  1. Verify that your driver Base Address is correct (the target should crash in NetDev_Init()if the Base Address is incorrect).
  2. Could be a problem in your BSP (the target should crash in NetDev_Init() after a BSP call).
  3. Your start task stack size could be insufficient.

If the function returns an error

Memory related error

Queue size related error

Driver Configuration error

Driver Initialization error

PHY Invalid Configuration error

PHY Initialization error

  • If the stack is not able to read and write PHY register, the BSP GPIO configuration must be incorrect (see section Network Board Support Package). 
  • Bad PHY driver.

Other error

  • Refer to net_err.h for the error code details.

Calling NetIF_Start() Function

If the function returns an error

  • Refer to net_err.h for the error code details.

If the target crashes before returning

  • Is the BSP ISR Handler reached? If the ISR Handler crashes before completed: Y our ISR handler could perform an invalid operation.  You have a CPU, Compiler or Linker configuration issue. Check interrupt vector table location and interrupt configuration.

Is Net_DevRx() reached?

  • If reached : Increase the Rx Task stack size.
  • If not reached : There is an issue with the OS task switch. 

Does it crash when a context switch occurs?

Adding a Static Address to the Configured Interface

  1. Make sure that the IP address is not used by another host on the network by pinging the address before power up the target.
  2. Make sure that the MAC address you configured in your device configuration is not used by another device on the network.
    1. You can use the folloing command on window command line to show the ARP cache: "arp -a"
  3. If function NetIPv4_CfgAddrAdd or NetIPv6_CfgAddrAdd returned an error refer to the error code and net_err.h for more details on the error type.

Are you able to ping your board?

Once the TCP/IP initialization is done and returned without error, a good first test is to ping your board to validate that the TCP/IP stack is working correctly.

If your target answer back to the ping request, you are ready to add your network application to your project.

In the case that your board does not answer back to ping requests:

  1. Be sure that your network setup is correct: The PC used to ping and the target board must be on the same network.
  2. Make sure that the ARP request (or NDP in case of IPv6) sent prior to the ICMP echo request is sent out by the PC. Since there is a timeout on the ARP cache, if your PC sends a ARP request that fails to be answered, the PC will assume, for the duration of this timeout, that the remote host is unreachable. Therefore, if you send a ping request to that host during that time, the PC will not send anything and return a fail status. In short, be sure that an ARP (or NDP) request is sent prior to the echo request. Wireshark is a good tool to visually the network traffic on an interface.
  3. Is the BSP ISR Handler reached?
    1. In the case it's not reached, there is an issue with your CPU/BSP interrupt configuration.
  4. Is NetDev_Rx() reached?
    1. In the case the function is not reached:
      1. and the target crashed, try to increase the Rx Task stack size.
      2. be sure that no task blocks other tasks to run. It could be a OS task switching issue.
    2. In the case the target crashes before reaching NetDev_Tx():
      1. Increase the Rx task stack size.
      2. Or it maybe an OS task switching issue.
    3. In the case that NetDev_Tx() is not reached but the device does not crashed:
      1. the ARP packet could be discarded because of corruption.
  5. If NetDev_Tx() reached:
    1. Make sure the data contained in the buffer is not corrupted.
    2. Make sure the data is sent out from the target. If not, it's probably a issue with the network driver.
    3. Make sure NetIF_DevTxRdySignal() and NetIF_TxDeallocTaskPost() functions are reached.
    4. If you get errors in the driver for Rx or Tx regarding overflow or underflow, verify your BSP clock configuration.