trabucayre / openFPGALoader

Universal utility for programming FPGA
https://trabucayre.github.io/openFPGALoader/
Apache License 2.0
1.16k stars 249 forks source link

Can't flash SPI flash AT45DB161E #273

Open vanbwodonk opened 1 year ago

vanbwodonk commented 1 year ago

I have custom board with xilinx xc6slx25ft256 + AT45DB161E. Impact can detect & flash it. But can't flash with openFPGALoader. Already generate spiOverJtag for xc6slx25ft256 and succesfull on QMTECH board.

cmd:

openFPGALoader -c ft2232 --fpga-part xc6slx25ft256 -f build/blink.bit -v

output:

write to flash
Jtag frequency : requested 6.00MHz   -> real 6.00MHz  
found 1 devices
index 0:
        idcode 0x4004093
        manufacturer xilinx
        family spartan6
        model  xc6slx25
        irlength 6
File type : bit
Open file DONE
Parse file DONE
bitstream header infos
date: 2022/11/17
design_name: blink.ncd
hour: 13:37:54
part_name: 6slx25ftg256
toolVersion: 0xFFFFFFFF
userID: 0xFFFFFFFF
use: /usr/share/openFPGALoader/spiOverJtag_xc6slx25ft256.bit.gz
load program
Flash SRAM: [==================================================] 100.00%
Done
1f 26 0 1 read 1f260001
Detail: 
Jedec ID          : 1f
memory type       : 26
memory capacity   : 00
EDID + CFD length : 01
EDID              : 5500
CFD               : 
RDSR : 00
WIP  : 0
WEL  : 0
BP   : 0
TB   : 0
SRWD : 0
flash chip unknown: use basic protection detection
timeout: 0 0 0
0
wait: Error
write en: Error
Erasing: [==================================================] 100.00%
Fail

please help,

trabucayre commented 1 year ago

spiOverJtag seems correctly loaded and flash id is correctly read: it's a good point this mean access seems working. This model isn't into database but it seems not a problem: flash isn't protected. Error is about timeout for write enable request (I assume: I have to improve a bit more log messages/details). which is the QMTech's flash model (I assume FPGA is the same)? Since it's a custom board I suppose it's not possible to have a physical access to this. But is it possible to have access to schematics? Thanks

vanbwodonk commented 1 year ago

which is the QMTech's flash model (I assume FPGA is the same)?

QMTech used same model fpga, spi flash model is M25P80. Complete documentation is here https://github.com/ChinaQMTECH/QM_XC6SLX25_DDR3

But is it possible to have access to schematics?

This is my custom board. I'm sorry the schematic little bit a mess, because is an old project i convert it from eagle to kicad. S6LX25-FTG256.pdf

trabucayre commented 1 year ago

Thanks for the schematic, I have to take a look at that, but I see there is no pullup/pulldown for SPI signals: I have already sees failures due to glitches.

vanbwodonk commented 1 year ago

but I see there is no pullup/pulldown for SPI signals

Is pullup/pulldown resistors necessary? I can try modified my board.

trabucayre commented 1 year ago

It's a possible reason but I have to take a closer look to the datasheet. Unfortunately I haven't this chip @home (this is available on mouser but shipping cost is really high for a 2 euros component) to test using a direct SPI communication to see if something is specific to this chip or if the issue is elsewhere.

vanbwodonk commented 1 year ago

Already add pull up resistors in SPI_CS. Same problem. Fyi, i can program with old programmer xc3sprog with/without pullup resistor. There is some error massage with ftdi driver, but FPGA can run ok with SPI flash boot mode. I Assume x3sprog succesfully flash it. Little bit OOT but i hope this can give you some information.

xc3sprog -c ftdi -I build/blink.bit
XC3SPROG (c) 2004-2011 xc3sprog project $Rev: 795 $ 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 Libftdi, 
JEDEC: 1f 26 0x00 0x01
status: 88
Found Atmel Device, Device ID 0x2600: AT45DB161
Unique number:
c860388814acf86400808260fffffeff0c0c0aca8c6cac8c08b4eaffffffffff
02020202020202020202020202020202ffffffffffffffffffffffffffffffff
528 bytes/page, 4096 pages = 2162688 bytes total 
mpsse_send: Short write -1 vs 559 at run 11305, Err: usb bulk write failed
terminate called after throwing an instance of 'io_exception'
make: *** [Makefile:196: flashxc3] Aborted (core dumped)
vanbwodonk commented 1 year ago

photo_2022-11-23_11-02-44