USB TTL RS232

From Hamsterworks Wiki!

Jump to: navigation, search

This FPGA Project was completed in March 2013.

This must be the easiest Papilio Project ever - use you FPGA board as a USB to 3.3V TTL RS232 adapter.

I've got a pcDuino and sometimes it is nice to have access to the serial console. Although you wouldn't want to dedicate a board to it it is perfect for occasional use. As a bonus, due to the flexibility of the FPGA's I/O pins you can use it for multiple different I/O standards and voltages - If you change to IOSTANDARDs and maybe the Vco jumper you have also got yourself 2.5V or 1.2V CMOS to USB adapter!

PcDuino console.jpg

As coded below, A0 is the input (RX) and A1 is the output (TX). Just remember to also connect up the GND wire too!

Source code

rs232_passthrough.vhd

----------------------------------------------------------
-- rs232_passthrough.vhd : Just connecting the USB serial 
--                         interface to the outside world
--
-- Author: Mike Field <hamster@snap.net.nz>
--

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity RS232_passthrough is
    Port ( usb_tx : out  STD_LOGIC;
           usb_rx : in  STD_LOGIC;
           ttl_tx : out  STD_LOGIC;
           ttl_rx : in  STD_LOGIC);
end RS232_passthrough;

architecture Behavioral of RS232_passthrough is
begin
  usb_tx <= ttl_rx;
  ttl_tx <= usb_rx;
end Behavioral;

rs232_passthrough.ucf

NET "usb_rx"  LOC = "P88" | IOSTANDARD = LVTTL ;                           # USB interface - Input
NET "usb_tx"  LOC = "P90" | IOSTANDARD = LVTTL | DRIVE = 4 | SLEW = SLOW ; # USB interface - Output

NET "ttl_rx"  LOC = "P18" | IOSTANDARD = LVTTL ;                           # Wing A Pin 0 - Input
NET "ttl_tx"  LOC = "P23" | IOSTANDARD = LVTTL | DRIVE = 4 | SLEW = SLOW ; # Wing A Pin 1 - Output

Personal tools