openFPGALoader icon indicating copy to clipboard operation
openFPGALoader copied to clipboard

Attempting to Flash SPI PROM of a custom board - Dragon-L

Open AnantaSrikar opened this issue 8 months ago • 15 comments

I am attempting to flash a bitstream to a custom FPGA board, called the Dragon-L. It has a Spartan-6 XC6SLX25T-CSG324 FPGA on board. I am using an Altera USB Blaster as the JTAG adapter.

I have built and tried the latest openFPGALoader. Upon trying to flash a bitstream, I got the following error:

❯ openFPGALoader -c usb-blaster ledblink.bit
empty
JTAG init failed with: Unknown device with IDCODE: 0x24024093 (manufacturer: 0x049 (Xilinx), part: 0x20 vers: 0x2

Then, I did some research and figured out I could add my the IDCODE to src/part.hpp. I added the following and recompiled:

        {0x04004093, {"xilinx", "spartan6", "xc6slx25",        6}},
+       {0x24024093, {"xilinx", "spartan6", "xc6slx25T",       6}},
        {0x04008093, {"xilinx", "spartan6", "xc6slx45",        6}},

Then, I was able to flash to the SRAM of the FPGA with the following output:

❯ ./openFPGALoader -c usb-blaster ledblink.bit --verbose 
empty
found 1 devices
index 0:
	idcode 0x24024093
	manufacturer xilinx
	family spartan6
	model  xc6slx25T
	irlength 6
File type : bit
Open file DONE
Parse file DONE
bitstream header infos
date: 2024/05/22
design_name: ledblink.ncd
hour: 10:26:28
part_name: 6slx25tcsg324
toolVersion: 0xFFFFFFFF
userID: 0xFFFFFFFF
load program
Load SRAM: [==================================================] 100.00%
Done
Shift IR 35
ir: 1 isc_done 1 isc_ena 0 init 1 done 1

I wanted to take it a step ahead and see if I could flash the same onto the onboard SPI flash, and tried adding the -f flag, and errored out with the following output:

❯ ./openFPGALoader -c usb-blaster -f ledblink.bit --verbose
empty
write to flash
found 1 devices
index 0:
	idcode 0x24024093
	manufacturer xilinx
	family spartan6
	model  xc6slx25T
	irlength 6
File type : bit
Open file DONE
Parse file DONE
bitstream header infos
date: 2024/05/22
design_name: ledblink.ncd
hour: 10:26:28
part_name: 6slx25tcsg324
toolVersion: 0xFFFFFFFF
userID: 0xFFFFFFFF
Can't program SPI flash: missing device-package information

I did some more research and I figured out I could add the --fpga-part flag, and ran the same, but I still got an error:

❯ ./openFPGALoader -c usb-blaster --fpga-part xc6slx9csg324 -f ../../fpgaconf/captures/ledblink.bit --verbose
empty
write to flash
found 1 devices
index 0:
	idcode 0x24024093
	manufacturer xilinx
	family spartan6
	model  xc6slx25T
	irlength 6
File type : bit
Open file DONE
Parse file DONE
bitstream header infos
date: 2024/05/22
design_name: ledblink.ncd
hour: 10:26:28
part_name: 6slx25tcsg324
toolVersion: 0xFFFFFFFF
userID: 0xFFFFFFFF
use: /home/srikar/projects/dragon-l/openFPGALoader/spiOverJtag/spiOverJtag_xc6slx9csg324.bit.gz
load program
Load SRAM: [==================================================] 100.00%
Done
Shift IR 11
ir: 1 isc_done 0 isc_ena 0 init 1 done 0
Register raw value: 0x0
CRC Error      No CRC error
Part Secured   0
MMCM lock      0
DCI match      0
EOS            0
GTS CFG B      0
GWE            0
GHIGH B        0
MODE           0
INIT Complete  0
INIT B         0
Release Done   0
Done           0
ID Error       No ID error
DEC Error      0
XADC Over temp 0
STARTUP State  0
Reserved       0
BUS Width      x1
Reserved       0
cd 96 76 80 read cd967680
Detail: 
Jedec ID          : cd
memory type       : 96
memory capacity   : 76
RDSR : 68
WIP  : 0
WEL  : 0
BP   : a
TB   : 1
SRWD : 0
flash chip unknown: use basic protection detection
unlock blocks
Error: block protection is set
       can't unlock without --unprotect-flash

Since the error mentioned the flag --uprotect-flash, I tried that too, but still failed with a timeout error:

❯ ./openFPGALoader -c usb-blaster --fpga-part xc6slx9csg324 -f ../../fpgaconf/captures/ledblink.bit --unprotect-flash --verbose 
empty
write to flash
found 1 devices
index 0:
	idcode 0x24024093
	manufacturer xilinx
	family spartan6
	model  xc6slx25T
	irlength 6
File type : bit
Open file DONE
Parse file DONE
bitstream header infos
date: 2024/05/22
design_name: ledblink.ncd
hour: 10:26:28
part_name: 6slx25tcsg324
toolVersion: 0xFFFFFFFF
userID: 0xFFFFFFFF
use: /home/srikar/projects/dragon-l/openFPGALoader/spiOverJtag/spiOverJtag_xc6slx9csg324.bit.gz
load program
Load SRAM: [==================================================] 100.00%
Done
Shift IR 11
ir: 1 isc_done 0 isc_ena 0 init 1 done 0
Register raw value: 0x0
CRC Error      No CRC error
Part Secured   0
MMCM lock      0
DCI match      0
EOS            0
GTS CFG B      0
GWE            0
GHIGH B        0
MODE           0
INIT Complete  0
INIT B         0
Release Done   0
Done           0
ID Error       No ID error
DEC Error      0
XADC Over temp 0
STARTUP State  0
Reserved       0
BUS Width      x1
Reserved       0
ad b4 40 80 read adb44080
Detail: 
Jedec ID          : ad
memory type       : b4
memory capacity   : 40
RDSR : 2c
WIP  : 0
WEL  : 0
BP   : 3
TB   : 1
SRWD : 0
flash chip unknown: use basic protection detection
unlock blocks
timeout: ff ff ff
ff
wait: Error

I've double checked the pinout for the SPI PROM and it should be fine. I am not sure what I'm missing here, and I hope to make some changes and add official support to this board.

The flash chip in use is an 25P80VP by STMicroelectronics. I believe this is the datasheet for the same.

I'm not sure what I'm missing here, hope to find some insights and direction for the same. Thanks!

AnantaSrikar avatar May 28 '24 15:05 AnantaSrikar