Skip to main content
user 143
Associate III
September 14, 2017
Question

Issues with lwIP and debugging

  • September 14, 2017
  • 4 replies
  • 1679 views
Posted on September 14, 2017 at 14:34

Hello,

I need your help. I've got some troubles with lwIP and to find a solution for that I want to enable debugging in lwIP. 

I'm working with a STM3210C-EVAL board and with CubeMX. lwIP is working, I can send a ping and also see the webpage in fsdata. But now I want to enable debugging. I also configured UART2 with CubeMX and can send messages via HAL_UART_Transmit(). Then I redirect printf, so that messages are send via UART. This also workes fine. For this I added this lines to my main.c:

#ifdef __GNUC__

/* With GCC, small printf (option LD Linker->Libraries->Small printf

set to 'Yes') calls __io_putchar() */

#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)

#else

#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)

#endif /* __GNUC__ */

And after the main function:

PUTCHAR_PROTOTYPE {

HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF);

return ch;

}

And now I wanted to enable the debugging in lwIP. For this, I added the lines below in lwipopts.h:

#define LWIP_DEBUG 1

#define ICMP_DEBUG LWIP_DBG_ON

But there are no messages send when I ping or open the webserver. I tried another options, like IP_DEBUG or TCP_DEBUG, but there is no difference. 

Have anyone an idea where my mistake is?

Thank you

    This topic has been closed for replies.

    4 replies

    waclawek.jan
    Super User
    September 14, 2017
    Posted on September 14, 2017 at 15:19

    https://community.st.com/0D70X000006Sp7qSAC

     

    JW

    user 143
    user 143Author
    Associate III
    September 14, 2017
    Posted on September 14, 2017 at 17:31

    Thank you for your quick response.

    Where I have do add '#define LWIP_PLATFORM_DIAG(message)  output_print(message)'? I put it into the lwipopts.h, but it didn't work. 

    Thanks.

    user 143
    user 143Author
    Associate III
    September 18, 2017
    Posted on September 18, 2017 at 10:16

    Has anyone an other suggestion? 

    user 143
    user 143Author
    Associate III
    September 19, 2017
    Posted on September 19, 2017 at 10:37

    I found my mistake. 

    In my lwipopts.h was this line:

    #define LWIP_DBG_TYPES_ON LWIP_DBG_OFF

    With changing it to #define LWIP_DBG_TYPES_ON LWIP_DBG_ON debuging works fine.