Minimalist RS232 on Cyclone

A

Andrew Steer

Guest
Hi,

I'm new to this newsgroup, and also a relative FPGA newbie (though have
lots of hardware and software experince). If I should need the FAQ,
please kindly point me in the right direction.

I would like to implement a minimal RS232 interface on my Cyclone
device. I only require TxD and RxD signals (I've got an RS232 level-
shifter IC on board). I only require a bare-bones implementation as I
need to communicate merely sufficient data to configure up to 16 8-bit
registers on my Cyclone chip. Flow-control / buffer overruns should not
be an issue.

It would be nice to have a terminal-like behaviour from the Cyclone
(and enter commands like "R13:240" to set register 13 to value 240). A
terse (and technically simpler) command structure such as "0af8[enter]"
meaning: "set register 0x0a to 0xf8" would be perfectly adequate for
the time being.

What is the best way to implement this function? Is there code I can
download from the website?

I'm using the Quartus II software, and using a mixture of Graphical
(Block) Design Files and AHDL.
My present application does not require or use any Nios core.

I see downloadable UARTs on the site, but they are far more fully-
functioned than I need, and apparently require licensing, which seems
far too complicated and involved for a one-off project.


Thanks for any suggestion,

Andrew


SPAMTRAP: Please be sure to de-munge address if replying by email.
 
MiniUART is available from opencores. I've modified it to make even
"lighter" but it should exactly satisfy your needs.
 
It would be nice to have a terminal-like behaviour from the Cyclone
(and enter commands like "R13:240" to set register 13 to value 240). A
terse (and technically simpler) command structure such as "0af8[enter]"
meaning: "set register 0x0a to 0xf8" would be perfectly adequate for
the time being.
That's not really terse. You have to do the ascii/hex
to binary conversions. Of course, that's just software.

If you use 8 bits with parity, you really have 9 bits. You
could use the 9th bit as a command flag. You could probably
do it all in hardware if that was interesting. Might be handy
in the real early bringup stages. If you have fewer than 256
registers you could use a bit (in command mode) as a read/write
flag and get it to send back register contents.

--
The suespammers.org mail server is located in California. So are all my
other mailboxes. Please do not send unsolicited bulk e-mail or unsolicited
commercial e-mail to my suespammers.org address or any of my other addresses.
These are my opinions, not necessarily my employer's. I hate spam.
 
You can check here
http://www.fpga4fun.com/SerialInterface.html
for some simple sample code on how to make a minimal serial interface.

"Andrew Steer" <andrew.steerATphilips.com@dev.null> wrote in message
news:3FA26B56.8A5EBF5@dev.null...
Hi,

I'm new to this newsgroup, and also a relative FPGA newbie (though have
lots of hardware and software experince). If I should need the FAQ,
please kindly point me in the right direction.

I would like to implement a minimal RS232 interface on my Cyclone
device. I only require TxD and RxD signals (I've got an RS232 level-
shifter IC on board). I only require a bare-bones implementation as I
need to communicate merely sufficient data to configure up to 16 8-bit
registers on my Cyclone chip. Flow-control / buffer overruns should not
be an issue.

It would be nice to have a terminal-like behaviour from the Cyclone
(and enter commands like "R13:240" to set register 13 to value 240). A
terse (and technically simpler) command structure such as "0af8[enter]"
meaning: "set register 0x0a to 0xf8" would be perfectly adequate for
the time being.

What is the best way to implement this function? Is there code I can
download from the website?

I'm using the Quartus II software, and using a mixture of Graphical
(Block) Design Files and AHDL.
My present application does not require or use any Nios core.

I see downloadable UARTs on the site, but they are far more fully-
functioned than I need, and apparently require licensing, which seems
far too complicated and involved for a one-off project.


Thanks for any suggestion,

Andrew


SPAMTRAP: Please be sure to de-munge address if replying by email.
 
Andrew Steer wrote:
snip
It would be nice to have a terminal-like behaviour from the Cyclone
(and enter commands like "R13:240" to set register 13 to value 240). A
terse (and technically simpler) command structure such as "0af8[enter]"
meaning: "set register 0x0a to 0xf8" would be perfectly adequate for
the time being.
The simplest would be to use more of the ASCII table,
( which comes for free) and use something like letters
'A..T' as SetAddressPointer and 'X' and 'Y' as read/write tags,
then numbers in std HEX (opposite case to the AdrPtr).
That way message parsing is much simpler, and very simple state
engines/storage can do the job. Syntax is a little RPN :

Rules :
'0..9,a..f' : DBUf <- (DBuf x 16) + HexVal[RxChar]
( ie always send two nibbles )

'A..T' : Adr <- AdrVal[RxChar]
( or can use a single char, 'P' to Adr <- DBuf )

'W' : Regs[Adr] <- DBuf
'X' : Regs[Adr] <- DBuf Adr++
'Y' : TBuf <- Regs[Adr]
'Z' : TBuf <- Regs[Adr] Adr++

typical strings
B33WZ55WZaaWZ
loads 33.55.aa into [1][2][3], and reads-back their contents while
loading.
A00XXXXXXXXXXXXXXX clears all regs to 00.

-- etc --

-jg
 

Welcome to EDABoard.com

Sponsor

Back
Top