Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh: FAIL on Lattice MachXO2 #456

Open
mchitre opened this issue Apr 30, 2024 · 13 comments
Open

Refresh: FAIL on Lattice MachXO2 #456

mchitre opened this issue Apr 30, 2024 · 13 comments
Labels
bug Something isn't working regression

Comments

@mchitre
Copy link

mchitre commented Apr 30, 2024

I have had great success in using openFPGALoader to burn a program to RAM on my Lattice MachXO2 board. However, when I try to burn to flash, it fails:

# openFPGALoader --busdev-num 000:005 --freq 6000000 -c ft2232_b -f build_impl/DAM_build_impl.bit
write to flash
Jtag frequency : requested 6.00MHz   -> real 6.00MHz
Enable configuration: DONE
Flash erase: DONE
Writing data: [==================================================] 100.00%
Done
Write program Done: DONE
Disable configuration: DONE
Enable configuration: DONE
SRAM erase: DONE
Detail:
Jedec ID          : 00
memory type       : 00
memory capacity   : 00
Skip resetting device
Refresh: FAIL
displayReadReg
	Config Target Selection : 0
	ISC Enable
	Write Enable
	Read Enable
	SDM Enable
	No err
Error: Failed to program FPGA: std::exception

Burning to flash from Lattice Diamond work fine. Any idea on what the problem is?

@trabucayre
Copy link
Owner

I have to check with my machX02 device. Could you provides a dump with --verbose and the model of machXO2 you use ?

@trabucayre trabucayre added bug Something isn't working regression labels May 1, 2024
@mchitre
Copy link
Author

mchitre commented May 1, 2024

I am using a MachXO2 LCMXO2-7000-ZE-3TG144I

With verbose:

# openFPGALoader --busdev-num 000:005 --freq 6000000 -c ft2232_b --verbose -f build_impl/DAM_build_impl.bit
write to flash
Jtag frequency : requested 6.00MHz   -> real 6.00MHz
found 1 devices
index 0:
	idcode 0x12b5043
	manufacturer lattice
	family MachXO2
	model  LCMXO2-7000HE
	irlength 8
File type : bit
IDCode : 12b5043
displayReadReg
	Config Target Selection : 0
	ISC Enable
	Write Enable
	Read Enable
	SDM Enable
	No err
Enable configuration: DONE
Flash erase: DONE
Writing data: [==================================================] 100.00%
Done
Write program Done: DONE
Disable configuration: DONE
Enable configuration: DONE
SRAM erase: DONE
0 0 0 0 read 0
Detail:
Jedec ID          : 00
memory type       : 00
memory capacity   : 00
Skip resetting device
Refresh: FAIL
displayReadReg
	Config Target Selection : 0
	ISC Enable
	Write Enable
	Read Enable
	SDM Enable
	No err
Error: Failed to program FPGA: std::exception

@trabucayre
Copy link
Owner

For a similar device I haven't a different dump: your looks like something for ECP5.
Which version you use: I see LCMXO2-7000HE but since a recent commit there is no more HE but ZE, lattice support was also improved/fixed.

@mchitre
Copy link
Author

mchitre commented May 1, 2024

MachXO2 LCMXO2-7000-ZE-3TG144I

Upgraded to latest. Problem persists.

# openFPGALoader -V
openFPGALoader v0.12.1

# openFPGALoader --busdev-num 000:005 --freq 6000000 -c ft2232_b --verbose -f build_impl/DAM_build_impl.bit
empty
write to flash
Jtag frequency : requested 6.00MHz   -> real 6.00MHz
found 1 devices
index 0:
	idcode 0x12b5043
	manufacturer lattice
	family MachXO2
	model  LCMXO2-7000ZE
	irlength 8
File type : bit
IDCode : 12b5043
displayReadReg
	Config Target Selection : 0
	ISC Enable
	Write Enable
	Read Enable
	SDM Enable
	BSE Error Code
		No err
b3bdffff
Enable configuration: DONE
Flash erase: DONE
Writing data: [==================================================] 100.00%
Done
Write program Done: DONE
Disable configuration: DONE
Enable configuration: DONE
SRAM erase: DONE
0 0 0 0 read 0
Detail:
Jedec ID          : 00
memory type       : 00
memory capacity   : 00
Skip resetting device
Refresh: FAIL
displayReadReg
	Config Target Selection : 0
	ISC Enable
	Write Enable
	Read Enable
	SDM Enable
	BSE Error Code
		No err
Error: Failed to program FPGA: std::exception

@mchitre
Copy link
Author

mchitre commented May 9, 2024

Anything I can do to help debug?

@trabucayre
Copy link
Owner

Look like the issue is near lattice.cpp: post_flash_access()
If refresh fails it will try to read flash but this is unsupported for machXO2/machXO3(D).
Is it possible to share your bitstream, maybe using it I will be able to reproduce.

@mchitre
Copy link
Author

mchitre commented May 11, 2024

Here's a simplified version of my code that I can't burn into flash but works fine in RAM:
https://drive.google.com/file/d/1HF8rapJ1EhFltFHy86KzNOAWVLjb8WVR/view?usp=sharing

@mchitre
Copy link
Author

mchitre commented May 11, 2024

Hmm. If I try many times, sometimes the flash writing succeeds. But the code doesn't work from the flash. Loading to RAM for the same code works.

@trabucayre
Copy link
Owner

I have an issue with my machXO2 but will try with machXO3. I have rechecked the code and don't see why messages related to spiflash are displayed... Could you try with .jed to check if it's the same situation?

@trabucayre
Copy link
Owner

@BlueSyncLine: could you provides details about your board. machXO FPGAs have only internal flash.

@trabucayre
Copy link
Owner

@mchitre After a (too long) time I have retried your bitstream without any issues:

openFPGALoader --busdev-num 003:016 --freq 6000000 -c ft2232 --verbose -f ../../machxo2_fail/fails.bit 
empty
write to flash
Can't read iSerialNumber field from FTDI: considered as empty string
Jtag frequency : requested 6.00MHz   -> real 6.00MHz  
found 1 devices
index 0:
        idcode 0x12b5043
        manufacturer lattice
        family MachXO2
        model  LCMXO2-7000ZE
        irlength 8
File type : bit
IDCode : 12b5043
displayReadReg
        Config Target Selection : 0
        Done Flag
        SDM Enable
        BSE Error Code
                No err
b3bdffff
Enable configuration: DONE
Flash erase: DONE
Writing data: [==================================================] 100.00%
Done
Write program Done: DONE
Disable configuration: DONE
Refresh: DONE

I am just unable to see why, in your case, openFPGALoader try to access to an external flash.
Just to see: is it an native linux?

@mchitre
Copy link
Author

mchitre commented Jun 29, 2024

It is a Mac OS X

@trabucayre
Copy link
Owner

Will try with my (montherey)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression
Projects
None yet
Development

No branches or pull requests

2 participants