Using 86ComSh
This application note provides information showing how to use 86ComSh to enable FreeDOS console redirection.
As a derivative from FreeDOS, DuinOS also inherited the console redirection feature from FreeDOS. To enable console redirection for DuinOS, you need 86ComSh, MODE and CTTY. 86ComSh is an application develop using the 86Duino DOS SDK. You can find the 86ComSh executable in the \TOOLS folder. Source code for the 86ComSh is in the \TOOLS\SRC\86ComSh folder. From the \TOOLS\SRC\86ComSh folder, you can execute the make
command to compile and generate the 86ComSh executable.
The MODE is an utility used to configure hardware device’s state and behavior. CTTY is a command to change the terminal device used to control DuinOS.
You need to launch the 86ComSh utility with a parameter, to designate a port for the console redirection, such as “1” for Serial1 (COM1). After opening the serial port, use MODE and CTTY command to configure console redirection. A batch file, 86ComSh.BAT, is provided as part of the DuinOS distribution to enable console redirection.
Console redirection under DuinOS (FreeDOS) has limitation and not able to execute graphical program. In addition, do not execute application that interact with the same serial port used for console redirection to avoid conflict which can create unpredictable result.
2. Enable Console Redirection during startup
You can modify the AUTOEXEC.BAT batch file to enable console redirection during startup, as follow:
Attach the MicroSD card with DuinOS to your PC via an USB-to-MicroSD adapter.
Open the AUTOEXEC.BAT file with Notepad or another text editor.
Locate the line of code CALL TOOLS\86UsbSh.BAT
and add REM
to the beginning of the line (if it’s not already there).
Locate the line of code CALL TOOLS\86ComSh.BAT
and delete the REM
at the beginning of the line.
As shown above, the 2 parameters associate with the line of code CALL TOOLS\86ComSh.BAT 1 1152
are used to configure the serial port and baudrate for console redirection. The first parameter “1” configure COM1 as the port and the 2nd parameter “1152” set the baudrate to 115200 bps.
To change console redirection to use COM2 at 9600 bps, change CALL TOOLS\86ComSh.BAT 1 1152
to CALL TOOLS\86ComSh.BAT 2 96
.
Save the changes to AUTOEXEC.BAT and remove the MicroSD card.
3. Using Console Redirection
This section talks about console redirection usage based on COM1 and 115200 bps.
You will need an USB-to-UART (TTL) adapter to attach the 86Duino board to your development PC, as follow:
Attach the RX signal from the USB-to-UART (TTL) to 86Duino COM1’s TX and TX signal from the USB-to-UART (TTL) to 86Duino COM1’s RX. Attach the GND signal from the USB-to-UART (TTL) adapter to a GND signal on 86Duino.
Attach the USB connect from the USB-to-UART (TTL) adapter to your development PC.
You need an active serial port on your PC to connect to 86Duino in order to interact with the console redirection.
To find which serial port is associated with the USB-to-UART (TTL) adapter, from the “Device Manager” screen, expand the “Ports (COM & LPT)” node to view the entry under this node. You should see an entry similar to “USB Serial Port (COM11)”, which represent COM11 is associate with the USB-to-UART (TTL) adapter.
We will use PuTTY to interact with console redirection from 86Duino. PuTTY is an useful utility with terminal emulation, serial console and network file transfer function, available via the here.
Launch PuTTY with the following:
- Connection type: Serial
- Serial line: COM11
- Speed: 115200
After clicking on the “Open” button to connect to 86Duino, a DOS Command Window with “C:\” is shown as below.
From the DOS command window, you can execute command such as dir
to list files and directories from 86Duino, as shown below.
The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.