[En-Nut-Discussion] Status of Point-To-Point protocol over RS-232
harald.kipp at egnite.de
Sat Apr 16 17:55:10 CEST 2011
Just want to keep you informed about my status on this network interface. If you do not know, what PPP is why it is useful: Apart from Ethernet via router, Nut/Net is able to connect to the Internet via modem. This may be an ancient analog modem for the telephone line or a GPRS or UMTS modem. You may be familiar with UMTS-sticks for the USB port of your notebook. Internally many of them still use a UART for the communication and you can find several modules with such a UART-based modem interface.
I didn't look into the PPP stuff for some months, no years. This feature of Nut/OS still seems to attract new users and I decided to give it a try again personally.
When writing the code, I typically used a Windows PC to connect to. Looks like a PPP server is no longer available on newer Win releases (or I'm too stupid to find it).
So I bought a pre-paid sim card from t-mobile, grabbed my old Siemens S55 mobile phone and luckily found the serial adapter for connecting the phone to Ethernut 2.1's DB9. Phew! That was the hardest part. ;-)
Additional hardware was required, because I wanted to be able to use a second UART for stdout. I added a MAX232 plus DB9 connector to the expansion port, simply using the UART0's Tx line. Using jumpers, I configured the DB9 on the Ethernut board for using UART1 including RTS/CTS handshake, as explained in the hardware manual. Note, that most modems require some kind of hardware handshake.
As mentioned above, the pppc application in the Nut/OS samples was done for a Windows PC, specifically the chat script. I changed this to
'' AT OK AT+CGDCONT=1,"IP","internet.t-mobile" OK ATD*99***1# CONNECT
and, viola, it worked. At least it looked like, but how to proof?
The application implemented a TELNET server, waiting for connections. My provider uses private IP addresses, which are not directly accessible from the Internet. Thus, I won't be able to connect the Ethernut board from the outside. :-(
I re-wrote the pppc code, removing all this AVR specific stuff to make it more readable, and implemented a more useful procedure:
1. Query an IP address of pool.ntp.org
2. Query the current date and time from this IP
The result can be viewed here:
I was lucky because this provider still allows PAP, while many others require CHAP for login. Long, long time ago Michel Hendriks contributed a CHAP implementation
which never found its way into the trunk.
Today, one problem is, that this was based on an early version of Nut/OS (3.9 or something) and obviously contains a few more changes (fixes?) than just adding CHAP. Furthermore it uses the RCA version of MD5, which would add another license to our code. Although compatible with BSDL, I don't like to add more than absolutely necessary. As you may remember, Ole ported a BSDLed version which we can use instead, available in nut/gorp/md5.c. The API is quite similar. But the problem with figuring out how to transfer Michel's code changes into the latest Nut/OS code remains.
How about the ARM platform? There is a AHDLC driver for the AT91 by Szemzo Andras in nut/arch/arm/. Looks like it requires PDC (DMA), which is not available on Ethernut 3. Other problems with this driver had been reported as well and I'm not sure whether anybody is currently using it at all.
That's my status, your comments are welcome.
More information about the En-Nut-Discussion