Author Topic: ECP5 FPGA: what programmer & software to use? (solved)  (Read 1307 times)

0 Members and 1 Guest are viewing this topic.

Offline cedric!Topic starter

  • Contributor
  • Posts: 31
  • Country: nl
ECP5 FPGA: what programmer & software to use? (solved)
« on: October 16, 2022, 06:05:04 pm »
Hi all,

I got an Lattice ECP5 FPGA board[1]. I'm trying to flash it with a bitstream[2] using openocd and an Altera bitblaster[3], but I don't succeed.

[1] github.com/q3k/chubby75/tree/master/5a-75e
[2] https://forum.linuxcnc.org/27-driver-boards/46923-my-notes-on-compiling-litex-cnc-on-linuxcnc?start=0
[3] www.aliexpress.us/item/2251800524323433.html

If you had success flashing this FPGA, what software & programmer did you use?

In detail:
Connections between the FPGA board [4] and the USB blaster:
COLORLIGHT 75E - signal - USB Blaster
J30 - TDO - 3
J32 - TDI - 9
J31 - TMS - 5
J27 - TCK - 1
J33 - 3v3 - 7
J34 - GND - 2,10

[4] github.com/q3k/chubby75/tree/master/5a-75e

Openocd can see the FPGA:
$ cat myopenocd.cfg
adapter driver usb_blaster
$ openocd -f ./myopenocd.cfg
Info : JTAG tap: auto0.tap tap/device found: 0x41111043 (mfg: 0x021 (Lattice Semi.), part: 0x1111, ver: 0x4)
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 2 -expected-id 0x41111043"
Error: IR capture error at bit 2, saw 0x3FFFFFFFFFFFFFF5 not 0x...3

After adjusting the incorrect irlen from 2 to 8, openOCD happily talks to the PGFA:
$ cat myopenocd.cfg
adapter driver usb_blaster
jtag newtap auto0 tap -irlen 8 -expected-id 0x41111043
$ openocd -f ./myopenocd.cfg
Info : usb blaster interface using libftdi
Info : JTAG tap: auto0.tap tap/device found: 0x41111043 (mfg: 0x021 (Lattice Semi.), part: 0x1111, ver: 0x4)

When I try to flash my bitstream, openocd gives an error:
$ cat myopenocd.cfg
adapter driver usb_blaster
jtag newtap auto0 tap -irlen 8 -expected-id 0x41111043
$ cat colorlight_5a_75e.cfg
init
scan_chain
svf -progress colorlight_5a_75e.svf
shutdown
$ openocd -f ./myopenocd.cfg -f ./colorlight_5a_75e.cfg
svf processing file: "colorlight_5a_75e.svf"
0% HDR 0;
0% HIR 0;
0% TDR 0;
0% TIR 0;
0% ENDDR DRPAUSE;
0% ENDIR IRPAUSE;
0% STATE IDLE;
0% SIR 8 TDI (E0);
0% MASK (FFFFFFFF);
0% SIR 8 TDI (1C);
0% FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
0% SIR 8 TDI (C6);
0% SDR 8 TDI (00);
0% RUNTEST IDLE 2 TCK 1.00E-02 SEC;
0% SIR 8 TDI (0E);
0% SDR 8 TDI (01);
0% RUNTEST IDLE 2 TCK 1.00E-02 SEC;
0% SIR 8 TDI (3C);
0% MASK (0000B000);
0% SIR 8 TDI (46);
0% SDR 8 TDI (01);
0% RUNTEST IDLE 2 TCK 1.00E-02 SEC;
0% SIR 8 TDI (7A);
0% RUNTEST IDLE 2 TCK 1.00E-02 SEC;
0% 0000DCFFFFFFFFCDBDFFFFFF006CAC4C82E24282C26CB462AC4CB4AAACA26232045C2E4E860A00FF);
0% 0000000000FF173300000000000000000000FF173300000000000000000000FF1733000000000000);
0% 0000FF173300000000000000000000FF173300000000000000000000FF1733000000000000000000);
<snip>
95% 00000000000000000000000000000000000000000000000000000000000000000000000000000000);
95% 00000000000000000000000000000000000000000000000000000000000000000000000000000000);
95% SIR 8 TDI (FF);
95% RUNTEST IDLE 100 TCK 1.00E-02 SEC;
95% SIR 8 TDI (C0);
95% RUNTEST IDLE 2 TCK 1.00E-03 SEC;
95% MASK (FFFFFFFF);
95% SIR 8 TDI (26);
95% RUNTEST IDLE 2 TCK 2.00E-01 SEC;
95% SIR 8 TDI (FF);
95% RUNTEST IDLE 2 TCK 1.00E-03 SEC;
95% SIR 8 TDI (3C);
95% MASK (00002100);
Error: tdo check error at line 28
Error: READ = 0x0201f10
Error: WANT = 0x0000000
Error: MASK = 0x000b000
Time used: 0m1s761ms
svf file programmed failed

The same happens when I enable debug messages:
$ openocd -f ./myopenocd.cfg -f ./colorlight_5a_75e.cfg -d3
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
User : 13 1 options.c:63 configuration_output_handler(): debug_level: 3
User : 14 1 options.c:63 configuration_output_handler():
Debug: 15 1 options.c:244 add_default_dirs(): bindir=/usr/bin
Debug: 16 1 options.c:245 add_default_dirs(): pkgdatadir=/usr/share/openocd
Debug: 17 1 options.c:246 add_default_dirs(): exepath=/usr/bin
Debug: 18 1 options.c:247 add_default_dirs(): bin2data=../share/openocd
Debug: 19 1 configuration.c:42 add_script_search_dir(): adding /home/cedric/.config/openocd
Debug: 20 1 configuration.c:42 add_script_search_dir(): adding /home/cedric/.openocd
Debug: 21 1 configuration.c:42 add_script_search_dir(): adding /usr/bin/../share/openocd/site
Debug: 22 1 configuration.c:42 add_script_search_dir(): adding /usr/bin/../share/openocd/scripts
Debug: 23 1 configuration.c:97 find_file(): found ./myopenocd.cfg
Debug: 24 1 command.c:146 script_debug(): command - adapter driver usb_blaster
Info : 26 1 transport.c:117 allow_transports(): only one transport option; autoselect 'jtag'
Debug: 27 1 command.c:146 script_debug(): command - jtag newtap auto0 tap -irlen 8 -expected-id 0x41111043 -irmask 0xFF -ircapture 0x05
Debug: 28 1 tcl.c:571 jim_newtap_cmd(): Creating New Tap, Chip: auto0, Tap: tap, Dotted: auto0.tap, 8 params
Debug: 29 1 tcl.c:596 jim_newtap_cmd(): Processing option: -irlen
Debug: 30 1 tcl.c:596 jim_newtap_cmd(): Processing option: -expected-id
Debug: 31 1 tcl.c:596 jim_newtap_cmd(): Processing option: -irmask
Debug: 32 1 tcl.c:596 jim_newtap_cmd(): Processing option: -ircapture
Debug: 33 1 core.c:1484 jtag_tap_init(): Created Tap: auto0.tap @ abs position 0, irlen 8, capture: 0x5 mask: 0xff
Debug: 34 1 configuration.c:97 find_file(): found ./colorlight_5a_75e.cfg
Debug: 35 1 command.c:146 script_debug(): command - init
Debug: 37 1 command.c:146 script_debug(): command - target init
Debug: 39 1 command.c:146 script_debug(): command - target names
Debug: 40 1 target.c:1639 handle_target_init_command(): Initializing targets...
Info : 41 1 usb_blaster.c:858 ublast_init(): No lowlevel driver configured, using ftdi
Info : 42 1 ublast_access_ftdi.c:85 ublast_ftdi_init(): usb blaster interface using libftdi
Debug: 43 31 ublast_access_ftdi.c:108 ublast_ftdi_init(): current latency timer: 4
Info : 44 39 core.c:1536 adapter_init(): This adapter doesn't support configurable speed
Debug: 45 39 openocd.c:143 handle_init_command(): Debug Adapter init complete
Debug: 46 39 command.c:146 script_debug(): command - transport init
Debug: 48 39 transport.c:229 handle_transport_init(): handle_transport_init
Debug: 49 62 core.c:718 legacy_jtag_add_reset(): SRST line released
Debug: 50 62 core.c:742 legacy_jtag_add_reset(): TRST line released
Debug: 51 62 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 52 62 command.c:146 script_debug(): command - jtag arp_init
Debug: 53 62 core.c:1578 jtag_init_inner(): Init JTAG chain
Debug: 54 62 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 55 62 core.c:1243 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 56 62 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Info : 57 64 core.c:1142 jtag_examine_chain_display(): JTAG tap: auto0.tap tap/device found: 0x41111043 (mfg: 0x021 (Lattice Semi.), part: 0x1111, ver: 0x4)
Debug: 58 64 core.c:1374 jtag_validate_ircapture(): IR capture validation scan
Debug: 59 65 core.c:1431 jtag_validate_ircapture(): auto0.tap: IR capture 0x5
Debug: 60 65 command.c:146 script_debug(): command - dap init
Debug: 62 65 arm_dap.c:106 dap_init_all(): Initializing all DAPs ...
Debug: 63 65 openocd.c:160 handle_init_command(): Examining targets...
Debug: 64 65 command.c:146 script_debug(): command - flash init
Debug: 66 65 tcl.c:1385 handle_flash_init_command(): Initializing flash devices...
Debug: 67 65 command.c:146 script_debug(): command - nand init
Debug: 69 65 tcl.c:498 handle_nand_init_command(): Initializing NAND devices...
Debug: 70 65 command.c:146 script_debug(): command - pld init
Debug: 72 65 pld.c:206 handle_pld_init_command(): Initializing PLDs...
Warn : 73 65 gdb_server.c:3585 gdb_target_add_all(): gdb services need one or more targets defined
Debug: 74 65 command.c:146 script_debug(): command - scan_chain
Debug: 76 65 command.c:146 script_debug(): command - svf -progress colorlight_5a_75e.svf
User : 78 65 svf.c:403 handle_svf_command(): svf processing file: "colorlight_5a_75e.svf"
Debug: 79 65 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
User : 80 69 svf.c:507 handle_svf_command():   0%  HDR    0;
Debug: 81 69 svf.c:1040 svf_run_command():     length = 0
User : 82 69 svf.c:507 handle_svf_command():   0%  HIR    0;
Debug: 83 69 svf.c:1040 svf_run_command():     length = 0
User : 84 69 svf.c:507 handle_svf_command():   0%  TDR    0;
Debug: 85 69 svf.c:1040 svf_run_command():     length = 0
User : 86 69 svf.c:507 handle_svf_command():   0%  TIR    0;
Debug: 87 69 svf.c:1040 svf_run_command():     length = 0
User : 88 69 svf.c:507 handle_svf_command():   0%  ENDDR    DRPAUSE;
Debug: 89 69 svf.c:951 svf_run_command():     DR end_state = DRPAUSE
User : 90 69 svf.c:507 handle_svf_command():   0%  ENDIR    IRPAUSE;
Debug: 91 69 svf.c:947 svf_run_command():     IR end_state = IRPAUSE
User : 92 69 svf.c:507 handle_svf_command():   0%  STATE    IDLE;
Debug: 93 69 svf.c:1471 svf_run_command():     move to RUN/IDLE by svf_add_statemove
User : 94 69 svf.c:507 handle_svf_command():   0%  SIR    8    TDI  (E0);
Debug: 95 69 svf.c:1040 svf_run_command():     length = 8
Debug: 96 69 svf.c:1076 svf_run_command():      TDI = 0xe0
Debug: 97 69 svf.c:1537 svf_run_command(): TDO read = 0xe0
User : 98 69 svf.c:507 handle_svf_command():   0%              MASK (FFFFFFFF);
Debug: 99 69 svf.c:1040 svf_run_command():     length = 32
Debug: 100 69 svf.c:1076 svf_run_command():      TDI = 0x0000000
Debug: 101 69 svf.c:1076 svf_run_command():      TDO = 0x41111043
Debug: 102 69 svf.c:1076 svf_run_command():     MASK = 0xffffffff
Debug: 103 70 svf.c:1537 svf_run_command(): TDO read = 0x41111043
User : 104 70 svf.c:507 handle_svf_command():   0%  SIR    8    TDI  (1C);
Debug: 105 70 svf.c:1040 svf_run_command():     length = 8
Debug: 106 70 svf.c:1076 svf_run_command():      TDI = 0x1c
Debug: 107 70 svf.c:1537 svf_run_command(): TDO read = 0x1c
User : 108 70 svf.c:507 handle_svf_command():   0%               FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
Debug: 109 70 svf.c:1040 svf_run_command():     length = 510
Debug: 110 70 svf.c:1076 svf_run_command():      TDI = 0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Debug: 111 70 svf.c:1537 svf_run_command(): TDO read = 0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
User : 112 70 svf.c:507 handle_svf_command():   0%  SIR    8    TDI  (C6);
Debug: 113 70 svf.c:1040 svf_run_command():     length = 8
Debug: 114 70 svf.c:1076 svf_run_command():      TDI = 0xc6
Debug: 115 71 svf.c:1537 svf_run_command(): TDO read = 0xc6
User : 116 71 svf.c:507 handle_svf_command():   0%  SDR    8    TDI  (00);
Debug: 117 71 svf.c:1040 svf_run_command():     length = 8
Debug: 118 71 svf.c:1076 svf_run_command():      TDI = 0x0
Debug: 119 71 svf.c:1537 svf_run_command(): TDO read = 0x0
User : 120 71 svf.c:507 handle_svf_command():   0%  RUNTEST    IDLE    2 TCK 1.00E-02 SEC;
Debug: 121 71 svf.c:1323 svf_run_command():     run_state = RUN/IDLE
Debug: 122 71 svf.c:1336 svf_run_command():     run_count@TCK = 2
Debug: 123 71 svf.c:1346 svf_run_command():     min_time = 0.010000s
User : 124 71 svf.c:507 handle_svf_command():   0%  SIR    8    TDI  (0E);
Debug: 125 71 svf.c:1040 svf_run_command():     length = 8
Debug: 126 71 svf.c:1076 svf_run_command():      TDI = 0xe
Debug: 127 81 svf.c:1537 svf_run_command(): TDO read = 0xe
User : 128 81 svf.c:507 handle_svf_command():   0%  SDR    8    TDI  (01);
Debug: 129 81 svf.c:1040 svf_run_command():     length = 8
Debug: 130 81 svf.c:1076 svf_run_command():      TDI = 0x1
Debug: 131 81 svf.c:1537 svf_run_command(): TDO read = 0x1
User : 132 81 svf.c:507 handle_svf_command():   0%  RUNTEST    IDLE    2 TCK 1.00E-02 SEC;
Debug: 133 81 svf.c:1323 svf_run_command():     run_state = RUN/IDLE
Debug: 134 81 svf.c:1336 svf_run_command():     run_count@TCK = 2
Debug: 135 81 svf.c:1346 svf_run_command():     min_time = 0.010000s
User : 136 81 svf.c:507 handle_svf_command():   0%  SIR    8    TDI  (3C);
Debug: 137 81 svf.c:1040 svf_run_command():     length = 8
Debug: 138 81 svf.c:1076 svf_run_command():      TDI = 0x3c
Debug: 139 91 svf.c:1537 svf_run_command(): TDO read = 0x3c
User : 140 91 svf.c:507 handle_svf_command():   0%              MASK (0000B000);
Debug: 141 91 svf.c:1040 svf_run_command():     length = 32
Debug: 142 91 svf.c:1076 svf_run_command():      TDI = 0x0000000
Debug: 143 91 svf.c:1076 svf_run_command():      TDO = 0x0000000
Debug: 144 91 svf.c:1076 svf_run_command():     MASK = 0x000b000
Error: 145 92 svf.c:860 svf_check_tdo(): tdo check error at line 28
Error: 146 92 svf.c:862 svf_check_tdo():     READ = 0x0201f10
Error: 147 92 svf.c:863 svf_check_tdo():     WANT = 0x0000000
Error: 148 92 svf.c:864 svf_check_tdo():     MASK = 0x000b000
Error: 149 92 svf.c:513 handle_svf_command(): fail to run command at line 28
Error: 150 92 svf.c:860 svf_check_tdo(): tdo check error at line 28
Error: 151 92 svf.c:862 svf_check_tdo():     READ = 0x0201f10
Error: 152 92 svf.c:863 svf_check_tdo():     WANT = 0x0000000
Error: 153 92 svf.c:864 svf_check_tdo():     MASK = 0x000b000
Debug: 154 92 command.c:628 run_command(): Command 'svf' failed with error code -4
User : 155 92 command.c:694 command_run_line(): Time used: 0m0s27ms
svf file programmed failed

See this forum for details:
https://forum.linuxcnc.org/27-driver-boards/47028-my-notes-flashing-litex-cnc-on-a-colorlight-5a-75e

And this message to the openocd devel list:
https://sourceforge.net/p/openocd/mailman/message/37720529/

« Last Edit: October 18, 2022, 07:23:40 pm by cedric! »
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14302
  • Country: fr
Re: ECP5 FPGA: what programmer & software to use?
« Reply #1 on: October 16, 2022, 06:41:10 pm »
I have used DAP adapters (such as the nanoDAP-HS) and ecpdap successfully. ecpdap normally supports any DAP-compatible adapter and those are easy to find. The nanoDAP-HS supports USB HS, which yields faster speeds.

https://github.com/adamgreig/ecpdap
 

Offline cedric!Topic starter

  • Contributor
  • Posts: 31
  • Country: nl
Re: ECP5 FPGA: what programmer & software to use?
« Reply #2 on: October 16, 2022, 06:57:02 pm »
Thank you,

I have a DAPLINK [1] here. I'll checkout ecpdap [2]

[1] https://nl.aliexpress.com/item/1005002784627064.html
[2] https://github.com/adamgreig/ecpdap
 

Offline cedric!Topic starter

  • Contributor
  • Posts: 31
  • Country: nl
Re: ECP5 FPGA: what programmer & software to use?
« Reply #3 on: October 18, 2022, 06:33:36 pm »
I have successfully flashed my FPGA with openfpgaloader:

[root@cedric cedric]# pacman -S openfpgaloader
[cedric@cedric ~]$ openFPGALoader -c usb-blaster -m LiteX-CNC/5a-75e/gateware/colorlight_5a_75e.bit
write to ram
Open file: DONE
Parse file: DONE
Enable configuration: DONE
SRAM erase: DONE
Loading: [==================================================] 100.00%
Done
Disable configuration: DONE
[cedric@cedric ~]$
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf