1
\$\begingroup\$

I'm currently working on a project about I/O with FPGA. I am using TTL-232R-3v3 cable for serial communication between my laptop and DE0-nano. I want to know if it is possible to send a signal on RX wire to FPGA and light up LEDs with that signal or is UART needed?

Any advice or guidance would be greatly appreciated, thanks for your time.

edit-

I'm using usb cable for power supply and I'm using only RX, TX and GND wires of TTL cable. Here's my clash code

module Blinker where

import CLaSH.Prelude

{-# ANN topEntity
  (defTop
    { t_name     = "blinker"
    , t_inputs   = ["GPIO_IN"]
    , t_outputs  = ["LED"]
    , t_extraIn  = [ ("CLOCK_50", 1)
                   , ("KEY0"    , 1)
                   ]
    , t_clocks   = [ (altpll "altpll50"
                             "CLOCK_50(0)"
                             "not KEY0(0)")
                   ]
    }) #-}
topEntity :: Signal Bit -> Signal (BitVector 8)
topEntity gpio_in = mealy blinkerT 0 gpio_in
blinkerT :: Int -> Bit -> (Int,BitVector 8)
blinkerT a bit = (a,pack bits)
    where bits = repeat $ bit == high   
\$\endgroup\$
  • 1
    \$\begingroup\$ Do you want to send a character from PC to the FPGA 3.3 V tolerant input pin via the cable? FPGA should decode the data byte and turn on LEDs? It will be semi implementation of UART then. If you just need to play with LED and IO, to start with, configure FPGA to toggle LED for every falling edge on its input pin. Send a zero as data from the PC via any serial terminal application. This way you can evade serial UART implementation, but I doubt, this is not what you need. Because, this doesn't find any use at least from my point if view. \$\endgroup\$ – Umar Jan 17 '17 at 16:30
  • \$\begingroup\$ Hi Umar thanks for your comment. For now, I'm just interested in light up LEDs for testing. I don't know much about electronics I'm interested in software side. I just want to send 2 signals for blinking LEDs and I don't know VHDL. We are using Clash for that but I'm new to that. \$\endgroup\$ – Ismail Jan 18 '17 at 20:49
1
\$\begingroup\$

Serial port communications idle high (1). If this is hooked up directly to the FPGA and routed to an LED without a logical inversion you will see the LED light up (assuming proper voltages and current drive). To turn the led (mostly) off you can send a binary 0x0000_0000 constantly via the serial port and the led should dim or turn off. As long as the baud rate is sufficiently low that the PC program can saturate the link you will be sending mostly 0's with the exception of the protocol mandated stop bit.

That said simple serial port examples are common on the web and should be easy to implement.

\$\endgroup\$
  • \$\begingroup\$ Thank you, David. I was thinking about this may be the problem. I will let you know about results after customizing my code. \$\endgroup\$ – Ismail Jan 18 '17 at 22:03
1
\$\begingroup\$

Your adaptor cable connects to a USB port at one end and provides a UART-style serial port with LVTTL levels at the other. The cable converts USB communications into a UART serial port.

You will need to implement a UART core within your logic design for your FPGA. This will receive serial data from, and transmit serial data to, the UART in your cable.

Then you can drive the DE0-Nano LEDs and so on, just as you want to.

\$\endgroup\$
-1
\$\begingroup\$

This is the part of the Allegro Core. enter image description here enter image description here It would be redundant to duplicate answers that already exist on the web and this cannot be simplified to 1 page.

http://www.recontech.co.uk/index.php/tutorial/tutorial-1-a-serial-communication-fpga-debug-module/54-de0-nano-serial-communications-tutorial .

\$\endgroup\$
  • 1
    \$\begingroup\$ Please enhance your answer with explanations, otherwise it is difficult to understand. \$\endgroup\$ – Ariser Jan 18 '17 at 15:29
  • 1
    \$\begingroup\$ @Ariser Shall I copy the book needed to explain every detail? EE's ought to have the motivation and intelligence to find more details from keywords in the answer when it needs to be explained in step by steps or 7 layers of the OSI model. \$\endgroup\$ – Sunnyskyguy EE75 Jan 18 '17 at 17:11
  • 1
    \$\begingroup\$ I'm not EE and I know about that page but it's complicated for me. I'm trying to understand is it possible to achieve it without UART for testing purposes. \$\endgroup\$ – Ismail Jan 18 '17 at 21:15
  • 1
    \$\begingroup\$ yes Your PC and nano each have a UART and you have RS-232 cable. Next is Core library and setup, and exclude RTS/CTS if not using it,. ( do not check include) \$\endgroup\$ – Sunnyskyguy EE75 Jan 18 '17 at 21:30
  • 1
    \$\begingroup\$ +1 Sometimes, it is the answers which make OP think about their actual problem. \$\endgroup\$ – Umar Jan 19 '17 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.