lpcware

lwip_tcpecho_freertos only works with debugger attached

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by TheDude on Wed Sep 03 06:39:54 MST 2014
I have a problem with the LPCOpen example lwip_tcpecho_freertos with the LPC1769-Controller. When I make a little change to the example, it only works within a debugging session.

The Setup

Hardware

LPCXpresso LPC1769 (Rev. B) attached on LPCXpresso BaseBoard (Rev. B)
USB2Serial-Converter is used for LWIP-Debugging messages.

Software
lpcopen_2_10_lpcxpresso_nxp_lpcxpresso_1769.zip within LPCXpresso v7.3.0
Imported projects:
[list]
  [*]lpc_board_nxp_lpcxpresso_1769
  [*]lpc_chip_175x_6x
  [*]lwip_tcpecho_freertos
[/list]
I have created the symbol LWIP_DEBUG and I have turned on the debugging Flags for ETHARP_DEBUG, PBUF_DEBUG and EMAC_DEBUG.
I have increased the size of the vSeuptIFTask-Stack to 1024 to avoid a hardfault during debug-message-printing. This is just for testing and it shouldn't influence anything.

Everything works fine with and without debugging-session, when I don't make any further changes within the code.

Then I have moved the delay function for link detection within the vSetupIFTask in the main while loop at the end of the loop to avoid a constant polling:

vTaskDelay(configTICK_RATE_HZ / 4); // moved to the end of the while(1) - loop

Now the program only works when I have an active Debug-session running. When I turn the power off and try to run the example without debugging, then I get this debugging output:

Waiting for TCPIP thread to initialize...
Starting LWIP TCP echo server...
pbuf_alloc(length=1536)
pbuf_alloc(length=1536) == 0x10002274
lpc_rxqueue_pbuf: pbuf packet queued: 0x10002274 (free desc=3)
pbuf_alloc(length=1536)
pbuf_alloc(length=1536) == 0x10002890
lpc_rxqueue_pbuf: pbuf packet queued: 0x10002890 (free desc=2)
pbuf_alloc(length=1536)
pbuf_alloc(length=1536) == 0x10002eac
lpc_rxqueue_pbuf: pbuf packet queued: 0x10002eac (free desc=1)
pbuf_alloc(length=1536)
pbuf_alloc(length=1536) == 0x100034c8
lpc_rxqueue_pbuf: pbuf packet queued: 0x100034c8 (free desc=0)
pbuf_alloc(length=308)
pbuf_alloc(length=308) == 0x10004e2c
pbuf_header: old 0x10004e74 new 0x10004e6c (8)
pbuf_header: old 0x10004e6c new 0x10004e58 (20)
pbuf_free(0x10004e2c)
pbuf_free: deallocating 0x10004e2c
Link connect status: 0
pbuf_alloc(length=308)
pbuf_alloc(length=308) == 0x10005888
pbuf_header: old 0x100058d0 new 0x100058c8 (8)
pbuf_header: old 0x100058c8 new 0x100058b4 (20)
pbuf_free(0x10005888)
pbuf_free: deallocating 0x10005888
pbuf_alloc(length=308)
pbuf_alloc(length=308) == 0x10005888
pbuf_header: old 0x100058d0 new 0x100058c8 (8)
pbuf_header: old 0x100058c8 new 0x100058b4 (20)
pbuf_header: old 0x100058b4 new 0x100058a6 (14)
etharp_send_ip: sending packet 0x10005888
lpc_low_level_output: pbuf packet(0x100058a6) sent, chain#=0, size = 350 (index=0)
lpc_tx_pbureclaim_spbuf_alloc(f_free(0x100t: Freeing length=1536)05888)
pbufpacket 0x100
pbuf_alloc_free: 0x10005888 (inde(length=153605888 has rex 0)
pbuf_f) == 0x10005f 1, endingree(0x100058a90
lpc_rxq here.
ethar88)
pbuf_frueue_pbuf: pp_request: ee: deallocabuf packet sending ARP ting 0x10005queued: 0x1request.
pbu888
0005a90f_alloc(leng (free descth=42)
pbuf_=0)
lpc_lowalloc(length_level_inpu=42) == 0x10t: Packet r0057dc
ethareceived: 0x1p_raw: send0002274, sizing raw ARPe 60 (index= packet.
lp0)
c_low_level_output: pbuf packet(0x100057ec) sent, chain#=0, size = 42 (index=1)
lpc_tx_recpbuf_free(0laim_st: Frex100057dc)
eing packet pbuf_free: 0x100057dc (0x100057dc index 1)
pbuhas ref 1, f_free(0x100ending here057dc)
pbuf_.
ethernetfree: deall_input: destocating 0x1:ff:ff:ff:ff00057dc
:ff:ff, src:24:65:11:9b:e1:ab, type:806
etharp_update_arp_entry: 192.168.178.1 - 24:65:11:9b:e1:ab
etharp_find_entry: found empty entry 0
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_arp_input: incoming ARP request
etharp_arp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x10002274)
pbuf_free: deallocating 0x10002274
Link connect status: 1
lpc_rxqueue_pbuf: pbuf packet queued: 0x10002890 (free desc=0)
lpc_low_level_input: Packet dropped with errors (0xffffffff)
pbuf_alloc(length=308)
pbuf_alloc(length=308) == 0x10002274
pbuf_header: old 0x100022bc new 0x100022b4 (8)
pbuf_header: old 0x100022b4 new 0x100022a0 (20)
pbuf_header: old 0x100022a0 new 0x10002292 (14)
etharp_send_ip: sending packet 0x10002274
lpc_low_level_output: pbuf packet(0x10002292) sent, chain#=0, size = 350 (index=2)
lpc_tx_pbureclaim_spbuf_alloc(f_free(0x100t: Freeing length=1536)02274)
pbuf_packet 0x10
pbuf_alloc(free: 0x100002274 (indelength=153602274 has rex 2)
pbuf_f) == 0x10006f 1, endingree(0x1000220ac
lpc_rxq here.
74)
pueue_pbuf: pbuf_free: dbuf packet qeallocatingueued: 0x100 0x10002274060ac (free
desc=0)
lpc_low_level_input: Packet received: 0x10002eac, size 60 (index=2)
etpbuf_alloc(hernet_inputlength=1536: dest:ff:ff)
pbuf_allo:ff:ff:ff:ffc(length=153, src:24:656) == 0x1000:11:9b:e1:a66c8
lpc_rxqb, type:806ueue_pbuf: p
etharp_upbuf packet qdate_arp_enueued: 0x100try: 192.16066c8 (free 8.178.1 - 24desc=0)
lpc:65:11:9b:e1_low_level_:ab
etharp_finput: Packind_entry: fet receivedound empty e: 0x100034cntry 0
ethar8, size 506p_find_entry (index=3)
: no empty entry found and not allowed to recycle
etharp_arp_input: incoming ARP request
etharp_arp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x10002eac)
pbuf_free: deallocating 0x10002eac
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:f0:de:f1:69:c3:e3, type:800
pbuf_header: old 0x100034d8 new 0x100034e6 (-14)
pbuf_free(0x100034c8)
pbuf_free: deallocating 0x100034c8
etharp_timer
lpc_rxqueue_pbuf: pbuf packet queued: 0x10005a90 (free desc=0)
lpc_low_level_input: Packet dropped with errors (0xffffffff)
pbuf_alloc(length=308)
pbuf_alloc(length=308) == 0x10002274
pbuf_header: old 0x100022bc new 0x100022b4 (8)
pbuf_header: old 0x100022b4 new 0x100022a0 (20)
pbuf_header: old 0x100022a0 new 0x10002292 (14)
etharp_send_ip: sending packet 0x10002274
lpc_low_level_output: pbuf packet(0x10002292) sent, chain#=0, size = 350 (index=3)
lpc_tx_pbureclaim_spbuf_alloc(f_free(0x100t: Freeing length=1536)02274)
pbufpacket 0x100
pbuf_alloc(_free: 0x1002274 (indexlength=1536002274 has r 3)
pbuf_fr) == 0x10002ef 1, endinee(0x1000227eac
lpc_rxqg here.
4)
pueue_pbuf: buf_free: depbuf packet allocating queued: 0x100x10002274
002eac (free desc=0)
lpc_low_level_input: Packet received: 0x10002890, size 60 (index=1)
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:24:65:11:9b:e1:ab, type:806
etharp_update_arp_entry: 192.168.178.1 - 24:65:11:9b:e1:ab
etharp_find_entry: found empty entry 0
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_arp_input: incoming ARP request
etharp_arp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x10002890)
pbuf_free: deallocating 0x10002890
lpc_rxqueue_pbuf: pbuf packet queued: 0x100060ac (free desc=0)
lpc_low_level_input: Packet dropped with errors (0xffffffff)
etharp_timer


It also keeps working when I press the red stop button on the debug session. I can also detach the USB-cable from the LPCXpresso board and let the USB2Serial converter power it. But when I turn it off and on then it shows the again the messages from above.
The interesting thing is, that when I start a debug session without reprogramming the device through changing the Attach only-Flag to True in the Debug Configurations Settings, it also starts working after a new dhcp-request has been made.

I would be very thankful, if somebody could give me an advice where to search for the error.

Best Regards,
The Dude.

Outcomes