Archives
-
Using serial port (rs232) terminals in Linux
A thread documanting my trials and tribulations using a serial port in Linux. May eventually turn into a tutorial. I have been looking for a hterm or bray’s terminal substitute for use under Linux, but there seems to be little info on what and how to make stuff work.
My current setup:
Fedora core 8
Keyspan USA-19HS usb to serial adapter
STK500 board=========
Setup hardware
=========
Luckily my Keyspan usb to serial adapter was automatically recognized and set up as /dev/ttyUSB2 by Fedora. Run Code:
dmesg
after you plug in the adapter to see if the device was set up. You should see something like:usb 7-1: new full speed USB device using uhci_hcd and address 6
usb 7-1: configuration #1 chosen from 2 choices
keyspan 7-1:1.0: Keyspan 1 port adapter converter detected
usb 7-1: Keyspan 1 port adapter converter now attached to ttyUSB2The last line tells you that the adapter was set up as ttyUSB2. Check the dev folder by running Code:
ls -al /dev/ttyUSB*crw-rw—- 1 root uucp 188, 2 2008-03-13 12:30 /dev/ttyUSB2
**Important note: “Permission denied” errors
Notice that /dev/ttyUSB2 is owned by the root user and the uucp group. You might get “Permission denied” errors when trying to use the /dev/ttyUSB2 port if you are not root or a member of the uucp group. There are a couple of options around this.
A) ‘su’ to root
B) prefix ‘sudo’ to your commands. ex: ‘sudo stty -F /dev/ttyUSB2 9600′
C) add yourself to the uucp group. ‘gpasswd -a me uucp’
D) make the /dev/ttyUSB2 device readable and writable to everyone. sudo chmod 0666 /dev/ttyUSB2
E) create a udev rule to make the /dev/ttyUSB2 device readable and writable by everyone whenever the adapter is plugged in. (too complicated to explain here)Set up the baud rate with the stty command. I’m using 115200, so I run Code:
stty -F /dev/ttyUSB2 115200
. To verify the settings, run Code:
stty -F /dev/ttyUSB2speed 115200 baud; line = 0;
min = 1; time = 5;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echokeYou can do some very primitive debugging. Receive data from the STK500 by opening a terminal window and running Code:
cat /dev/ttyUSB2You can send characters by running Code:
echo “send this” gt /dev/ttyUSB2But it would be really much better if all this could be done inside one program, and maybe get some hex or binary viewing too.
===========
Candidate programs:
===========
* HTerm under Wine
* Bray’s Terminal under Wine
* Minicom
* Picocom
* Gtkterm
* Cutecom===========
HTerm and Wine
===========
I installed wine using yum. Code:
sudo yum install wineSetup the serial port to be recognized by wine. Create a symbolic link to /dev/ttyUSB2 in ~/.wine/dosdevices. (run ‘wine hterm.exe’ first so that wine can create the ~/.wine directory). Code:
ln -s /dev/ttyUSB2 ~/.wine/dosdevices/com5
I chose com5 because I already had /dev/ttyS0 thru /dev/ttyS3 which get mapped to com1 thru com4 in wine.
I can run HTerm in Wine, Code:
cd ~/hterm ampamp wine hterm.exe
but HTerm doesn’t seem to recognize my serial ports under Wine. I can connect to com5, but nothing really happens. There’s an error in the console: ‘fixme:comm:set_queue_size insize 4096 outsize 4096 unimplemented stub’ so maybe HTerm is calling something that isn’t implemented in Wine. Also, there’s something glitchy about the cursor placement when you type in text. The cursor is about one character in front of where it should be.===========
Bray’s Terminal and Wine
===========
Bray’s website http://bray.velenje.cx/avr/terminal seems down right now, but I downloaded terminal.exe from here http://www.myplace.nu/mp3/download.htm (scroll down to the “Tools and Others” section)Set up the serial ports as described in the above HTerm section. Code:
cd ~/bray ampamp wine terminal.exe
Bray’s terminal actually works when you connect!============
Minicom v2.2
============
I finally got minicom working, although I don’t really like minicom. It’s like running hyperterminal in windows… yucky.Run the minicom setup. Code:
sudo minicom -s
Go to Serial port setup and set the Serial Device to /dev/ttyUSB2. (Press A to change the Serial Device, and press Enter when you are finished to go back to the menu)
Press E to set the baud rate (Bps/Par/Bits). I’m using 115200 bps. If you know what stop bits and stuff you need to use, set it here. If you don’t know, I think ’8N1′ is pretty standard and should work. My setting reads 115200 8N1
Press F to set the Hardware flow control to ‘No’.
Press G to set the Software flow control to ‘No’.
Leave Callin Program and Callout Program blank. (I have no clue what these do)
Press Enter to go back to the main menu.Go to the Modem and dialing menu. I’m not sure if this is necessary, but I deleted all of the strings in here. Press Enter to go back to the main menu.
Go to the Screen and keyboard menu. Press Q and set the Local echo setting to Yes. This allows you to see what you are sending over the serial connection in the terminal. Press Enter to go back to the main menu
Choose Save setup as dfl then Exit the minicom setup. It should start up minicom.
In the minicom window you should be able to start typing to send characters. Press ‘ctrl-a z’ to see a list of menu options. I have to go to the menu and set the local Echo to off then on each time to see my input, even though it’s supposed to be saved in the settings
==========
Picocom v1.4
==========
I try running picocom Code:
sudo picocom –baud 115200 /dev/ttyUSB2
but I’m not sure if it’s working. Press ‘ctrl-a x’ to exit the program.==========
Gtkterm v0.99.5
==========
Run gtkterm Code:
sudo gtkterm
Go to Configuration =gt Port and setup the device and baud rate. Turn on the Local Echo by making sure Configuration =gt Local Echo is checked. Now start typing!==========
Cutecom
==========
There was no cutecom package in yum, so I have to compile it myself. I downloaded 0.20.0 from their site http://cutecom.sourceforge.net
Install cutecom: Code:
su –
yum install qt4-devel.x86_64 cmake
tar xzvf cutecom-0.20.0.tar.gz
cd cutecom-0.20.0
less READMEThe README says to make sure to use qt4′s qmake. Check which qmake is in your path with Code:
which qmake
This returns ‘/usr/lib64/qt-3.3/bin/qmake’ for me, which is qt3′s qmake. Find where yum put qmake for qt4 Code:
find / -name qmake 2gt/dev/null
Looks like qt4′s qmake is at /usr/lib64/qt4/bin/qmake. Add this to the PATH variable like it says to do in the README
Code:
export PATH=/usr/lib64/qt4/bin:$PATH
cmake .
make
make installThe install went ok. Running Cutecom opens up a nice Bray-esque interface.
Related Forum Messages
- RobotC under Linux
- Serial communication problem with XBee series 01
- Running MPLAB under Wine on linux
- Running Dynamic C under Linux/Fedora/Wine?
- MikroC under Linux/Wine working
- Serial to USB communication problems
- Mplab X Linux 64bit CCS under wine
- BascomAVR on Linux
- Can’t get my ssc-32 servo controller to run on Ubuntu vbox
- Issue with Mighty 1284P Optiboot bootloader on STK500
- not able to use flash magic tool in linux ubunt – MCB 2300 board not detected
- MSP-EXP430F5529 Terminal Echo demo performance
- Mplab x and C18
- Lost messages
- How Do You Get It To Start? New install of MPLAB_X under skinny linux…
- Pic32 Ethernet Starter Kit USB CDC Demo App Running On Linux
- RS232 Serial communication under Linux
- Using LINUX and WINE with the Bascom AVR
- Blueboard LPC1768-H development from linux
- Linux tools for 8-bit development?
Several of our Vex team(s) at Palm Bay High are interested in getting RobotC to work under Linux. We have access to a lot of older computers, but can't afford to outfit them all with a Microsoft operating systems, anti-virus and firewall software, etc. (Not to mention that newer Windows OS's run extremely slowly on these old boxes.) If we could get RobotC to work under Linux, it would enable everyone on the team who wanted one to just purchase a copy of RobotC and run it on a basically 'free' computer! We installed RobotC IFI V1.05 under WINE 0.9.41 ...I am having trouble establishing a connection between the XBee Series 01 and my computer. I assembled an XBee series 01 module from Adafruit together with an adapter from Adafruit: http://www.adafruit.com/products/128 http://www.adafruit.com/products/126 Using the FTDI cable, I connected it to my computer and established that the green LED was blinking as it should. I disconnected it. Since I run Linux, I installed Wine on my Ubuntu 11.10 system. Under home/.wine/dosdevices I ran "ln -s /dev/ttyUSB0 COM5", "ln -s /dev/tty USB1 COM6" to link my serial ports (tty) to Windows' COM ports. From the following link I downloaded the X-CTU installer: http://ftp1.digi.com/support/utilities/40003002_B.exe I installed X-CTU using Wine. I hooked up ...I'm thinking of getting one of those new Asus EEE laptops, one of the benefits of which would be easier collaboration and working in different places on a microcontroller project. But this laptop runs linux. Some google searching indicates that it can run under Wine, but sometimes requires tweaking. I would need it for programming with an ICD2, and compiling code, but since my next project doesn't have the chip decided yet, I'm not sure which compiler I'll need. Has anyone here used MPLAB under Wine, and how smoothly did setting it up go?Hi My super-duper Rabbit Dev Kit RCM440W arrived. Somewhat bizarrely, it promised an international power adapter in the blurb and on RS website, but arrived with a US one. Once that detail had been sorted out with a soldering iron, it was on to try it out! It works perfectly under Windows XP, but as Windows is consigned to an alternate boot-up on the kids' computer inconveniently located under the stairs, it's either go on a diet to lose enough weight to be able to squeeze under there or, much more preferable, get it working under Linux (Fedora 11) and Wine. 1. It ...Hello, The version 5.0 of MikroC is working under Wine 1.3.21. My Distribution is Slackware 13.1.0. The IDE is running but some texts are missing (see attach). But I do not try a compilation. I used C compiler in command line mode (see makefile attached) and it is working perfectly (with demo or registered version) The programming of the PIC is done with the MPLAB PM3 from Microchip via serial port. Best regards, Bouli ps : cfg file is create from IDE interfaceHello, I have been having trouble with serial to usb adaptors. Sometimes characters get lost or corrupted in both transmit and receive. It seems I need a different serial--gtUSB adaptor/driver combintion, but what? Here is the layout: Atmega32 running at 8mhz, uart @ 9600 baud. Serial adaptors tried: Keyspan, FTDI, Prolific. Win7 64 drivers from the coresponding manufacturers website. Oparating system: Windows 7 64bit home on a 6 month old cheap HP laptop. Terminal program: MTTTY or Terraterm. RS232 level converter from the AVR uart : ST232 Everything works fine on a real serial port on a desktop, and all ...I've just installed the latest Mplab x beta which was fine. I have a license for the windows version of the CCS compiler, which i've installed under wine and is working fine. Now Mplab x didn't pick this up automatically, which I wasn't really expecting it to, but when I try to manually add the tool through options / embedded, it tells me the base directory is not valid. If I select the CCS folder "/home/me/.wine/drive_c/Program Files/PICC" it says "Base directory does not contain a toolchain" If I manually add Ccsc.exe to the path, it says "Base directory is not ...Hello, I tried to make it work under "wine" but without success Sometime ago i found a great "howto" (written by aor_dreamer) to install AVRStudio in ubuntu which also would not work under "wine" and after carefully following the steps in the "howto" now works just fine. (a few days ago i posted this message in the wrong group, i think it belongs here - i'm a newbie) AlbertI am not sure if Ubuntu is recognizing the device. I cannot seem to figure which serial port it is. I have used the following programs: minicom, cutecom, and serial port terminal. Lynxterm gets it to run fine under Windows, however I need it to run on Linux. Help!!!I have been playing with a 1284p chip and have a little trouble getting it to work with the core from https://github.com/maniacbug/mighty-1284p/zipball/master I have the chip on a STK500 and used a standard c program to verify that its fuse are correct and that it works. I then burned the Tools gt Board gt Mighty 1284p 16MHz using Optiboot bootloader and was unable to get the IDE to upload to the chip. I would get the following error: Code: Binary sketch size: 3,410 bytes (of a 130,048 byte maximum) /usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega1284p -carduino -P/dev/ttyUSB2 -b115200 -D -Uflash:w:/tmp/build8867354308208977374.tmp/test_entropy.cpp.hex:i avrdude: ...I am working on MCB2300 kit on Windows for quite some time. It is working well. But now I need to use the same kit on Linux. I have installed Keil IDE on linux Ubuntu with the help of Wine. IDE is working fine. But problem is with flash magic tool. I have installed Flash Magic also on Linux Ubuntu with the help of WIne. In flash magic GUI, it takes COM 1 but in Linux we don't have COM 1. It takes as ttyS0, ttyS1 etc., I have tried to map ttyS0 to COM 1 with the following ...While testing the terminal echo demo feature of the board I find that when I press a key, the character 1. sometimes does not appear on the boards LCD, 2. sometimes it appears a few seconds later ampamp; 3. sometimes it appears instantly. Has anyone experienced this? I am running XP, have recompiled the demo code using code size limited CCS, the USB mouse ampamp; USB microSD demos work well, serial port settings although not specified in the boards user manual have been set to 115200,8,n,1 flow control using Xon/Xoff ( I also tried No flow ...[Helpful answer received] / [List Solutions Only] I am noob, here..so if there are link/thread that I should read and try.. PLEASE post them.. first I an running Ubuntu 10.10 with the latest updates. I have installed Mplab x 4.0 for Linux and the C18 compiler. the Mplab runs..no problems.. If I try to run mcc18, since I'm trying to write in 'c', and don't know asm yet, it fails.. if I try to run mcc18 -? from a terminal window I get a 'buffer overflow' error..this should never happen..there are other posts about this but no fix? when? I have ...I am runnung two XBee Pro S2B on sparkfun XBee Explorer USB boards. The boards are connected to a linux machine using USB. On X-CTU (wine) I selected the firmware versions: - 218C for the coordinator XBee - 298C for the End Device XBee My Problem is that I sometimes do not get any answers to the requests I am sending to the XBee. That is if I am sending the API frame to query the AI value, I only sometimes get a message back containing the AI value. If I configure the XBee to be a coordinator, I am losing about 20% ...Coming back to Linux after getting fed up with ELF-Binaries back in 90-s... Now fed up with Microsoft-bloat. Got a P-3 with 512M ram and 4G hard drive with Puppy 5.1.1 Linux (Ubuntu binary build) with WINE, Firefox, and Java JRE 1.6.0_26. MPLAB_X60 appears to install fine, says it's making desktop icon, please reboot then builds uninstaller and finishes. I reboot the system and the startup, menus, and desktop are unchanged. I can locate the installation in /opt/microchip/mplabx then I proceed to ../mplab_ide/bin where I find 3 executables including mplab_ide and an EXE file that Wine intercepts ...I got the urge to try the USB Demo code on my MplabX install tonight and figured I'd try the CDC demo. After a brief look at the product page, I didn't see a Linux specific download so I just figured I'd work with the Windows version and see what it takes to get it to compile. Were I not so unfamiliar with MplabX in general, I think it would have gone a good bit faster. To get it to run, I of course copied the project folder from the windows system to my projects directory on Linux. ...Hello: I use JN5139 and JN5148 Modules, compile my programs in C::B IDE under Windows XP and I can connect, send and receive data from/to a Terminal like HyperTerminal, but in linux I can obtain any data from terminals (Minicom our GTKTerm). I have connected to serial port COM1 (Win), respectively ttyS0 (Linux) with serial parameters: 19200 8 N 1. Anyone can help me with this situation? Best regards Nuno AlvesI am using a Linux (Ubuntu 11.10) for some work. I do have a Windows machine that runs Bascom AVR with no identified problems but was wondering if anyone has used the compiler with Linux and WINE? Thanks in advance.I just received my Blueboard LPC1768-H and am working on using it from a linux development machine, using GCC obviously. Since I haven't seen many references on this (someone please post a link if they know of any!) I'm going to describe some of what has and hasn't worked for me. Plugging in the mini USB powers it and comes up as an HID mouse. With no actual user controls. Okay, the board isn't dead, but as an approach this is a dead end. Connecting to the uart0 bootloader with an FTDI TTL-232-3V3 cable works unsurprisingly, though of course the pinout of ...I'm looking for tools to write a small C program for the AVR Tiny 6-pin MCU. As far as I can tell the GCC toolchain is only for 32 bit MCUs and the standard way of doing 8-bit development is to use Studio 4 which is only available on Windows. I've tried Studio 4 in Wine 1.2-rc-2 and it starts up OK but crashes as soon as I try to create a project. I have the ATAVRISP2 USB programmer which has a Linux driver which is closed source and will only work on certain distributions. Would be grateful for any ...
