Skip to main content
Visitor II
April 30, 2019
Solved

STM32F439ZI + Eth + LwIP; no ping response

  • April 30, 2019
  • 5 replies
  • 8147 views

Hello,

i have a Nucleo-144 board, where i replaced the STM32F429ZI for a STM32F439ZI.

I used CubeMX 5.2.0 to create a ethernet test project just to ping the board and go further from there, but i cant get it to work.

Ethernet is enabled

0690X000008B5dmQAC.png

Ethernet interrupt is enabled.

The parameter settings:

0690X000008B5euQAC.pngAnd the advanced parameter settings:

0690X000008B5f4QAC.png

The clock configuration:

0690X000008B5fOQAS.png

LwIP is enabled, general settings (Ive tested with bot static and dynamic IP, both wont work):

0690X000008B5fiQAC.png

I left most of the LwIP options at standart, except i set

LWIP_BROADCAST_PING (Respond to Broadcast Pings) Enabled

LWIP_MULTICAST_PING (Respond to Multicast Pings) Enabled

Also CHECKSUM_BY_HARDWARE is enabled, as well as all the CHEKSUM_GEN_*** and CHECKSUM_CHECK_***

Ive build the source code with Minimum Heap Size 0x2000 and Minimum Stack Size 0x4000.

In Atollic TrueSTUDIO 9.0.1 ive build the project, where i needed to copy fsdata.c to Middlewares/Third_Party/LwIP/src/apps/httpd/ and exclude it from build, so the file would build properly.

I added MX_LWIP_Process(); to the while(1) in main.c, compiled and flashed the board.

At this point i should be able to ping it already, but i get no response whatsoever.

It doesnt matter if i use a crossed or straight ethernet cable, connect it to the network or directly to the PC and if i give a static or dynamic IP, i cant ping the board at all.

Im in a dead end with this, i suspect that the F439ZI MCU on a F429ZI nucleo board wont work, but at this point i dont know what could be wrong. Any tipps/help would be appreciated.

    This topic has been closed for replies.
    Best answer by Vangelis Fortounas

    Hi

    you didn't mention that you called MX_LWIP_Init() before the while loop to initialize LWIP

    When use HTTPD , httpd_init(); must be called also.

    In LWIP-> "Debug" tab ->advanced options can activate some debug options to help solve the issue.

    You can retarget these messages to Atollic's SWV console or to a serial port .

    5 replies

    Visitor II
    May 1, 2019

    Hi

    you didn't mention that you called MX_LWIP_Init() before the while loop to initialize LWIP

    When use HTTPD , httpd_init(); must be called also.

    In LWIP-> "Debug" tab ->advanced options can activate some debug options to help solve the issue.

    You can retarget these messages to Atollic's SWV console or to a serial port .

    Visitor II
    May 3, 2019

    Hello and sorry for the late reply.

    The MX_LWIP_Init(); is automatically called in the CubeMX generated code:

    int main(void)
    {
     /* USER CODE BEGIN 1 */
     
     /* USER CODE END 1 */
     
     
     /* MCU Configuration--------------------------------------------------------*/
     
     /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
     HAL_Init();
     
     /* USER CODE BEGIN Init */
     
     /* USER CODE END Init */
     
     /* Configure the system clock */
     SystemClock_Config();
     
     /* USER CODE BEGIN SysInit */
     
     /* USER CODE END SysInit */
     
     /* Initialize all configured peripherals */
     MX_GPIO_Init();
     MX_LWIP_Init();
     /* USER CODE BEGIN 2 */
     
     /* USER CODE END 2 */
     
     /* Infinite loop */
     /* USER CODE BEGIN WHILE */
     while (1)
     {
    	 //Read a received packet from the Ethernet buffers and send it to the LwIP stack for handling
    	 MX_LWIP_Process();
     /* USER CODE END WHILE */
     
     /* USER CODE BEGIN 3 */
     }
     /* USER CODE END 3 */
    }

    Thanks for the hint with the debug options, going to check on that.

    EDIT: I deactivated the HTTPD and enabled LWIP_NETIF_LINK_CALLBACK and LWIP_NETIF_REMOVE_CALLBACK, after that the board responds to pings, now i can proceed.

    Thanks for the hint with httpd_init();

    I searched for that command, but in the whole project i could not find it, so i disabled it in CubeMX.

    Visitor II
    May 6, 2019

    Hi.

    httpd_cgi_handler(..) must be defined by the user.

    In general, when the user wants to install one or more CGI callbacks , must use http_set_cgi_handlers(CGI_arr, x);

    CGI_arr is an array of tCGI type, "x" is the number of handlers contained in the array

    Install one callback func like this "tCGI CGI_arr[1]={{"/config.cgi", usrCGIHandler}}; //usrCGIHandler is the user handler

    So you can call http_set_cgi_handlers(CGI_arr, 1); to install this handler.

    Visitor II
    May 6, 2019

    A "workaround" not to have this link error is to disable

    this "HTTP CGI NEW STYLE"

    Here are some data from LWIP site

    0690X000008BIrIQAW.jpg

    Visitor II
    May 6, 2019

    Thank you for the great help, i see now where i made my mistakes. Not the answer to the original question, but perfect answer to the followup.

    Thanks again.

    Visitor II
    October 15, 2020

    Hello,

    How did you solve this issue. I'm having a same problem  with httpd_cgi_handler();?

    Thank you!

    Visitor II
    January 5, 2021

    Hi,

    I'm facing the problem to connect the Ethernet to STM32F439ZT nucleo board.

    but i'm not able to connect it.i given all configuration

    like

    /* USER CODE END Header */

    /* Includes ------------------------------------------------------------------*/

    #include "main.h"

    #include "lwip.h"

    /* Private includes ----------------------------------------------------------*/

    /* USER CODE BEGIN Includes */

    #include "lwip/apps/httpd.h"

    /* USER CODE END Includes */

    /* Private typedef -----------------------------------------------------------*/

    /* USER CODE BEGIN PTD */

    /* USER CODE END PTD */

    /* Private define ------------------------------------------------------------*/

    /* USER CODE BEGIN PD */

    /* USER CODE END PD */

    /* Private macro -------------------------------------------------------------*/

    /* USER CODE BEGIN PM */

    /* USER CODE END PM */

    /* Private variables ---------------------------------------------------------*/

    UART_HandleTypeDef huart3;

    PCD_HandleTypeDef hpcd_USB_OTG_FS;

    /* USER CODE BEGIN PV */

    /* USER CODE END PV */

    /* Private function prototypes -----------------------------------------------*/

    void SystemClock_Config(void);

    static void MX_GPIO_Init(void);

    static void MX_USART3_UART_Init(void);

    static void MX_USB_OTG_FS_PCD_Init(void);

    /* USER CODE BEGIN PFP */

    /* USER CODE END PFP */

    /* Private user code ---------------------------------------------------------*/

    /* USER CODE BEGIN 0 */

    /* USER CODE END 0 */

    /**

     * @brief The application entry point.

     * @retval int

     */

    int main(void)

    {

     /* USER CODE BEGIN 1 */

     /* USER CODE END 1 */

     /* MCU Configuration--------------------------------------------------------*/

     /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

     HAL_Init();

     /* USER CODE BEGIN Init */

     /* USER CODE END Init */

     /* Configure the system clock */

     SystemClock_Config();

     /* USER CODE BEGIN SysInit */

     /* USER CODE END SysInit */

     /* Initialize all configured peripherals */

     MX_GPIO_Init();

     MX_USART3_UART_Init();

     MX_USB_OTG_FS_PCD_Init();

     MX_LWIP_Init();

     /* USER CODE BEGIN 2 */

     // initializing the HTTPd

     httpd_init();

     /* USER CODE END 2 */

     /* Infinite loop */

     /* USER CODE BEGIN WHILE */

     while (1)

     {

      /* USER CODE END WHILE */

      /* USER CODE BEGIN 3 */

     MX_LWIP_Process();

     }

     /* USER CODE END 3 */

    }

    /**

     * @brief System Clock Configuration

     * @retval None

     */

    can you please suggest any one.

    thank you.

    Visitor II
    January 8, 2021

    Hello

    The iformation you provide is not enough to understand the problem

    With this configuration, eth. cable must be connected to board before program start

    In case you use DHCP, try a delayed start of httpd_init(), not to conflict with DHCP transactions

    //##############################################################################

    void TimeoutHTTPDHandler(void*arg)

    {

      httpd_init();//init

    //   http_set_ssi_handler(SSI_Handler, TAGS, num_tags);//set callbacks for SSI array

    // http_set_cgi_handlers(CGI_TAB, 1);//set callbacks for CGI array

    }

    //##############################################################################

    in main.c file

    sys_timeout(4000, TimeoutHTTPDHandler, NULL);// for delayed start of HTTPD server