I'm really sorry but after 10 days spent with lwip stack, it's time to ask help.
I'm working with a custom board based on stm32f103 and on ublox Leon-G100.
My first attempt was to connect the board trough the serial with pc and use pppd to connect. the test was successfully passed, I got with a speed test (console version) 8-14KBytes/s. The firmware was a simple pass-trough between two uarts. pc<->board<->gprs
After that I started to work with lwip to test with a small stack directly on board. I read that article http://lwip.wikia.com/wiki/PPP and honestly after 5-6 hours of work I got the first result, the board was successfully connected to the apn, I got the ip,gateway and mask but after that, no more progress come :P
Basically I initialize the modem and put it in data mode, then I call pd = pppOverSerialOpen(PPP_SERIAL_PORT, linkStatusCB, &connected); to link up the connection and it goes well. At this point I declare a socket and try to open a connection, in this way:
/* set up address to connect to */
memset(&addr, 0, sizeof(addr));
addr.sin_len = sizeof(addr);
addr.sin_family = AF_INET;
addr.sin_port = PP_HTONS(80);
addr.sin_addr.s_addr = inet_addr("188.8.131.52");
int timeout = 10000;
/* create the socket */
s = lwip_socket(AF_INET, SOCK_STREAM, 0);
LWIP_ASSERT("s >= 0", s >= 0);
/* first try blocking: */
/* connect */
ret = lwip_connect(s, (struct sockaddr*)&addr, sizeof(addr));
/* should have an error: "inprogress" */
LWIP_ASSERT("ret == -1", ret == -1);
the stack try to send a ppp request, 48 bytes well formatted, but no one byte is never received from uart.
I did a lot of tests playing with some parameters but no one of them went well. I don't want annoying you with all kind of tests I did. And yes, if you are asking if the modem is still in data mode after pppOverSerialOpen.
Attached the log, I apologize if it is rude. If you need to change the debug mask let me know.
On Tue, Jun 21, 2016 at 05:53:05PM +0200, Gennaro Zazo wrote:
> Attached the log, I apologize if it is rude. If you need to change the
> debug mask let me know.
The garbaged log probably means you are violating lwIP threading
constraints. You can notice that PPP negotiated up to a running session
in your log, which is quite a good news.
The pppos_input() function in lwIP 1.4.x is not thread safe, maybe
that's the issue. You could try setting PPP_INPROC_MULTITHREADED but the
name is misleading, that's only IRQ safe (i.e. safe with one way
preemption and different priority) but not thread safe.
Or better, you could try lwIP 2.0.0 Beta1, where the PPP stack was fully
reworked if not totally rewritten.