Papilio

From Tech
Jump to navigationJump to search

Hello World VHDL

A Blinking LED:

entity LEDtest is
  port (
    clk: in bit;
    LED1: out bit;
    LED2: out bit
  );
end LEDtest;

architecture BEHAVIOUR of LEDtest is
  signal count: integer range 0 to 16777215;
  signal tmp:bit:='0';
begin
  IN_process: process (clk)
    begin
      if clk'event and clk = '1' then
        count<=count+1;
	if count=16777215 then
	  count<=0;
	  tmp<=not tmp;
	  LED1<=tmp;
	  LED2<=not tmp;
	end if;  
      end if;
    end process;
end BEHAVIOUR;

With the following constraints file:

# Crystal Clock - use 32MHz onboard oscillator
NET "clk" LOC = "P89" | IOSTANDARD = LVCMOS25 | PERIOD = 31.25ns ;

# Wing1 Column A
NET "LED1" LOC = "P91";	
NET "LED2" LOC = "P92";

Use xc3prog to send to FPGA:

#just once (erased on reboot):
sudo ./xc3sprog -c papilio ~/VHDL/LEDTest/LEDtest.bit  -v

#or use FTDI & FLASH to make non-volatile:
sudo ./xc3sprog -c papilio -I../bscan_spi/bscan_spi_xc3s500e_papilio.bit ~/VHDL/LEDTest/LEDtest.bit  -v -R

Or, via my raspberry pi:

f=LEDtest.bit ; scp $f pi:/tmp; ssh pi "sudo /home/joostje/debian/papilio/Papilio-Loader/xc3sprog/trunk/build/xc3sprog -c papilio  /tmp/$f -v"
#
f=LEDtest.bit ; scp $f pi:/tmp; ssh pi "sudo /home/joostje/debian/papilio/Papilio-Loader/xc3sprog/trunk/build/xc3sprog -c papilio  -I../bscan_spi/bscan_spi_xc3s500e_papilio.bit /tmp/$f -v -R"

Compiling xc3prog

(This is the GadgetFactory fork of Xc3sprog, for the official version, see Xc3sprog) Tested on Ubuntu 13.04 (beta) and raspberry Pi (raspbian)

sudo aptitude install libftdi-dev libusb-1.0-0-dev cmake
git clone git://github.com/GadgetFactory/Papilio-Loader.git
cd Papilio-Loader/xc3sprog/trunk
mkdir build
cd build
cmake ..
make
sudo ./xc3sprog -c papilio ~/VHDL/AWGprovo/mem2.bit -v

dmesg on inserting:

[48531.284590] usb 1-1.4: new full-speed USB device number 4 using ehci-pci
[48531.379349] usb 1-1.4: New USB device found, idVendor=0403, idProduct=6010
[48531.379359] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[48531.379365] usb 1-1.4: Product: Dual RS232
[48531.379369] usb 1-1.4: Manufacturer: FTDI
[48531.450715] usbcore: registered new interface driver usbserial
[48531.450731] usbcore: registered new interface driver usbserial_generic
[48531.450741] usbserial: USB Serial support registered for generic
[48531.475289] usbcore: registered new interface driver ftdi_sio
[48531.475397] usbserial: USB Serial support registered for FTDI USB Serial Device
[48531.475516] ftdi_sio 1-1.4:1.0: FTDI USB Serial Device converter detected
[48531.475578] usb 1-1.4: Detected FT2232C
[48531.475581] usb 1-1.4: Number of endpoints 2
[48531.475583] usb 1-1.4: Endpoint 1 MaxPacketSize 64
[48531.475585] usb 1-1.4: Endpoint 2 MaxPacketSize 64
[48531.475587] usb 1-1.4: Setting MaxPacketSize 64
[48531.477586] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
[48531.477611] ftdi_sio 1-1.4:1.1: FTDI USB Serial Device converter detected
[48531.477670] usb 1-1.4: Detected FT2232C
[48531.477672] usb 1-1.4: Number of endpoints 2
[48531.477675] usb 1-1.4: Endpoint 1 MaxPacketSize 64
[48531.477677] usb 1-1.4: Endpoint 2 MaxPacketSize 64
[48531.477679] usb 1-1.4: Setting MaxPacketSize 64
[48531.478467] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB1

About the clocks

Errors when programming using low-powerd devices

When using my Raspberry Pi to program papilio, these errors appear when the papilio board needs to give too much power to other devices, for instance the DX TM1638 Display:

$ xc3sprog -c papilio  /tmp/$f -v
design_top.bit                                            100%  277KB 277.2KB/s   00:00    
XC3SPROG (c) 2004-2011 xc3sprog project $Rev: 691 $ OS: Linux
Free software: If you contribute nothing, expect nothing!
Feedback on success/failure/enhancement requests:
	http://sourceforge.net/mail/?group_id=170565 
Check Sourceforge for updates:
	http://sourceforge.net/projects/xc3sprog/develop

Using built-in device list
Using built-in cable list
Cable papilio type ftdi VID 0x0403 PID 0x6010 dbus data 00 enable 0b cbus data 00 data 00
Could not open FTDI device (using libftdi): device not found
Unable to access FTDI device with either libftdi or FTD2XX

Apparently the FTDI232 disconnects when the power goes too low.

Components

  • FPGA markings: Xilinx \n Spartan \n XC3S500E ^TM \n VQ0100DGQ1213 \n D3236398A \n 4C
  • 32MHz clock markings: CETECJ \n 32.000 \n @ <T> 116
  • USB<->RS232 converter markings: FTDI \n FT2232D \n 207 -1, Datasheet
  • FTDI crystal markings: <T> 6.0000
  • Power Converter: AMS 1117 \n 1.2 HT1206
  • Power Converter: AMS 1117 \n 2.5 HT 1218
  • Power Converter: AMS 1117 \n 3.3 HT 226E
  • Power Converter: AMS 1117 \n 5.0 HT ????
  • 6-pin IC close to FTDI: 1TET, in schematic: 93LC46B
  • 8-pin flash IC: ?, in schematic: FLASH-SPI-25XXSMD1 (FLASH-SPI-25XX), maybe this one, Xilinx info on the chip: Configuring Xilinx FPGAs with SPI Serial Flash

See Also