7 years, 11 months ago.

PPP-Over-Serial (Dial-Up) Webserver

My quest is an embedded HTTP server using only the MBED USB Virtual Com Port.

The idea is that you plug your MBED board into any PC/Linux/Mac and then create a DialUp connection to the newly instantiated USB Com Port as a PPP.

The MBED board should emulate a modem dialing in. After connecting, it should establish a PPP link and an "internet connection" to a webSocket server running on the MBED board.

EDIT: I got the above working. Click on PPP-Blinky on the left to see the writeup. /media/uploads/nixnax/red-on-white-arrow.jpg

Import programPPP-Blinky

Small Internet Protocol Stack using a standard serial port.

Now, according to this http://lwip.wikia.com/wiki/PPP the lwIP library would work fine - you have to implement to sio_write(), sio_read() and sio_read_abort() for your serial port.

However, when I import https://developer.mbed.org/users/mbed_official/code/lwip/ I run into a bewildering array of missing config files, missing arc/cc.h, missing arch/cpu.h etc.

I also see 75 lwip examples but they appear to be either ethernet, 6LowPan adaptations, or PPP clients.

Can anyone suggest a path/workflow to get to the desired virtual internet over USB/Serial/PPP?

Since existing PCs all have dialup networking support, the benefit is that you can esentially create a webSocket server without installing any additional drivers on your PC (execpt, of course for the Virtual Com Port of the MBED board).

I currently run a node.js app on my PC that converts standard MBED USB serial port data to a webSocket, but the point is that I would like to get rid of this step, as it requires installing node.js and running a node.js script.

I have also noted a python serial-to-websocket server documented on mbed, so it appears as if there is a legitimate need for serial-to-websocket interfaces without third-party interfaces.

Any guidance would be appreciated!

Have been doing some more work on this - first I defined a new modem in Windows 8, modem type is "Communications cable between two computers".

/media/uploads/nixnax/winmodem.jpg

So here's the first obstacle: If I choose the direct cable connection's COM port as ST-Link Virtual COM port (COM3), I get a blue screen of death (my first ever in Windows 8) with the error text "IRQL_NOT_LESS_OR_EQUAL" & Windows reboots.

Anyway, to get around that, I used an FTDI FT2232 USB Serial Port (COM6 in the image above) and that worked fine.

Note: This problem appears to have been solved. After uninstalling some serial port monitoring software (which installed an extra device driver filter) I was able to create a modem with the ST-link VCP as the serial port.

I then created a new Network adapter, chose type=DialUp, and selected the newly defined Direct Cable Connection as the modem. Then I clicked "Connect" on the new Dialup connection.

/media/uploads/nixnax/dialup.jpg

Low and behold, I receive the string "CLIENTCLIENTCLIENT" being sent from PC/COM6 on the Nucleo Board!

Then wrote some code on the Nucleo-L476 board (which has Serial3_TX and Serial3_RX connected to COM6) to detect the "CLIENT" string and echo "CLIENTSERVER" back to the PC.

//
if ( strstr(pcDialUpReceiveBuffer,"CLIENT") != NULL) pcDialUpComPort.printf("CLIENTSERVER");
//

And eureka - the PC responded with a PPP packet!!! (COM3 is a debug port)

/media/uploads/nixnax/pppfirst.jpg

The Nucleo-L476 board has been updated to the latest ST-Link Firmware STSW-LINK007 and USB drivers STSW-LINK009 from the STMicro website.

Note 1: There is a bug in Windows 7 and 8 with the Direct Cable Connection - it does not work until you manually edit the file rasphone.pbk and change "Type=1" to "Type=3". Also, every time you update modem settings, Windows will change rasphone.pbk back to "Type=1". Beware! Here is a writeup on it: http://stackoverflow.com/questions/7953376/ppp-connection-through-serial-cable-works-on-windowsxp-but-doesnt-work-on-windo

Note 2: Fiddling the .inf file under Win7: http://www.portlandiacloudservices.com/getting-external-dialup-modems-to-work-on-windows-7/

Note 3: All the "HKR,..." entries end up as HKEY (Relative to root) entries in the registry. Here is the link to the relevant unimodem and DUN registry values: https://msdn.microsoft.com/en-us/library/ms898950.aspx. This helps to document what each of the entries mean.

The good news is that serial port networking between a PC and an MBED board can work!

posted by Nicolas Nackel 24 Dec 2016

1 Answer

7 years, 5 months ago.

Hello Nicolas! I am struggling with the same question, I am trying to use lwIP stack to communicate with world using a 3G modem connected by RS232 with a STM32 board. Did you manage to get some answers?

Hi Rado, There are several cellular modem implementations in the code base. This one might get you started:

Import libraryVodafoneUSBModem

Vodafone K3770/K3772-Z modems driver & networking library

or here: https://developer.mbed.org/components/cat/cellular/

posted by Nicolas Nackel 19 Jun 2017