ULX3S - Debian

back to ulx3s page.

links

Github ulx3s, ulx3s/quick-start, ulx3s/blink, fujprog, open-tool-forge/fpga-toolchain, ldoolitt/vhd2vl,

examples

emard/esp32ecp5, emard/fpg1, emard/jupiter_ace, emard/oberon, emard/ti99_2, emard/ulx3s-bin,

more examples

lawrie/jupiter_ace, lawrie/ulx3s_cpm_z80,

more links

Example Forth code, Easy Forth, MicroPython docs, Project Oberon,

video timing: Project F - Video Timings - VGA, SVGA, 720p, 1080p, TinyVGA - VGA Signal Timing, Video Timings Calculator,

local links

bb - kg-bsbox Debian,

History

2021-08-14: I re-created this page on my self-hosted web server.

2020-11-18: bb - sdb5 - kost/Minimig_ECS_binaries - 12F board - programmed Minimig_ECS_binaries/12F/Minimig_ECS_12F_32MB_SDRAM.bit and get a light blue display on my monitor, with Minimig text in white. Good.

2020-11-18: bb - sdb5 - emard/Minimig_ECS - makefiles (include/ulx3s.mk) are set up for Diamond, needs to be changed to work with yosys ++

2020-11-18: bb - sdb5 - emard/ulx3s-misc - using my 12F board, test examples/hex/oled_ssd1306_hex with a 0.96 inch OLED display connected to the ulx3s board, it works with the LCD driver (default). According to emard, the oled driver is old, and doesn't support ssd1306.

2020-11-12: bb - sdb5 - emard/oberon example - change so it has a PS/2 keyboard on US3 then build it. pull latest from git, then change pixel_clock_MHz to 65, like so:

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard/oberon/proj/lattice/ulx3s/ulx3s-v20$ grep "parameter pixel_clock_MHz" ../../../../hdl/top/ulx3s_v20_top.v
    parameter pixel_clock_MHz = 65; // 65 for 12F, 75 for 85F

but I still get a checkered "test" picture. I also tested with the bitstream from ulx3s-bin, like so

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard$ zcat ulx3s-bin/fpga/oberon/ulx3s_12f_oberon.bit.gz | fujprog
ULX2S / ULX3S JTAG programmer v4.6 (git 0a4cc36 built Jul 22 2020 20:50:14)
Copyright (C) Marko Zec, EMARD, gojimmypi, kost and contributors
Using USB cable: ULX3S FPGA 12K v3.0.8
Type, paste or pipe your bitstream.
Programming: 100% 
Completed in 2.48 seconds.

also gives a checkered "test" picture.

2020-11-12: bb - sdb5 - tested my homebuilt USB extension board with the 12F board, using bitstream from ulx3s-bin - fpga/usb/ulx3s_12f_usbhost_test.bit.gz, like this

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard$ zcat ulx3s-bin/fpga/usb/ulx3s_12f_usbhost_test.bit.gz |fujprog
ULX2S / ULX3S JTAG programmer v4.6 (git 0a4cc36 built Jul 22 2020 20:50:14)
Copyright (C) Marko Zec, EMARD, gojimmypi, kost and contributors
Using USB cable: ULX3S FPGA 12K v3.0.8
Type, paste or pipe your bitstream.
Programming: 100% 
Completed in 2.59 seconds.

tested both a mouse and a keyboard - result is both ports work.

2020-10-16: bb - sdb5 - I brought the 85F board to the office, so I can test with it. First I test the emard/oberon example. Build with

$ make FPGA_SIZE=85

program

$ make FPGA_SIZE=85 UJPROG=fujprog program

first try is with

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard/oberon/proj/lattice/ulx3s/ulx3s-v20$ grep "parameter pixel_clock_MHz" ../../../../hdl/top/ulx3s_v20_top.v
    parameter pixel_clock_MHz = 75; // 65 for 12F, 75 for 85F

this works, I get a picture, Oberon boots and I can use the mouse. Next try with

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard/oberon/proj/lattice/ulx3s/ulx3s-v20$ grep "parameter pixel_clock_MHz" ../../../../hdl/top/ulx3s_v20_top.v
    parameter pixel_clock_MHz = 65; // 65 for 12F, 75 for 85F

Oberon boots, I get a picture, but it is unstable - it "shivers" left / right and travels across the screen over time.

2020-10-15: bb - sdb5 - example lawrie/ulx3s_cpm_z80 - also works with monitor connected to GPDI and ps/2 keyboard connected to US2 on my 12F board.

2020-10-15: bb - sdb5 - tested the Micropython on the ESP32: via $ screen /dev/ttyUSB1 115200:

>>> help()
Welcome to MicroPython on the ESP32!

For generic online docs please visit http://docs.micropython.org/

For access to the hardware use the 'machine' module:

import machine
pin12 = machine.Pin(12, machine.Pin.OUT)
pin12.value(1)
pin13 = machine.Pin(13, machine.Pin.IN, machine.Pin.PULL_UP)
print(pin13.value())
i2c = machine.I2C(scl=machine.Pin(21), sda=machine.Pin(22))
i2c.scan()
i2c.writeto(addr, b'1234')
i2c.readfrom(addr, 4)

Basic WiFi configuration:

import network
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if.scan()                             # Scan for available access points
sta_if.connect("<AP_name>", "<password>") # Connect to an AP
sta_if.isconnected()                      # Check for successful connection

Control commands:
  CTRL-A        -- on a blank line, enter raw REPL mode
  CTRL-B        -- on a blank line, enter normal REPL mode
  CTRL-C        -- interrupt a running program
  CTRL-D        -- on a blank line, do a soft reset of the board
  CTRL-E        -- on a blank line, enter paste mode

For further help on a specific object, type help(obj)
For a list of available modules, type help('modules')
>>> import machine
>>> machine.freq()
160000000

this is with no bitstream loaded, just powered on the ULX3S 12F board.

2020-10-15: bb - sdb5 - example lawrie/ulx3s_cpm_z80 - make with

$ make DEVICE=12k
$ make DEVICE=12k prog

(after fixing the Makefile) writing the image to a microSD card

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/files/cpm_demo_disk$ unzip -p 'multicomp cpm demo disk image.zip' | sudo dd of=/dev/sdc bs=1M status=progress
[sudo] password for tingo:
180158464 bytes (180 MB, 172 MiB) copied, 2 s, 90.0 MB/s
0+3677 records in
0+3677 records out
246758400 bytes (247 MB, 235 MiB) copied, 70.4874 s, 3.5 MB/s

and booting the cp/m machine via serial console

$ screen /dev/ttyUSB1 115200

which gives

Press [SPACE] to activate console

CP/M Boot ROM 2.0 by G. Searle

BC or BW - ROM BASIC Cold/Warm
X        - Boot CP/M (load $D000-$FFFF)
:nnnn... - Load Intel-Hex file record
Gnnnn    - Run loc nnnn

>x
Boot CP/M?
Loading CP/M...

CP/M BIOS 2.0 by G. Searle 2013

CP/M 2.2 (c) 1979 by Digital Research

A>dir
A: DOWNLOAD COM : TEST     JNK : FILES    BAK : BGII134  ZIP
A: FILES    TXT
A>

good, so the SDcard works.

2020-10-15: bb - sdb5 - I also tried the 12F bitstream from kost/ulx3s-oberon - I still get the oberon test picture.

2020-10-15: bb - sdb5 - example emard/oberon - with latest fixes (git pull) and

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard/oberon/proj/lattice/ulx3s/ulx3s-v20$ grep "parameter pixel_clock_MHz" ../../../../hdl/top/ulx3s_v20_top.v
    parameter pixel_clock_MHz = 65; // 65 for 12F, 75 for 85F
$ make
$ make UJPROG=fujprog program

unfortunately, I get a checkered picture. Hmm, perhaps the (micro) SDcard isn't right? Try with 75

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard/oberon/proj/lattice/ulx3s/ulx3s-v20$ grep "parameter pixel_clock_MHz" ../../../../hdl/top/ulx3s_v20_top.v
    parameter pixel_clock_MHz = 75; // 65 for 12F, 75 for 85F

I get a checkered image if I boot without microSD card inserted. And the same picture with microSD card inserted. Try to write the SDcard again

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/files/oberon$ sudo dd if=./RISC.img of=/dev/sdc bs=1M status=progress
256+1 records in
256+1 records out
268865536 bytes (269 MB, 256 MiB) copied, 75.7381 s, 3.5 MB/s

parted thinks

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/files/oberon$ sudo parted /dev/sdc print
Model: Generic- SD/MMC (scsi)
Disk /dev/sdc: 998MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size    Type     File system  Flags
 1      1049kB  268MB  267MB   primary  fat16        boot
 2      268MB   336MB  67.1MB  primary

disktype thinks

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/files/oberon$ sudo disktype /dev/sdc

--- /dev/sdc
Block device, size 952 MiB (998244352 bytes)
DOS/MBR partition map
Partition 1: 255 MiB (267386880 bytes, 522240 sectors from 2048, bootable)
  Type 0x06 (FAT16)
  FAT16 file system (hints score 5 of 5)
    Volume size 254.7 MiB (267104256 bytes, 65211 clusters of 4 KiB)
Partition 2: 64 MiB (67108864 bytes, 131072 sectors from 524288)
  Type 0xFF (BBT)
  Blank disk/medium

ok. Hmm, re-writing the SDcard didn't have an effect.

2020-10-13: bb - sdb5 - example lawrie/jupiter_ace works, but the keyboard needs to be unplugged and plugged before it works. Also, the keyboard will soon start to "autoprint" a character, then nothing stops it. Make the example with

$ make DEVICE=12k
$ make DEVICE=12k prog

ok. The keyboard problem could either be voltage (port US2 is 3.3V, not 5V) or timing.

2020-10-13: bb - sdb5 - write a Oberon disk image to a 1GB microSD card:

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/files/oberon$ unzip -p RISCimg.zip | sudo dd of=/dev/sdc bs=1M status=progress
176226304 bytes (176 MB, 168 MiB) copied, 1 s, 176 MB/s
0+4031 records in
0+4031 records out
268865536 bytes (269 MB, 256 MiB) copied, 73.526 s, 3.7 MB/s

what does disktype think about it?

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/files/oberon$ sudo disktype /dev/sdc

--- /dev/sdc
Block device, size 952 MiB (998244352 bytes)
DOS/MBR partition map
Partition 1: 255 MiB (267386880 bytes, 522240 sectors from 2048, bootable)
  Type 0x06 (FAT16)
  FAT16 file system (hints score 5 of 5)
    Volume size 254.7 MiB (267104256 bytes, 65211 clusters of 4 KiB)
Partition 2: 64 MiB (67108864 bytes, 131072 sectors from 524288)
  Type 0xFF (BBT)
  Blank disk/medium

interesting.

2020-10-13: bb - sdb5 - example emard/oberon gives "out of range" on my monitor. Sometimes I get a checkered pattern, but most of the time I get the "out of range" message.

2020-10-10: bb - sdb5 - example emard/fpg1: HDMI monitor connected to GPDI output, a Trust keyboard connected via a female - female USB A adapter to a USB A to USB micro A cable connected to US2. But - the example needs more work, it fails here:

nextpnr-ecp5 --25k --json pdp1.json --lpf ../constraints/ulx3s_v20_segpdi.lpf --textcfg ulx3s_25f_pdp1.config
Warning: Use of default value for --package is deprecated. Please add '--package CABGA381' to arguments.
Info: constraining clock net 'clk_25mhz' to 25.00 MHz
[..]
ERROR: Max frequency for clock '$glbnet$clk_pixel': 52.30 MHz (FAIL at 75.00 MHz)
ERROR: Max frequency for clock '$glbnet$clk_shift': 248.82 MHz (FAIL at 375.09 MHz)

fix the package parameter, re-run. I still get those errors if I do 'make clean' first

ERROR: Max frequency for clock '$glbnet$clk_pixel': 52.30 MHz (FAIL at 75.00 MHz)
ERROR: Max frequency for clock '$glbnet$clk_shift': 248.82 MHz (FAIL at 375.09 MHz)

however, I can do 'make' again:

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard/fpg1/src/proj/lattice/ulx3s/universal_make$ make
LANG=C ecppack  --input ulx3s_25f_pdp1.config --bit ulx3s_25f_pdp1.bit

huh, will it work?

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/examples/emard/fpg1/src/proj/lattice/ulx3s/universal_make$ fujprog ulx3s_25f_pdp1.bit
ULX2S / ULX3S JTAG programmer v4.6 (git 0a4cc36 built Jul 22 2020 20:50:14)
Copyright (C) Marko Zec, EMARD, gojimmypi, kost and contributors
Using USB cable: ULX3S FPGA 12K v3.0.8

Found LFE5U-12F device, but the bitstream is for LFE5U-25F.

Failed.

nope.

2020-10-09: bb - sdb5 - the emard/jupiter_ace example: HDMI monitor connected to GPDI output, a Trust keyboard connected via a female - female USB A adapter to a USB A to USB micro A cable connected to US2. I get a static cursor on the screen, but no reaction from the keyboard. If I unplug / plug the keyboard, the three LEDS (caps lock, num lock, shift lock) lights up for a second.

2020-10-09: bb - sdb5 - the emard/ti99_2 example works on the 12k ULX3S using a Trust keyboard (the one normally connected to the Velkomstksjerm Pi) connected via a female - female USB A adapter to a USB A to USB micro A cable connected to US2. so I guess this keyboard is PS/2 then.

2020-10-07: bb - sdb5 - build and upload blink

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/blink$ make clean
tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/blink$ make ulx3s.bit
tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/blink$ make prog

that works too.

2020-10-07: bb - sdb5 - upload blink example, clone first

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S$ git clone https://github.com/ulx3s/blink.git
Cloning into 'blink'...
remote: Enumerating objects: 52, done.
remote: Counting objects: 100% (52/52), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 52 (delta 19), reused 21 (delta 8), pack-reused 0
Unpacking objects: 100% (52/52), done.

upload

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S$ cd blink/
tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/blink$ ~/bin/fujprog blink_12f.bit
ULX2S / ULX3S JTAG programmer v4.6 (git 0a4cc36 built Jul 22 2020 20:50:14)
Copyright (C) Marko Zec, EMARD, gojimmypi, kost and contributors
Using USB cable: ULX3S FPGA 12K v3.0.8
Programming: 100% 
Completed in 8.52 seconds.

yes, the blink works

tingo@kg-bsbox:/zs/tingo/doc/Radiona/ULX3S/blink$ ~/bin/fujprog -r
ULX2S / ULX3S JTAG programmer v4.6 (git 0a4cc36 built Jul 22 2020 20:50:14)
Copyright (C) Marko Zec, EMARD, gojimmypi, kost and contributors
Using USB cable: ULX3S FPGA 12K v3.0.8

that command didn't do anything with a visible effect

2020-10-07: bb - sdb5 - fujprog

tingo@kg-bsbox:~$ fujprog -h
ULX2S / ULX3S JTAG programmer v4.6 (git 0a4cc36 built Jul 22 2020 20:50:14)
Copyright (C) Marko Zec, EMARD, gojimmypi, kost and contributors
Usage: fujprog [option(s)] [bitstream_file]

 Valid options:
  -p PORT    Select USB JTAG / UART PORT (default is 0)
  -P TTY    Select TTY port (valid only with -t or -a)
  -T TYPE    Select TYPE of input (svf, img, bit or jed)
  -i         identify and exit
  -j TARGET    Select bitstream TARGET as SRAM (default) or FLASH
  -f ADDR    Start writing to SPI flash at ADDR, optional with -j flash
  -s FILE    Convert bitstream to SVF FILE and exit
  -r        Reload FPGA configuration from FLASH
  -t        Enter terminal emulation mode after completing JTAG operations
  -b SPEED    Set baudrate to SPEED (300 to 3000000 bauds)
  -e FILE    Send and execute a f32c (MIPS/RISCV) binary FILE
  -x SPEED    Set binary transfer speed, optional with -e
  -a FILE    Send a raw FILE
  -d         debug (verbose)
  -D DELAY    Delay transmission of each byte by DELAY ms
  -V         display version and exit
  -z         Force action
  -h         This help message
  -l X         Display messages in log fashion every <X> times
  -S serial     Select FTDI by serial to support multiple boards
  -q         Suppress messages

detect the board

tingo@kg-bsbox:~$ fujprog -i
ULX2S / ULX3S JTAG programmer v4.6 (git 0a4cc36 built Jul 22 2020 20:50:14)
Copyright (C) Marko Zec, EMARD, gojimmypi, kost and contributors
Using USB cable: ULX3S FPGA 12K v3.0.8
FPGA IDCODE: 21111043
FPGA identified SIZE: 12

does it work with -d (debug)?

tingo@kg-bsbox:~$ fujprog -d -i
ULX2S / ULX3S JTAG programmer v4.6 (git 0a4cc36 built Jul 22 2020 20:50:14)
Copyright (C) Marko Zec, EMARD, gojimmypi, kost and contributors
Using USB cable: ULX3S FPGA 12K v3.0.8
[d] Using following command: STATE IDLE
[d] Using following tokenized command: STATE
[d] exec_svf_tokenized - 0 got token: STATE
[d] exec_svf_tokenized - 1 got token: IDLE
[d] exec_svf_tokenized - using command id: 2
[d] exec_svf_tokenized returned 0
Segmentation fault

sort of

2020-10-07: bb - sdb5 - serial-by-id shows

tingo@kg-bsbox:~$ ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Oct  7 14:29 usb-FER-RADIONA-EMARD_ULX3S_FPGA_12K_v3.0.8_K00115-if00-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Oct  6 15:54 usb-FTDI_FT230X_Basic_UART_DN002VJP-if00-port0 -> ../../ttyUSB0

ok.

2020-10-06: bb - sdb5 - udev rules file

tingo@kg-bsbox:~$ more /etc/udev/rules.d/80-fpga-ulx3s.rules
# /etc/udev/rules.d/80-fpga-ulx3s.rules
# this is for usb-serial tty device
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="664", GROUP="dialout"
# this is for fujprog libusb access
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", GROUP="dialout", MODE="666"

ok

2020-10-06: bb - sdb5 - connected the ulx3s (12k) via usb port US1 to machine, lsusb shows

tingo@kg-bsbox:~$ lsusb -d 0403:6015
Bus 001 Device 006: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 023: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)

so usb serial port

tingo@kg-bsbox:~$ ls -l /dev/tty[ACU]*
crw-rw-rw-+ 1 root dialout 188, 0 Oct  6 15:54 /dev/ttyUSB0
crw-rw-rw-+ 1 root dialout 188, 1 Oct  7 14:29 /dev/ttyUSB1

ok

2020-10-06: bb - sdb5 - downloaded preconfigured toolchain and extracted in ~/progs/. Add ~/progs/fpga-toolchain/bin to $PATH to make it available.

2020-10-06: bb - sdb5 - downloaded latest release of fujprog, put it into ~/progs/ and made a link to ~/bin/

tingo@kg-bsbox:~$ ls -l ~/bin/fuj*
lrwxrwxrwx 1 tingo tingo 39 Oct  6 12:18 /home/tingo/bin/fujprog -> /home/tingo/progs/fujprog-v46-linux-x64

add ~/bin/ to $PATH to make available.