benh_ has quit [Read error: Connection reset by peer]
kgugala has quit [Quit: -a- Connection Timed Out]
kgugala has joined #litex
lambda has quit [Read error: Connection reset by peer]
lambda has joined #litex
_whitelogger has joined #litex
<somlo>
daveshah: with external 12V power, plugging both ethernet and microSD cards into the trellisboard no longer causes it to glitch
<daveshah>
Great, that does seem like it was a power problem then
<somlo>
yeah, and there's a deterministic solution (use ext. 12V - and a fuse!) that doesn't involve playing usb cable lottery :D
<_florent_>
somlo: nice, just for info i'm looking at the LiteSDCard insert-init-eject issue
<somlo>
_florent_: thanks! I'll hold off on creating a github issue then, unless it turns out to be a longer term project (hopefully it's just a quick FSM tweak though :)
<_florent_>
somlo: the insert-init-eject issue is probably more related to software
<somlo>
_florent_: the softer the better :D
<_florent_>
somlo: i'm able to reproduce (even without ejecting the card)
<_florent_>
it's passing on the first sdcard_init, but failing on the next ones
<_florent_>
it's maybe not returning SD_OK because it's already configured correctly, i'm going to look at the spec
CarlFK has quit [Ping timeout: 265 seconds]
<somlo>
_florent_: I just emailed you the sequence of commands being sent to the card by linux
<somlo>
most of that is generic (i.e. not specifically done by the litex_mmc.c driver)
<somlo>
so the question is whether sending "switch strength" repeatedly should be accepted/ignored rather than allow the card to get "legitimately upset" about it?
<_florent_>
somlo: i just removed the driver strength configuration since that's only supported in 1.8V signaling in fact (which was previously supported)
<_florent_>
somlo: with this, consecutive sdcard_inits are working fine (with the BIOS)
<_florent_>
somlo: but there is probably still an issue (this time i think in the gateware) since i also reproduce the miss-alignment of data on the first reads
<_florent_>
that's the idea with LiteSDCard bench, but the Pulseview/sigrok capture part is not yet fully validated
<_florent_>
for now i've been mostly testing with an external analyzer on the Pmod connector, but the idea is to try to get rid of it and re-sample Pmod signals directly with the FPGA and stream it to the Host
<keesj>
but.. is litesdcard the dut or the SDCARD? (I need to dump an eMMC and would fancy doing this with the fpga)
<somlo>
_florent_: the data returned by `sdcard_read 0` after `sdcard_init` is different from the very first time, once you start ejecting, reinserting, and re-running the `sdcard_init` + `sdcard_read 0` sequence. No more outright failure upon `sdcard_init`, that's true
<somlo>
but there's still something in the gateware that returns different results starting with the second time after eject+reinsert
kgugala_ has joined #litex
<somlo>
(maybe that's what you meant by "mis-alignment of data on first read")?
kgugala has quit [Ping timeout: 256 seconds]
<somlo>
either way, with the linux driver it still only works the first time the card is inserted (so whatever happens after *re*insertion is problematic still)
kgugala has joined #litex
kgugala_ has quit [Ping timeout: 260 seconds]
kgugala_ has joined #litex
kgugala has quit [Ping timeout: 260 seconds]
<_florent_>
keesj: LiteSDCard is the DUT yes, there is a logic analyzer probing it internally and the PMOD is also probed (to verify the PHY/Protocol)
kgugala has joined #litex
<_florent_>
somlo: yes that's what i meant with mis-alignment, i'm looking at this
kgugala_ has quit [Ping timeout: 265 seconds]
<somlo>
_florent_: got it, thanks (apologies for coming off dumber than usual, experiencing unusually high levels of multitasking over here :)
kgugala_ has joined #litex
kgugala has quit [Ping timeout: 246 seconds]
kgugala has joined #litex
kgugala_ has quit [Ping timeout: 260 seconds]
CarlFK has joined #litex
<_florent_>
somlo: the misalignment seems to be causes by some garbage data we get from the SDCard at the end of the initialization. I added some logic to ensure we flush this garbage data before doing the DMA:
<_florent_>
this seems to be working on my setup and with the BIOS (insert, sdcard_init, sdcard_read 0, eject, etc... sequence)
<_florent_>
can you do a test?
<somlo>
_florent_: thanks, working on it!
<somlo>
_florent_: superficially, with the existing linux driver on nexys4ddr, it's still failing to re-initialize the sdcard upon reinsertion -- still only works the first time the card is inserted
<somlo>
but I can confirm that from the bios perspective, initializing the card and reading any given block is repeatable and predictable, regardless of how many times we eject and reinsert/reinitialize the card
<somlo>
since my minimal gateware reproducer is now gone, I'll dig into the driver over the weekend and either figure out what it's doing wrong, or come up with another reproducer :)