I wanted to use the Channel B from the FT2232H for serial communication with my Waxwing Spartan 6 FPGA Board. But I can only found the following definitions in the ucf file: Code: NET "RXF" LOC = "V13" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ; NET "TXE" LOC = "U13" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ; NET "RD" LOC = "V15" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ; NET "WR" LOC = "U15" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ; NET "SIWUA" LOC = "T17" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ; But these definitions seem to be for parallel communication. Could somebody tell me the definitions for serial communication? I only found them for the Saturn board and the Saturn uses the same FT2232H chip, so I guess it would be possible for the Waxwing Board too Thanks Markus
Hello Markus, Indeed Waxwing is very similar to Saturn. For using UART serial on channel B of FT2232, you need to use these pins: Pin "N11" will be your serial "RXD" pin (data going into FPGA) and pin "M11" will be your "TXD" (data trasnmitted from FPGA)
Thanks for the fast reply But I still have trouble implementing the serial communication. I haven't tried RX yet, but when I try to transmit a byte from the FPGA to my PC I do not get the right result. Here's the code I'm using: Code: library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity uart is port( I_Clk : in std_logic; TX : out std_logic; RX : in std_logic ); end uart; architecture uart_behav of uart is type tx_state_t is (idle, active); signal test_count : integer range 0 to 9 := 0; signal index : integer range 0 to 7 := 0; signal tx_clk : std_logic := '0'; signal tx_count : integer := 0; signal tx_state : tx_state_t := idle; signal baudrate : std_logic_vector(15 downto 0) := X"28B0"; -- 9600bps @ 100Mhz begin tx_clk_gen : process(I_Clk) begin if rising_edge(I_Clk) then if tx_count = 0 then -- Chop off LSB to get a clock tx_count <= to_integer(unsigned(baudrate(15 downto 1))); tx_clk <= not tx_clk; else tx_count <= tx_count - 1; end if; end if; end process; tx_proc : process(tx_clk) begin if rising_edge(tx_clk) then case tx_state is when idle => TX <= '1'; tx_state <= active; when active => if test_count = 0 then -- Start Bit TX <= '0'; test_count <= test_count + 1; elsif test_count = 9 then -- Stop Bit TX <= '1'; else -- Data Bit (send all 0's) TX <= '0'; test_count <= test_count + 1; end if; end case; end if; end process; end uart_behav; This should result in 0x00 to be sent to the receiver. But this is the result I get: Code: 000022.394 RX 0000 F9 I get 0xF9 back...I don't know what I'm doing wrong, but here's the python script I use to receive over the serial port(btw im running Linux): Code: #!/usr/bin/env python3 """ Serial communication """ import time import serial # baudrate = 1500000 # 1.5Mbit/s # baudrate = 12000000 # 12Mbit/s # One byte takes 10 bits so 10Mbit/s may almost equal 1.0MByte/s. ser = serial.serial_for_url("spy:///dev/ttyUSB1?file=test.txt", timeout=1, baudrate=9600) time.sleep(1) msg = "" value = None error = 0 while True: value = ser.read() try: msg += value.decode("ascii") print(msg[-1], end="", flush=True) except: pass print("\n") EDIT: Is there anything else I need to configure for the chip to work with my linux box? EDIT2: My ucf file: Code: CONFIG VCCAUX = "3.3" ; NET "I_Clk" LOC = V10 | IOSTANDARD = LVCMOS33 | PERIOD = 100MHz; NET "RX" LOC = N11 | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8; NET "TX" LOC = M11 | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8; EDIT3: Update: So whatever value I choose to send over the UART looks fine in the simulation but even when I continously sent bytes to my PC (in a loop) only one byte is received and that is 0xF9. So I do think that the configuration of either my driver (using libftdi) or the chip is wrong. I did saw an article on how to change the configuration of the FTDI chip for the Saturn device on Windows(which seems to be what I need for my Waxwing board aswell), but have not found an equalivent for linux and I also do not have any windows box available right now to change the config.
Hello Markus, Unfortunately FTDI provides FT_Prog executable only for Windows for configuring the FT2232 chip. We have not tried configuring with Linux, though it may not be impossible. For UART rx and tx, I would suggest to try a simple loopback test initially. Just connecting 'tx' with 'rx' in the verilog combinationally would do the trick. So whatever is sent from the host PC will be echoed back. It would confirm if it is chip/driver issue or code issue. Thanks!
I finally got access to a windows box to check the config of the FTDI chip. I changed the config for channel B to RS232 UART and switched back to my linux box and it worked perfectly! Thanks for the great help!