RS232 interface

Questions on UARTs, and serial communication
YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

RS232 interface

Post by YahooArchive » Thu Oct 25, 2012 2:32 pm

> i want to program the Armmite via RS232 instead of the USB FT232.
> what is the function of DCD1 and RESETh line to the LPC2103 ?
>

I'd suggest using a Wireless ARMmite instead, as then you would not
have to cut traces to hookup a programmer. On the Wireless version
those pins are routed to pads.

Then using an RS232 level shifter connect up RXD, TXD. DCD1 should be
held low during reset to program BASIC, hold it high during reset to
program in C (there is a jumper on the wireless ARMmite). Reset is
driven by DTR (not inverted) on the normal ARMmite (high for reset,
unless in legacy mode -- check the helpfiles)

One candidate for the level shifters would be

http://www.sparkfun.com/commerce/produc ... ucts_id=16

with the PIC removed.

More details on this were added to the help files



YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Thu Oct 25, 2012 2:45 pm

Rather than use the USB port on the ARMmite, I'm trying to communicate with a
host PC through an RS232 port, using IO pins 0, 1, and 2. IO's 0 and 1 are the
data to and from the ARMmite respectively, while I use IO 2 to monitor the RS232
RTS line (input present/coming when it goes low). So far, I've not been
successful, either using SERIN or RXD. SERIN (using SERIN 0,baud,[MyByte])
gives a MyByte = 0 output for baud rates > 9600. I start getting something at
baud rates =< 9600, but it does not change with the input and does not look
anything like what is being sent. Attempts at using RXD have been equally
unsuccessful, with, for example, a$ = RXD(0) giving a Data abort message and
causing the program to restart.

The sending program is written in freebasic, and is a very simple open com,
write #, close com program. RS232 to TTL level conversion is handled by a
commercial serial to TTL board. I've not tried going the other way - a moot
point if I cannot get input to the ARMmite from the PC. I have also noticed
that the RTS line stays low a lot longer than data is being transmitted. This
was shown by an ARMmite program that monitored IO's 0 and 2, and when IO 2 (RTS)
went low periodically outputs the value of IO 0. This also tells me that data
is actually making it into the ARMmite, although I cannot see any patterns in
the binary that match what I'm sending (a string of NNNNN).

What am I doing wrong? I've tried following the examples in the ARM help files,
but they, and every variation on them I can think of, do not work. Should I be
using other IO pins on the ARMmite? I'm trying to keep all my programming of
the host and ARMmite in BASIC. Any pointers, suggested code variations, or
other suggestions would be greatfully appreciated.

Thanks

Marc

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Tue Dec 04, 2012 3:51 pm

It says (somwhere in the ARMbasic documention/help) that
ARMbasic "emulats a serial port". I know that on my machine, with way
it's configured at he moment, that this port is com4: Because I have
changed the speed it's communicating at 19200 baud.

However I don't know the parity, number of data bits, or number of stop
bits that I need to put in to be compatible with this emulation. In a
PRINT statment on ARMmite I get a 16 bit number; how would this be
transmitted ?

Or are these senseless questions to ask because the system is only
emulating a serial port ?

Can someone tell me a site where I can download he necessary software
to enable me to run *.tcl programs ?

EdC

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Tue Dec 04, 2012 3:51 pm

> PRINT statment on ARMmite I get a 16 bit number; how would this be
> transmitted ?

In ASCII

> Or are these senseless questions to ask because the system is only
> emulating a serial port ?

A little, in that most programs on the PC will set the baud,
bits, ... when they open the serial port

> Can someone tell me a site where I can download the necessary >
>software to enable me to run *.tcl programs ?

More than you'll ever want to know about Tcl is at

http://www.tcl.tk/man/tcl8.4/

But for simplicity, I like to download the FreeWrap version, and
rename it to use as a standalone Tcl interpreter.

http://freewrap.sourceforge.net/

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Tue Dec 04, 2012 3:53 pm

Thanks for the info on tcl, I'll try it.

You say "A little, in that most programs on the PC will set the baud,
bits, ... when they open the serial port"; yes, but what are the
values of the parameters I have to set to be compatible with the
ARMmite ? Obviously I can control the baud rate the ARMmite transmits
at explicitly, and presumably a 16 bit number is transmitted as 2 x 8
bit numbers (no. of data bits), but what about parity, stop bits and
other controls ? What does the ARMmite use for these ?

EdC
27.February.2009

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Tue Dec 04, 2012 3:55 pm

> Obviously I can control the baud rate the ARMmite transmits
> at explicitly, and presumably a 16 bit number is transmitted as 2 x 8
> bit numbers (no. of data bits), but what about parity, stop bits and
> other controls ? What does the ARMmite use for these ?

The ARMmite uses 19.2 Kb, 8 bits data, no parity, 1 stop bit (pretty
common) I'll add that to the Help page

when you PRINT 12345

<$31> <$32> <$33> <$34> <$35> <$d> <$a>

is sent out ASCII for 1 2 3 4 5 <cr> <lf>

when you PRINT chr (12345 >> 8); chr (12345) ;

<$30> <$39>

is sent out, 2 hex bytes ( ; eliminates cr/lf )

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Tue Dec 04, 2012 3:55 pm

Thanks for clarifying the details. I looked up on the windows device
manager these details, ad despite my not having alered the defaults
(and having read somewhere that is 19200 baud), it told me the baud
rate was 9600 ??

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Wed Feb 13, 2013 1:02 am

Hi

I'm having lots of issues trying to build some hardware that would make my
handicapped wife life a little easier. My wife breeds and sells tropical fish
and was looking to automate the process of changing water in 8 very large fish
tank filter systems. I need the Pro Plus to be able to communicate with a Wyse
50/60 dumb terminal using a three wire interface (RDX TDX GND). I have written
similar code for the basic stamp 2 10 years ago. It seems very confusing to me
how the serial instructions work. I need to transmit and receive strings (a
menu) and test using if statements input variables from the Wyse based on
changing water conditions.



Here is what I am looking for:

Serial IO UART 1 Pins 64 and 65
Must be able to send strings to Wyse
Must be able to compare inputted data using IF statements

Also need to know why the RTC on the PRO+ does not do real time keeping

Using the following:
DATE
HOUR
MINUTES
SECONDS
WEEKDAY

Once set as per the examples the RTC fails to update even thou connected to
constant power am I missing a daughter board?

Any help with Serial IO and examples to learn/ copy would be greatly
appreciated.


Thank You
Richard

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Wed Feb 13, 2013 1:03 am

My first comment is that I suppose the Wyse is RS232. You will need an
interface to level shift the 3.3 V TTL compatable signals to TTL levels. Â
Something like this http://www.futurlec.com/Mini_RS232_TTL_3V.shtml ought to
work.

RS232 is sometimes tricky to get to work even at normal levels.

I can't answer the question as whether inversion is necessary. Most of the TTL
to Rs232 converters should work out of the box.

Note the RC issues here:
http://www.coridiumcorp.com/ARMhelp/ind ... rPins.html

As I understand it, you will need to load the part specific library
(LPC17xx.bas) and the SERIAL library (SERIAL.bas) to have any hope of getting
things to work.

You have to load the part specific library + any libraries that you intend to
use. RTC17.bas would be appropriate for the 17xx series parts.

Correct me if I'm wrong guys.

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: RS232 interface

Post by YahooArchive » Wed Feb 13, 2013 1:07 am

> My first comment is that I suppose the Wyse is RS232. You will need an
interface to level shift the 3.3 V TTL compatable signals to TTL levels. Â
Something like this http://www.futurlec.com/Mini_RS232_TTL_3V.shtml ought to
work.

Yes an old dumb terminal is expecting RS-232 levels, not TTL and they are
inverted. So you'll need some sort of level translator, SparkFun has one based
on transistors, probably others out there. The BASICstamp as well as our
ARMexpress has RS-232 translators on UART0. But as RS-232 is going the way of
the dodo bird, USB or TTL serial is far more common.

SERIAL.bas is ONLY for bit-banged routines. The PROplus has 4 UARTs so if it
has firmware 8.12 or later they are all accessable thru BAUD(x),RXD(x) and
TXD(x).

But the PROplus does not have the 32 KHz oscillator (that is loaded on the
SuperPRO), so if you need RTC functions you would need a SuperPRO or to add the
crystal and the bias caps.

>I have written similar code for the basic stamp 2 10 years ago. It seems very
confusing to me how the serial instructions work. I need to transmit and
receive strings (a menu) and test using if statements input variables from the
Wyse based on changing water conditions.

Did you look at the sample code in

http://www.coridiumcorp.com/forum/viewt ... ?f=4&t=513

It sends and receives strings from any of the UARTs

Post Reply