Configuring a Serial-over-IP (SoI) Application
Configuring a Serial-over-IP (SoI) Application
See how to set up a Serial-over-IP app on a DS1101 using Tibbo's Device Server Toolkit.
Join the DZone community and get the full member experience.Join For Free
This project is a serial-over-IP (SoI) application written in Tibbo BASIC. It runs on BASIC-programmable devices, such as the new DS110x family of programmable serial controllers.
Notable additions are:
- Support for the OLED display of DS1101 and DS1102 devices.
- Wi-Fi and GPRS support with seamless switching between Ethernet, WiFi, and GPRS.
- Web admin interface — set up your devices via the web browser.
- Multi-port and multi-channel operation.
- No support for start and end characters on the serial side.
- No LinkServer support.
Like our fixed firmware devices, the SoI application works with our Tibbo Device Server Toolkit (TDST). We have a separate Serial-over-IP Solutions Manual that explains everything in detail. The material on this page is meant as a simple introduction on how to use this SoI Tibbo BASIC application. We also briefly explain new stuff, like the OLED display or the interface switchover.
As an example, we will set up one serial port of the DS1101 device to operate with a virtual serial port (VSP, a.k.a. "virtual COM") of the PC. There are many other device server usage scenarios we will not talk about here.
Preparing the DS1101
DS1101 devices ship with this SoI application preloaded and properly initialized. Just in case yours had it differently or was already used to run something else, here is what you do to prep the app:
- Download and install the Tibbo Device Server Toolkit (TDST) software for Windows. Install the latest version even if you already had TDST installed on your PC.
- Load the application using Device Explorer. Subsequent upgrades of this application can be done via the DS Manager (part of the TDST).
- When you first run the application the device will enter the error mode, which means that it's setting (which are stored in the EEPROM) require initialization. The error mode is indicated by blinking red status LED. Devices with displays will also have the following message on the screen:
Note: SoI application automatically switches the display off after a certain timeout. To turn the display on, briefly press the MD button.
When there is a display:
- If the display is off, briefly press the MD button to turn the display on.
- When in the "ERROR MODE" screen, press and hold the MD button until you see the "INIT COMPLETE" message.
- Reboot (power-cycle) the device.
When there is no display:
- Press the MD button once to enter the serial programming mode (red and green status LEDs blinking).
- Press and hold to initialize.
- Wait until the green status LED is turned on.
- Reboot (power-cycle) to complete the initialization.
After the reboot, you should be able to see your device in the DS Manager. Initialized devices have their DHCP turned off, so your DS1101's IP will be 220.127.116.11.
Note: From time to time, our users encounter firewall issues. You may have to disable your firewall (or allow UDP traffic on port 65535) for the DS Manager to be able to see your DS1101.
Setting the IP Address
- Find your DS1101 in the DS Manager's list, then click Settings.
- Enable DHCP or set the desired IP address.
- Click OK.
- The DS1101 will reboot with the new IP/DHCP configuration. You can click Refresh to see what IP address is actually being used by the DS1101 now.
Using Web Admin
Once your devices have the same IP address and you know what it is, you can also use your web browser to set up the DS1101. Point the browser to the target IP address, and the rest is obvious.
Hint: There is no password, just click Login. You can set the password later.
Configuring the VSP-DS1101 link
- Launch the Connection Wizard (it is part of the TDST).
- On the first screen, select "Create a link between a Virtual Serial Port and a Device Server." Click Next.
- Select the number of the VSP (virtual COM) you want to use. For example, select "Create new VSP" and choose COM3 from the drop-down list (assuming that COM3 is unused on your PC). Click Next.
- Point at your device server. Click Select from the list and double-click on your DS1101 in the DS Manager's screen. Do not change anything else. Click Next.
- Select the channel (on the DS1101) the VSP on your PC will be communicating with. Click Next when done.
- Select which side (DS1101 or VSP) will send the data first. There are some configuration differences associated with this, but we won't go into such minute details here. "Any side" is a safe bet, so choose that and click Next.
- Next is the Gateway and netmask settings screen. Assuming that your DS1101 is plugged into the same network segment with your PC this screen will be skipped. Click Next.
- Transport protocol and listening ports screen. Everything you (normally) need is selected by default. You are going to use TCP/IP, and you don't really care about ports as long as everything works. Click Next.
- On-the-fly commands screen. These commands do a lot, but most importantly, they configure the serial channel on your DS1101 as requested by the software that is using your virtual COM. For example, if an application wants 115200bps, then it will "tell" the (virtual) COM, and virtual COM will send an on-the-fly command to the DS1101 telling it to switch designated serial port to 115200bps. Got it? So, don't touch the default choice and click Next.
- Serial settings for the device server screen. No need to do anything here. We have on-the-fly commands enabled. Click Next.
- Now you are at the summary screen. You can review how the virtual COM and your DS1101 will be set. Click Finish, and you are done!
Testing the VSP-DS1101 link
Any "serial terminal" software will do and may we suggest our very own I/O Ninja.
- Download and install I/O Ninja.
- Select File > New Session.
- Choose Serial and click OK.
- Select your VSP and click Open Port (the lightning-bolt icon).
- I/O Ninja is now ready to send the data to the DS1101. Note: Our TDST software includes a Tibbo Monitor, which you can find in the system tray. This Tibbo Monitor maintains a log of virtual COM activity. Observe what happens when you open/close the port in I/O Ninja, change baudrate, etc.
Working With Wi-Fi and GPRS
This SoI application supports Wi-Fi and GPRS interfaces. The way it works, the app will try to choose the best interface among available and enabled interfaces.
The highest priority is always given to the Ethernet interface. It will be "active" for as long as there is a live cable plugged into the device. Unplug the cable, and your device will look for alternatives.
If there is a Wi-Fi interface, and it is enabled, your device will try to use it. Failing that, the device will turn to GPRS, again, if it is available and enabled. Plug the Ethernet cable back into the device, and the app will switch over to using it again.
The DS1101 can be optionally outfitted with the Wi-Fi interface (GA1000 add-on module). Assuming your device has it, let's go over the settings:
- Wi-Fi Mode:
- Permanent means that Wi-Fi is always on. As soon as the device boots, it will activate the GA1000 and attempt to associate with the network. This doesn't mean the link is used, only that it's on. As long as the device has a wired connection, that connection will be used. As soon as the Ethernet cable is unplugged, the device will hop over to Wi-Fi instantly, with no set-up time required because it's already associated. Note that each network interface will have a different IP address, so you won't be able to access the device's Ethernet IP when its cable has been disconnected. You would need to know (and use) the IP of the Wi-Fi interface.
- On demand means the GA1000 is normally off. As soon as the device loses Ethernet connectivity, it fires up the GA1000 and attempts to associate wirelessly. Once the Ethernet link becomes available again, the device automatically shuts down the GA1000 and resumes wired operation. This mode is useful for conserving power.
- Access Point Name: That's the name of the access point you're trying to connect to. Be sure to get it right — it's case-sensitive.
- Security: You must select the security type your access point is using. If you're not sure what that is, try checking the access point configuration — it is always listed there. Note: When using WPA or WPA2, the first association with a new network for about 1.5 minutes. Both the green and red status LED will be on during this time, and the device will be busy crunching away some serious math. This is a one-time delay: once done, future associations will be very fast.
- Password: This is case-sensitive, of course. Note: ASCII passwords for WEP are not supported. If you're using WEP, you must enter a hexadecimal password (10 characters long).
- DHCP and other network settings: Nothing Wi-Fi specific here. These are the same settings you already know from wired connections. We advise enabling DHCP unless you have a specific reason not to do so. Note: Do not attempt to set the same IP address for both the wired and wireless adapters. It's not going to work. The Wi-Fi interface is a separate interface, so it must have its own IP.
Published at DZone with permission of Dmitry Slepov . See the original article here.
Opinions expressed by DZone contributors are their own.