Posts tagged xilinx

Posted 3 months ago

Son of ‘9572 is alive

A good night’s rest didn’t help the ‘9572. It remains destroyed. After talking it over with a few people, I believe any of the following is possible:

  1. It was close to death already from having powered it from 5 volts for so long, and it simply gave out.
  2. I was careless with a logic probe pin and briefly touched two opposing outputs.
  3. While juggling pins on the UCF, I uploaded a new program that caused Possibility #2 to happen. I don’t think this was the case, because I think I would have noticed it when I rearranged the pins.
  4. Or the chip just died, maybe from ESD, maybe from cosmic rays. It does happen.

No matter what the cause, I don’t think it was the VHDL, and I don’t think it was a currently-held misunderstanding on my part. So I’m back in the saddle with one of the Dorkbot PCBs.

As you can see, the latch clock is tied to the 1MHz Q clock. I managed to flick the latch button for less than a millionth of a second during the clock’s rising edge (it doesn’t look right on this graph, but I think this is sample error or else a difference in opinion between the Saleae and the ‘9572 about when the level fell again). The high value is latched into D0 on the next rising edge, then it’s shifted to D1 as D0 obtains the new low value, then it goes from D1 to D2, etc. Then about 21 clocks after that, we see it shift through A15. If I had more probe pins, we would have been able to see it go all the way from D0-D7, then A0-A15.

There is a bug in this code. The shift into D0 doesn’t happen until the rising edge after the one that should have latched it in. I will investigate. (Update: that was easy. I changed the REGISTER_TEMP vector from a signal to a variable so that it was evaluated in the order of the statements in the process block. There’s probably a better way.)

Posted 3 months ago

The ‘9572 is dead

I killed my CPLD Breakout Board. While taking pictures of the “successful” SRAM-loading VHDL I’d written and wired up, I noticed that the power LED on the board was off. I checked the connections, toggled the power a few times, tried re-running the logic analyzer, and eventually concluded that the board was dead. It draws 1.4 amps when I plug it in, and the CPLD itself gets pretty hot. As far as I can tell, everything else on the board is working (except for the power LED, which now appears to be inert).

Here’s my VHDL:

architecture Behavioral of SRAM_LOADER is
  signal REGISTER_TEMP : STD_LOGIC_VECTOR(23 downto 0);
begin
  process (CLK)
  begin
    if (rising_edge(CLK)) then
      REGISTER_TEMP <= REGISTER_TEMP(22 downto 0) & LATCH;
      if OE = '1' then
        ADDRESS <= REGISTER_TEMP(23 downto 8);
        DATA <= REGISTER_TEMP(7 downto 0);
      else
        ADDRESS <= "ZZZZZZZZZZZZZZZZ";
        DATA <= "ZZZZZZZZ";
      end if;
    end if;
  end process;
end Behavioral;

I think the tri-stated address and data pins are the problem. None of them were connected to anything (except four data pins hooked to my logic analyzer). But I’m not at all sure why that would be a problem. The only reason I think it’s related is that one of the last things I did was testing OE disabled (grounded), but it wasn’t the last thing (which was one more OE-high run to take a picture of the registers shifting), so even that evidence is questionable. If I’d obviously shorted something external to the chip, then I doubt I’d have been able to spend the half-hour or so when I successfully tested it. That’s why I believe I did something wrong with the tri-stating.

If you know a way that one could destroy an XC9572XL CPLD by programming it incorrectly, I’d appreciate a tip. 

Posted 3 months ago

My goodness I’d forgotten how hard it is to solder surface-mount devices. But I did it, and one of three XC9572XL breakout boards is working. Rehash of experience in approximate order of occurrence:

  • Wanted to work on a different, software project tonight, but the boards arrived in the mail and they were so purple that I had to work on them right away.
  • I don’t understand how any SMD component could be smaller than 0603. Seriously, they make 0204, but 0603 almost floats if I breathe in the same room as it.
  • Dangerous Prototypes, you’re good guys and all, but did you really put the three inline LEDs in different polarities? I burned up one and reworked four in the process of figuring that out.
  • Despite triple-checking, I put the 10K resistors where the 2Ks go. More rework.
  • To remove solder bridges from gull-wing QFP leads, clean the tip, flux the heck out of the bridge, and press gently on it. Bam! Ready to ship.
  • Did I say flux? Yes, flux is totally, utterly awesome for making solder just do the right thing.
  • Your CPLD breakout board will kinda sorta accept an XSVF if the 3.3-volt IO jumper is off. In fact, the kinda sorta acceptance is exactly the same as if you’d done a cold solder joint here or there, or maybe shorted a capacitor, or left some conductive flux on the board, or…. Anyway, after ruling all those things out you’ll try the jumper and find that it programs perfectly well.

I’ll finish the other two some other time. Right now, I’m so happy this first one works!

Posted 4 months ago

5.0 != 3.3

I just realized that the XC9572XL’s “5-volt tolerant I/O pins” do not mean that the device itself can be powered with 5 volts. It’s a 3.3-volt device. I’ve been running it from the Arduino’s 5-volt supply.

Sigh.

With this newly understood information, I hope to discover that the JTAG Whisperer is working correctly, and that the incorrect voltage was preventing the CPLD from programming itself. Other possibilities are (1) my code is still buggy but the CPLD is happy to be finally running at the right voltage, and (2) I’ve fried my poor little ‘9572.

Posted 4 months ago

JTAG TCK: active-low?

Why does it seem like the JTAG clock signal is active low? Consider this snippet from Xilinx’s XAPP058 source code.

/* toggle tck LH.  No need to modify this code.  It is output via setPort. */
void pulseClock()
{
    setPort(TCK,0);  /* set the TCK port to low  */
    setPort(TCK,1);  /* set the TCK port to high */
}

This means that when the clock isn’t being pulsed, it’s high. Right? If so, why don’t any descriptions of JTAG’s electrical characteristics say it’s active low?

Posted 4 months ago

The JTAG Whisperer

Available here on GitHub. The JTAG Whisperer turns your Arduino into a JTAG cable. Wow, sounds great! Here are the caveats:

  • It’s actually just an XSVF player. This is a tiny subset of what JTAG does. The current architecture has the desktop load the XSVF file, then send it over serial to the Arduino. Since serial is going to be limited to the kilobits-per-second range of speed, it’s unlikely it’ll be suitable for more ambitious interactive JTAG operations. But it’d be interesting to see what could be accomplished with the newer Arduinos that have replaced the FTDI chip with the more flexible ATmega U-series chips.
  • It has been tested only on a Xilinx XC9572XL breakout board from Dangerous Prototypes, and the only function it has performed so far is asking the chip its device ID (spoiler: it’s 0xf9604093). I would have happily used the Bus Pirate’s XSVF Player firmware, but it hasn’t yet been ported to my BPv4 hardware, and I wasn’t willing to invest in learning PIC development.
  • It doesn’t work very well yet. The serial communication between the desktop and the PC frequently gets logjammed, and the Arduino sometimes has to ask repeatedly for the ID.

I have high hopes for this project. Its immediate use will be to program the ‘9572 so that I can start experimenting with replacing discrete logic 74xx chips. Eventually I hope it’ll become a robust, reliable XSVF player for the Arduino.

Please give it a try. I look forward to your pull requests!

Posted 4 months ago

Linux on Nexys2?

All the search results for [linux nexys2] discuss how the heck you run that djtgtgtgjdsasdfghjkcfg Digilent tool on Linux. In other words, how do you program the Nexys2 on Linux?

But what would it take to run Linux on the Nexys2, or a similar medium-sized FPGA? Can you just download an http://opencores.org/ processor that has a gcc toolchain for it, throw in some I/O controllers, and get the kernel booted up? I am so new to FPGA that I can’t even do a back-of-the-envelope calculation whether a Linux-capable core, plus glue, would fit. But it would be a fun project to find out!

Posted 4 months ago

Found a good base for an XSVF player

Small world. Ben over at the Papilio Forums had almost the same needs as mine: wants to program an XC9572XL, prefers not to buy overpriced, single-purpose cables. So he adapted the XAPP058 reference code to a Papilio, cleverly using the desktop machine as a conduit between the potentially large xsvf file and the firmware.

I didn’t try to get Ben’s code running on the Papilio, because I have a different strategy in mind. I have ported the device portion to the Arduino, and I’m going to rewrite the tiny C-based desktop client in Python. It would be odd for someone to have a CPLD but not have an Arduino within arm’s reach, and while every hobbyist should have a Papilio (hi Jack!), it’s less common. As for the command-line tool, it’s straightforward I/O, which means Python’s the perfect choice to get Mac/Windows/Linux/wristwatch support for free. Last night I got the Arduino communicating with the C client just enough for the Arduino to start sending debug messages telling me it was very confused about its purpose in life. Tonight I hope to get it able to program something on the ‘9572, and then I’ll have a known-good toolchain against which to develop the Python client.

Just a bit of pontificating about using the right tool for the job. It makes me sad when projects with a cross-platform audience use .BAT files, and it makes me sad any time I see C/C++ where cycle-for-cycle performance isn’t an issue. For shell scripts, use Bash. Install Cygwin if your favorite OS is one of the… one that doesn’t know Bash. And for pretty much every other desktop tool you can think of, consider Python rather than C. People reflexively think of C as the go-to language for portability, but at the tool level where you care more about how to open a nonblocking serial port rather than the endianness of an int, Python remains portable where C starts spewing out #ifdefs.

Anyway, back to the topic. When this project is done, any maker will be able to program a Xilinx CPLD with the hardware and OS he or she already has. No more ridiculous $50 cables.

Posted 4 months ago

Arduino XSVF Player?

I want to program a Xilinx XC9572XL and refuse to buy a $50 dongle to do so. Keywords in my research so far: xapp058, XSVF, SVF, JTAG, arduiggler. There is an FT232-based version that seems very close to what I want, but it’s written in Visual Basic, of all things, and probably won’t work on a modern non-FTDI Arduino.

If you’re reading this and do contract programming in exchange for karma, please write it in Python to avoid cross-platform issues!