Skip to content

Instantly share code, notes, and snippets.

@voidlizard
Created February 4, 2012 05:07
Show Gist options
  • Save voidlizard/1735496 to your computer and use it in GitHub Desktop.
Save voidlizard/1735496 to your computer and use it in GitHub Desktop.
lwIP PPP initialization
I have ppp working in both lwip 1.3.0 and lwip 1.3.2 and would recommend 1.3.2
First you need ti init the stack and the init ppp
sys_sem_t sem;
sem = sys_sem_new(0); // Create a new semaphore.
tcpip_init(tcpip_init_done, &sem);
sys_sem_wait(sem); // Block until the lwIP stack is initialized.
sys_sem_free(sem); // Free the semaphore.
/* init the PPP stack */
pppInit();
now dial you modem, performing and init string that your device requires. Once your modem respond with a CONNECT string you are ready to begin ppp session.
pppSetAuth(PPPAUTHTYPE_NONE, "", "");
pppFD = pppOpen((sio_fd_t)MODEM_USART,ModemErrorCB,this);
the real trick for the gprs modem for me was to also enable the authorization methods in lwipopts.h
Then a ppp session is negotiated and you can begin the use the stack one the ModemErrorCB is called.
I hope this helps
Oh I ripped out the ethernet code since my current project does not require it yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment