ECP5 FPGA: what programmer & software to use? (solved) - Page 1
Forum section: electronics / general

author: cedric!
author_rank: Contributor
timestamp: October 16, 2022, 06:05:04 pm
content: Hi all,I got an Lattice ECP5 FPGA board. I'm trying to flash it with a bitstream using openocd and an Altera bitblaster, but I don't succeed. github.com/q3k/chubby75/tree/master/5a-75ehttps://forum.linuxcnc.org/27-driver-boards/46923-my-notes-on-compiling-litex-cnc-on-linuxcnc?start=0www.aliexpress.us/item/2251800524323433.htmlIf you had success flashing this FPGA, what software & programmer did you use?In detail:Connections between the FPGA board  and the USB blaster:COLORLIGHT 75E - signal - USB BlasterJ30 - TDO - 3J32 - TDI - 9J31 - TMS - 5J27 - TCK - 1J33 - 3v3 - 7J34 - GND - 2,10 github.com/q3k/chubby75/tree/master/5a-75eOpenocd can see the FPGA:$ cat myopenocd.cfgadapter driver usb_blaster$ openocd -f ./myopenocd.cfgInfo : 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...3After adjusting the incorrect irlen from 2 to 8, openOCD happily talks to the PGFA:$ cat myopenocd.cfgadapter driver usb_blasterjtag newtap auto0 tap -irlen 8 -expected-id 0x41111043$ openocd -f ./myopenocd.cfgInfo : usb blaster interface using libftdiInfo : 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.cfgadapter driver usb_blasterjtag newtap auto0 tap -irlen 8 -expected-id 0x41111043$ cat colorlight_5a_75e.cfginitscan_chainsvf -progress colorlight_5a_75e.svfshutdown$ openocd -f ./myopenocd.cfg -f ./colorlight_5a_75e.cfgsvf 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 28Error: READ = 0x0201f10Error: WANT = 0x0000000Error: MASK = 0x000b000Time used: 0m1s761mssvf file programmed failedThe same happens when I enable debug messages:$ openocd -f ./myopenocd.cfg -f ./colorlight_5a_75e.cfg -d3Open On-Chip Debugger 0.11.0Licensed under GNU GPL v2For bug reports, readhttp://openocd.org/doc/doxygen/bugs.htmlUser : 13 1 options.c:63 configuration_output_handler(): debug_level: 3User : 14 1 options.c:63 configuration_output_handler():Debug: 15 1 options.c:244 add_default_dirs(): bindir=/usr/binDebug: 16 1 options.c:245 add_default_dirs(): pkgdatadir=/usr/share/openocdDebug: 17 1 options.c:246 add_default_dirs(): exepath=/usr/binDebug: 18 1 options.c:247 add_default_dirs(): bin2data=../share/openocdDebug: 19 1 configuration.c:42 add_script_search_dir(): adding /home/cedric/.config/openocdDebug: 20 1 configuration.c:42 add_script_search_dir(): adding /home/cedric/.openocdDebug: 21 1 configuration.c:42 add_script_search_dir(): adding /usr/bin/../share/openocd/siteDebug: 22 1 configuration.c:42 add_script_search_dir(): adding /usr/bin/../share/openocd/scriptsDebug: 23 1 configuration.c:97 find_file(): found ./myopenocd.cfgDebug: 24 1 command.c:146 script_debug(): command - adapter driver usb_blasterInfo : 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 0x05Debug: 28 1 tcl.c:571 jim_newtap_cmd(): Creating New Tap, Chip: auto0, Tap: tap, Dotted: auto0.tap, 8 paramsDebug: 29 1 tcl.c:596 jim_newtap_cmd(): Processing option: -irlenDebug: 30 1 tcl.c:596 jim_newtap_cmd(): Processing option: -expected-idDebug: 31 1 tcl.c:596 jim_newtap_cmd(): Processing option: -irmaskDebug: 32 1 tcl.c:596 jim_newtap_cmd(): Processing option: -ircaptureDebug: 33 1 core.c:1484 jtag_tap_init(): Created Tap: auto0.tap @ abs position 0, irlen 8, capture: 0x5 mask: 0xffDebug: 34 1 configuration.c:97 find_file(): found ./colorlight_5a_75e.cfgDebug: 35 1 command.c:146 script_debug(): command - initDebug: 37 1 command.c:146 script_debug(): command - target initDebug: 39 1 command.c:146 script_debug(): command - target namesDebug: 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 ftdiInfo : 42 1 ublast_access_ftdi.c:85 ublast_ftdi_init(): usb blaster interface using libftdiDebug: 43 31 ublast_access_ftdi.c:108 ublast_ftdi_init(): current latency timer: 4Info : 44 39 core.c:1536 adapter_init(): This adapter doesn't support configurable speedDebug: 45 39 openocd.c:143 handle_init_command(): Debug Adapter init completeDebug: 46 39 command.c:146 script_debug(): command - transport initDebug: 48 39 transport.c:229 handle_transport_init(): handle_transport_initDebug: 49 62 core.c:718 legacy_jtag_add_reset(): SRST line releasedDebug: 50 62 core.c:742 legacy_jtag_add_reset(): TRST line releasedDebug: 51 62 core.c:327 jtag_call_event_callbacks(): jtag event: TAP resetDebug: 52 62 command.c:146 script_debug(): command - jtag arp_initDebug: 53 62 core.c:1578 jtag_init_inner(): Init JTAG chainDebug: 54 62 core.c:327 jtag_call_event_callbacks(): jtag event: TAP resetDebug: 55 62 core.c:1243 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASSDebug: 56 62 core.c:327 jtag_call_event_callbacks(): jtag event: TAP resetInfo : 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 scanDebug: 59 65 core.c:1431 jtag_validate_ircapture(): auto0.tap: IR capture 0x5Debug: 60 65 command.c:146 script_debug(): command - dap initDebug: 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 initDebug: 66 65 tcl.c:1385 handle_flash_init_command(): Initializing flash devices...Debug: 67 65 command.c:146 script_debug(): command - nand initDebug: 69 65 tcl.c:498 handle_nand_init_command(): Initializing NAND devices...Debug: 70 65 command.c:146 script_debug(): command - pld initDebug: 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 definedDebug: 74 65 command.c:146 script_debug(): command - scan_chainDebug: 76 65 command.c:146 script_debug(): command - svf -progress colorlight_5a_75e.svfUser : 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 resetUser : 80 69 svf.c:507 handle_svf_command(): 0% HDR 0;Debug: 81 69 svf.c:1040 svf_run_command(): length = 0User : 82 69 svf.c:507 handle_svf_command(): 0% HIR 0;Debug: 83 69 svf.c:1040 svf_run_command(): length = 0User : 84 69 svf.c:507 handle_svf_command(): 0% TDR 0;Debug: 85 69 svf.c:1040 svf_run_command(): length = 0User : 86 69 svf.c:507 handle_svf_command(): 0% TIR 0;Debug: 87 69 svf.c:1040 svf_run_command(): length = 0User : 88 69 svf.c:507 handle_svf_command(): 0% ENDDR DRPAUSE;Debug: 89 69 svf.c:951 svf_run_command(): DR end_state = DRPAUSEUser : 90 69 svf.c:507 handle_svf_command(): 0% ENDIR IRPAUSE;Debug: 91 69 svf.c:947 svf_run_command(): IR end_state = IRPAUSEUser : 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_statemoveUser : 94 69 svf.c:507 handle_svf_command(): 0% SIR 8 TDI (E0);Debug: 95 69 svf.c:1040 svf_run_command(): length = 8Debug: 96 69 svf.c:1076 svf_run_command(): TDI = 0xe0Debug: 97 69 svf.c:1537 svf_run_command(): TDO read = 0xe0User : 98 69 svf.c:507 handle_svf_command(): 0% MASK (FFFFFFFF);Debug: 99 69 svf.c:1040 svf_run_command(): length = 32Debug: 100 69 svf.c:1076 svf_run_command(): TDI = 0x0000000Debug: 101 69 svf.c:1076 svf_run_command(): TDO = 0x41111043Debug: 102 69 svf.c:1076 svf_run_command(): MASK = 0xffffffffDebug: 103 70 svf.c:1537 svf_run_command(): TDO read = 0x41111043User : 104 70 svf.c:507 handle_svf_command(): 0% SIR 8 TDI (1C);Debug: 105 70 svf.c:1040 svf_run_command(): length = 8Debug: 106 70 svf.c:1076 svf_run_command(): TDI = 0x1cDebug: 107 70 svf.c:1537 svf_run_command(): TDO read = 0x1cUser : 108 70 svf.c:507 handle_svf_command(): 0% FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);Debug: 109 70 svf.c:1040 svf_run_command(): length = 510Debug: 110 70 svf.c:1076 svf_run_command(): TDI = 0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffDebug: 111 70 svf.c:1537 svf_run_command(): TDO read = 0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffUser : 112 70 svf.c:507 handle_svf_command(): 0% SIR 8 TDI (C6);Debug: 113 70 svf.c:1040 svf_run_command(): length = 8Debug: 114 70 svf.c:1076 svf_run_command(): TDI = 0xc6Debug: 115 71 svf.c:1537 svf_run_command(): TDO read = 0xc6User : 116 71 svf.c:507 handle_svf_command(): 0% SDR 8 TDI (00);Debug: 117 71 svf.c:1040 svf_run_command(): length = 8Debug: 118 71 svf.c:1076 svf_run_command(): TDI = 0x0Debug: 119 71 svf.c:1537 svf_run_command(): TDO read = 0x0User : 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/IDLEDebug: 122 71 svf.c:1336 svf_run_command(): run_count@TCK = 2Debug: 123 71 svf.c:1346 svf_run_command(): min_time = 0.010000sUser : 124 71 svf.c:507 handle_svf_command(): 0% SIR 8 TDI (0E);Debug: 125 71 svf.c:1040 svf_run_command(): length = 8Debug: 126 71 svf.c:1076 svf_run_command(): TDI = 0xeDebug: 127 81 svf.c:1537 svf_run_command(): TDO read = 0xeUser : 128 81 svf.c:507 handle_svf_command(): 0% SDR 8 TDI (01);Debug: 129 81 svf.c:1040 svf_run_command(): length = 8Debug: 130 81 svf.c:1076 svf_run_command(): TDI = 0x1Debug: 131 81 svf.c:1537 svf_run_command(): TDO read = 0x1User : 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/IDLEDebug: 134 81 svf.c:1336 svf_run_command(): run_count@TCK = 2Debug: 135 81 svf.c:1346 svf_run_command(): min_time = 0.010000sUser : 136 81 svf.c:507 handle_svf_command(): 0% SIR 8 TDI (3C);Debug: 137 81 svf.c:1040 svf_run_command(): length = 8Debug: 138 81 svf.c:1076 svf_run_command(): TDI = 0x3cDebug: 139 91 svf.c:1537 svf_run_command(): TDO read = 0x3cUser : 140 91 svf.c:507 handle_svf_command(): 0% MASK (0000B000);Debug: 141 91 svf.c:1040 svf_run_command(): length = 32Debug: 142 91 svf.c:1076 svf_run_command(): TDI = 0x0000000Debug: 143 91 svf.c:1076 svf_run_command(): TDO = 0x0000000Debug: 144 91 svf.c:1076 svf_run_command(): MASK = 0x000b000Error: 145 92 svf.c:860 svf_check_tdo(): tdo check error at line 28Error: 146 92 svf.c:862 svf_check_tdo(): READ = 0x0201f10Error: 147 92 svf.c:863 svf_check_tdo(): WANT = 0x0000000Error: 148 92 svf.c:864 svf_check_tdo(): MASK = 0x000b000Error: 149 92 svf.c:513 handle_svf_command(): fail to run command at line 28Error: 150 92 svf.c:860 svf_check_tdo(): tdo check error at line 28Error: 151 92 svf.c:862 svf_check_tdo(): READ = 0x0201f10Error: 152 92 svf.c:863 svf_check_tdo(): WANT = 0x0000000Error: 153 92 svf.c:864 svf_check_tdo(): MASK = 0x000b000Debug: 154 92 command.c:628 run_command(): Command 'svf' failed with error code -4User : 155 92 command.c:694 command_run_line(): Time used: 0m0s27mssvf file programmed failedSee this forum for details:https://forum.linuxcnc.org/27-driver-boards/47028-my-notes-flashing-litex-cnc-on-a-colorlight-5a-75eAnd this message to the openocd devel list:https://sourceforge.net/p/openocd/mailman/message/37720529/

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 16, 2022, 06:41:10 pm
content: 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

author: cedric!
author_rank: Contributor
timestamp: October 16, 2022, 06:57:02 pm
content: Thank you,I have a DAPLINK  here. I'll checkout ecpdap https://nl.aliexpress.com/item/1005002784627064.htmlhttps://github.com/adamgreig/ecpdap

author: cedric!
author_rank: Contributor
timestamp: October 18, 2022, 06:33:36 pm
content: 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.bitwrite to ramOpen file: DONEParse file: DONEEnable configuration: DONESRAM erase: DONELoading: [==================================================] 100.00%DoneDisable configuration: DONE[cedric@cedric ~]$