In my implementation using my own RTOS, I have a thread that does DHCP start (and reconnect as needed), and the MQTT Connect will wait until there is an IP address before proceeding.
On Wed, Oct 3, 2018 at 3:23 PM, Paweł <reast...@gmail.com> wrote: > Hi, > I looked closer at driver implementation and I have problems with > interrupts - at one moment the interrupt isn't handled anymore. I > temporarily worked it around but I'm facing next problems. > From time to time I'm getting a hardfault in tcp_out.c at *useg = > useg->next;*. I realized that useg is null there, I looked through > Internet and I found similiar problem (http://lwip.100.n7.nabble. > com/lwIP-2-0-2-Crash-on-tcp-out-c-line-1148-TCP-SEQ-LT- > EXC-BAD-ACCESS-td30707.html) - the reason was problem with threading. > What I'm wondering about is how to init MQTT and DHCP client in tcp_ip > thread context. I will shortly describe my init sequence. First I start > with tcpip_init with dedicated function to init apps (like in example_app > in contrib) and semaphore. In this function I have netif configuration, > dhcp_start and init MQTT client. I'm starting scheduler, so the > tcpip_thread is starting. Thread calls function described earlier but DHCP > will not assign an IP address because while loop in this thread is not > antered at this time so I can't do MQTT connect at this time because I need > IP address from DNS. > It's complicated to describe but summarizing - I have to call MQTT client > connect in another thread. How to overcome that? > > I was of course looking at https://www.nongnu.org/ > lwip/2_1_x/multithreading.html. > > Regards, > Paweł > > niedz., 30 wrz 2018 o 16:36 Jens Nielsen <d...@telia.com> napisał(a): > >> Hi >> >> Looks just like your driver stops receiving, did you check with a >> breakpoint that you're actually passing the correct received packets to >> lwip? >> >> BR /Jens >> >> On 2018-09-30 11:09, Paweł wrote: >> >> Hi, >> I've implemented lwIP on following hardware: >> CC1312R (ARM Cortex M4F) - TI Launchpad Board, >> lwIP 2.1 in operation system mode (TI-RTOS), >> ENC28J60 MAC+PHY. >> >> My lwIP MQTT client (the one which comes with the stack) succesfully >> connects to the broker and can both publish and subscribe. >> At this moment I'm testing only publishing (one publish per second) - the >> messages are published without problem for some time (one time it is about >> 50 publish packets, one time 300), then the communication stops. >> >> I've recorded packets using Wireshark (with MQTT and TCP filters). IP >> 192.168.1.171 is lwIP, 54.76.137.235 is broker IP. >> What I can observe is that lwIP somehow can't handle TCP retransmission >> packets properly. >> I don't have any messages about too small memory or assertions before >> communication stops. >> What can I do more to solve my problem? Did you see something like that? >> >> I'm attaching .pcap file with described problem (at the end of file). >> >> Regards, >> Paweł >> >> >> _______________________________________________ >> lwip-users mailing >> listlwip-users@nongnu.orghttps://lists.nongnu.org/mailman/listinfo/lwip-users >> >> >> _______________________________________________ >> lwip-users mailing list >> lwip-users@nongnu.org >> https://lists.nongnu.org/mailman/listinfo/lwip-users > > > _______________________________________________ > lwip-users mailing list > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users > -- // richard http://imagecraft.com Beyond Arduino - When you're ready to get serious... JumpStart C Tools for Atmel AVR and Cortex-M, The Better Alternative
_______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users