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

tangprimer20k program slow and stucked #250

Closed
Zepan opened this issue Aug 26, 2022 · 13 comments
Closed

tangprimer20k program slow and stucked #250

Zepan opened this issue Aug 26, 2022 · 13 comments

Comments

@Zepan
Copy link

Zepan commented Aug 26, 2022

Hi, thank you for support tangprimer20k~
I just tested "tangprimer20k" options, and seems it have some bug,
when program flash, it use 23s program 1%...
when program sram, it stucked at about 78%
how can I figure out the problem? did it appears on your board?

@trabucayre
Copy link
Owner

Hi,
for SRAM it's strange: I have my board since 2 weeks and not observed this type of behaviour, I assume @Icenowy (whos has added GW2A support) and @enjoy-digital have not seen that too: could you provide your setup, sometime bl702 programmer has issue and/or could you try with another programmer (if it's possible)?
for flash: I know currently flashing takes around 10mins: it's awfully slow. It's one of task I have to resolved but gowin datasheet provides nothing specifics for this device... WIP

@trabucayre
Copy link
Owner

Any news?
I have played a lot with my tangPrimer (SRAM) and I have never seen any issue.
For Flash I read again Gowin programming datasheets: GW2A is mentionned but it's lite and many informations are just missing... I have to find a way to obtain required params...

@Chandler-Kluser
Copy link
Contributor

I am facing a lot of issues with Tang Primer 20k too, I received mine in 2 days ago.

the most annoying issue is the device is not being recognized, even when root permissions.

the cases I am able to program (5% of total cases) flash memory it takes 10 minutes

@trabucayre
Copy link
Owner

Could you add -v option and provides dump? It's weird because it's exactly the same interface as tang nano 4k and 9k...
For Flash: SPI access was added for GW1N and is based on Boundary scan. It's a bitbang and take lot of time. I'm working to add native mode (something similar to SPI access for lattice ECP5) but docs are really light about this topic.

@Chandler-Kluser
Copy link
Contributor

Could you add -v option and provides dump? It's weird because it's exactly the same interface as tang nano 4k and 9k... For Flash: SPI access was added for GW1N and is based on Boundary scan. It's a bitbang and take lot of time. I'm working to add native mode (something similar to SPI access for lattice ECP5) but docs are really light about this topic.

The issue in #251 was solved by erasing embdFlash in a windows machine with gowin's programmer, the issue of 5% flashing times (with permissions) I could solve now thanks to #245 , as I commented there.

but the slow flash time is a fact, now. I will paste with verbose activated soon!

@Chandler-Kluser
Copy link
Contributor

$ openFPGALoader -b tangprimer20k -v -f tang-primer-demo.fs
write to flash
Jtag frequency : requested 6.00MHz   -> real 6.00MHz  
found 1 devices
index 0:
	idcode 0x81b
	manufacturer Gowin
	family GW2A
	model  GW2A(R)-18(C)
	irlength 8
File type : fs
Parse file Parse tang-primer-demo.fs: 
checksum 0x4876
Done
DONE
bitstream header infos
CRCCheck: ON
Compress: OFF
ConfDataLength: 1342
ProgramDoneBypass: OFF
SPIAddr: 00000000
SecurityBit: ON
idcode: 0000081b
loading_rate: 0
Jtag frequency : requested 2.50MHz   -> real 2.00MHz  
Jtag frequency : requested 10.00MHz  -> real 6.00MHz  
pollFlag: 60a0
erase SRAM pollFlag: 4080
pollFlag: 4080
pollFlag: a0
Done
b 40 16 b read b40160b
Detail: 
Jedec ID          : 0b
memory type       : 40
memory capacity   : 16
EDID + CFD length : 0b
EDID              : 1640
CFD               : 0b 40 16 0b 40 16 0b 40 16 
b 40 16 b read b40160b
Detail: 
Jedec ID          : 0b
memory type       : 40
memory capacity   : 16
EDID + CFD length : 0b
EDID              : 1640
CFD               : 0b 40 16 0b 40 16 0b 40 16 
RDSR : 00
WIP  : 0
WEL  : 0
BP   : 0
TB   : 0
SRWD : 0
RDSR : 00
WIP  : 0
WEL  : 0
BP   : 0
TB   : 0
SRWD : 0
flash chip unknown: use basic protection detection
Erasing: [==================================================] 100.00%
Done
Writing: [==================================================] 100.00%
Done
pollFlag: 20

@trabucayre
Copy link
Owner

Thanks for your feedback.
Documentation and troubleshoothing have to be updated to be more clear/detailed. Last time I have installed a new distro on a computer I haven't seen issues (but clearly I know exactly howto do -> I'm not objective... I'm interessted by an external contribution).
I'm working on MSPI access (instead of bitbanging) but documentation are limited to a state machine and a chrono -> I have some resultts but I'm far to have something correctly working -> WIP.

@Chandler-Kluser
Copy link
Contributor

keep the great work, my friend

if there is something I can help, here I am!

@trabucayre
Copy link
Owner

trabucayre commented Sep 6, 2022

@Zepan, @Chandler-Kluser: I have updated repository with a first MSPI draft: now it's takes ~9s to write the bitstream.

@Chandler-Kluser If you want you, @cfriedt and/or @infinitesteps, updating documentation and troubleshooting with your findings it maybe useful for everyone.

@Chandler-Kluser
Copy link
Contributor

@trabucayre I have recompiled the repo and reinstalled it in my PC with this commit and the flash time in Tang Primer is way more faster, thanks a lot!!

About the documentation and troubleshooting, I will make some pull requests to update these markdowns.

@trabucayre
Copy link
Owner

Yep around 60 time faster on my computer ;-)
Finally this time two figures are enough to add necessary code to access SPI flash :-)
Thanks for your feedback!
@Zepan: any update?

@Zepan
Copy link
Author

Zepan commented Sep 8, 2022

Hi, I just pull and compile, test ok~
Program flash and sram is fine and fast, thank you for your work!

@trabucayre
Copy link
Owner

@Zepan thanks for your feedback. MSPI mode is clearly better when it's available (for devices booting on external Flash). For SRAM I haven't modified anything: I suspect some glitches on JTAG lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants