whitequark[cis] changed the topic of #glasgow to: https://glasgow-embedded.org · digital interface explorer · https://www.crowdsupply.com/1bitsquared/glasgow · code https://github.com/GlasgowEmbedded/glasgow · logs https://libera.catirclogs.org/glasgow · matrix #glasgow-interface-explorer:matrix.org · discord https://1bitsquared.com/pages/chat
<Jonimus> I'm trying to use my glasgow as a logic analyzer to log/RE an SPI interface but it imediately gives me a FIFO overrun error what does this mean and is there anything I can do about it?
<Jonimus> I'm trying to RE a device using a CC2500 rf chip that should be similar to the nrf24l01 device that is one of the example applets.
<Jonimus> If there is a way to say just log this SPI connection that would work as well. If this is not easily possible I have an older bus priate I could try but I'm not sure that is going to be fast enough.
DragoonAethis has quit [Quit: hej-hej!]
DragoonAethis has joined #glasgow
<Darius> Jonimus: what have you tried? eg what command line
<Jonimus> glasgow.exe run analyzer --port A --pins-i 1,2,3,4 -V 3.3 test.vcd
Emantor has quit [Quit: ZNC - http://znc.in]
Emantor has joined #glasgow
<whitequark[cis]> the analyzer applet has a number of issues that make it not very usable, it's something i'd like to improve but haven't got around to
<whitequark[cis]> enabling pullups or pulldowns might help if the cause is a floating pin that produces spurious transitions
<Jonimus> same results of FIFO overrun, shutting down
<whitequark[cis]> can you upload the resulting VCD?
FFY00_ has quit [Read error: Connection reset by peer]
FFY00 has joined #glasgow
jonimus[m] has joined #glasgow
<Jonimus> I just thre it in discord since that was the easest way to upload it.
FFY00 has quit [Remote host closed the connection]
<whitequark[cis]> yeah this worked
<jonimus[m]> That was pull-ups
<whitequark[cis]> the cause appears to be that there is too much data for the relatively small buffer that's available in the applet
FFY00 has joined #glasgow
<whitequark[cis]> I can probably throw together a dedicated SPI sniffer applet that would suffer from this less
<whitequark[cis]> actually, hold on
<whitequark[cis]> in applet/interface/analyzer/__init__.py, try changing iface.get_in_fifo() to iface.get_in_fifo(depth=12288)`
<whitequark[cis]> * in applet/interface/analyzer/__init__.py, try changing iface.get_in_fifo() to iface.get_in_fifo(depth=12288)
<whitequark[cis]> I'll probably still make a dedicated SPI sniffer applet since it would be a lot more usable
<whitequark[cis]> lemme just finish the other thing I've been working on
<Jonimus> gotta update my python after git pulling the latest so it'll be a second before I can test
<Jonimus> should not have git pulled I think, now I'm getting an assert in assembly.py "cannot find suitable interface"
<_whitenotifier-5> [glasgow] whitequark opened pull request #815: Clarify semantics of `uaccess` udev tag in the recommended rules file - https://github.com/GlasgowEmbedded/glasgow/pull/815
<_whitenotifier-5> [glasgow] whitequark commented on issue #441: udev rules on Arch(-ish) systems - https://github.com/GlasgowEmbedded/glasgow/issues/441#issuecomment-2887958913
<whitequark[cis]> Jonimus: okay, give me a moment
<whitequark[cis]> you're on windows, right?
<Jonimus> Yes, I could get linux if absolutely needed but it would be a bit.
<Jonimus> Actually I think my options for linux with a usb3 interface are limited at the moment because my install broke on my laptop and I haven't fixed it yet...
<whitequark[cis]> I'm getting a different error on Linux, let me fix that and if it doesn't do the trick I'll grab a Windows machine
<whitequark[cis]> okay, I think there are actually two bugs here
<Jonimus> If not I can deal, I was able to pick of a sigrok compatible fx2 board that'll be here sunday, though I'd obviously rather use my fancy glasgow thanks to your awesome work.
<whitequark[cis]> we should be able to get this sorted within a hour
<whitequark[cis]> okay, so the first problem is that line 615 should say `if config.getNumInterfaces() <= self._iface_count:`
<whitequark[cis]> and the other I'll just submit as a PR
Eli2 has quit [Quit: Ex-Chat]
<_whitenotifier-5> [glasgow] whitequark opened pull request #816: Fix a number of issues breaking the `analyzer` applet - https://github.com/GlasgowEmbedded/glasgow/pull/816
<whitequark[cis]> this should work
<_whitenotifier-5> [glasgow] whitequark synchronize pull request #813: Implement new applet API - https://github.com/GlasgowEmbedded/glasgow/pull/813
<Jonimus> Ok so very dumb question, how do I view this vcd file on windows?
<whitequark[cis]> gtkwave
<whitequark[cis]> or surfer
<whitequark[cis]> https://surfer-project.org/ has a browser based one
<_whitenotifier-5> [glasgow] whitequark synchronize pull request #813: Implement new applet API - https://github.com/GlasgowEmbedded/glasgow/pull/813
<_whitenotifier-5> [glasgow] whitequark synchronize pull request #813: Implement new applet API - https://github.com/GlasgowEmbedded/glasgow/pull/813
<_whitenotifier-5> [glasgow] whitequark synchronize pull request #813: Implement new applet API - https://github.com/GlasgowEmbedded/glasgow/pull/813
<whitequark[cis]> okay, new applet API is done I think
<Jonimus> I'm still getting FIFO errors after not too long, but I'm also new at any sort of RE work like this so I'm not sure how to turn this into the bytes being sent via spi, but its definitely something.
<whitequark[cis]> you could use pulseview... it's somewhat nightmarish to install on windows though
<whitequark[cis]> if you give me half a hour I should be able to make a dedicated SPI sniffer applet
<Jonimus> I'll look into that, if it'll run on WSL that migth work.
<whitequark[cis]> it miiiight run on WSL, but it's also incredibly janky software
<_whitenotifier-5> [glasgow] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-813-9df30cdf82a8cf1ece7dba6975582589e806209e - https://github.com/GlasgowEmbedded/glasgow
<_whitenotifier-5> [GlasgowEmbedded/glasgow] github-merge-queue[bot] pushed 6 commits to main [+0/-0/±21] https://github.com/GlasgowEmbedded/glasgow/compare/9df30cdf82a8...dc7391d515c8
<_whitenotifier-5> [glasgow] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-813-9df30cdf82a8cf1ece7dba6975582589e806209e - https://github.com/GlasgowEmbedded/glasgow
<_whitenotifier-5> [glasgow] whitequark closed pull request #813: Implement new applet API - https://github.com/GlasgowEmbedded/glasgow/pull/813
<whitequark[cis]> okay, we're very close to multiple simultaneous applets being possible now
<whitequark[cis]> i might make a prototype later
ali_as has quit [Remote host closed the connection]
<_whitenotifier-5> [glasgow] collinmay commented on pull request #815: Clarify semantics of `uaccess` udev tag in the recommended rules file - https://github.com/GlasgowEmbedded/glasgow/pull/815#issuecomment-2887999498
<threeflour[m]> Ooh nice! That'd be really cool to have
<_whitenotifier-5> [glasgow] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-815-dc7391d515c80801cb0e9e208050f1165a03358b - https://github.com/GlasgowEmbedded/glasgow
<_whitenotifier-5> [GlasgowEmbedded/glasgow] github-merge-queue[bot] pushed 1 commit to main [+0/-0/±1] https://github.com/GlasgowEmbedded/glasgow/compare/dc7391d515c8...3c84f4ff2a38
<_whitenotifier-5> [GlasgowEmbedded/glasgow] whitequark 3c84f4f - config: clarify semantics of `uaccess` udev tag.
<_whitenotifier-5> [glasgow] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-815-dc7391d515c80801cb0e9e208050f1165a03358b - https://github.com/GlasgowEmbedded/glasgow
<_whitenotifier-5> [glasgow] whitequark closed pull request #815: Clarify semantics of `uaccess` udev tag in the recommended rules file - https://github.com/GlasgowEmbedded/glasgow/pull/815
<_whitenotifier-5> [glasgow] whitequark closed issue #83: Applet analyzer does not work with async applets - https://github.com/GlasgowEmbedded/glasgow/issues/83
<_whitenotifier-5> [glasgow] whitequark commented on issue #83: Applet analyzer does not work with async applets - https://github.com/GlasgowEmbedded/glasgow/issues/83#issuecomment-2888030341
<Jonimus> hmm my wsl install seems kinda broken anyway, no gui apps are working even though everything I can find online says they should.
<whitequark[cis]> okay, gimme a bit to implement an SPI analyzer then
<whitequark[cis]> I've already started
<Jonimus> Its getting late here so I may not be able to test until tomorrow but I thank you greatly for the assistance so far!
<whitequark[cis]> okay, i have the gateware i think
<_whitenotifier-5> [glasgow] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-816-3c84f4ff2a38956ccbb8e366e45b120c50bb76bc - https://github.com/GlasgowEmbedded/glasgow
<_whitenotifier-5> [GlasgowEmbedded/glasgow] github-merge-queue[bot] pushed 5 commits to main [+0/-0/±5] https://github.com/GlasgowEmbedded/glasgow/compare/3c84f4ff2a38...5cedb3105b96
<_whitenotifier-5> [GlasgowEmbedded/glasgow] whitequark 1781cdc - hardware.assembly: accept configurations with more interfaces than we need.
<_whitenotifier-5> [GlasgowEmbedded/glasgow] whitequark 988b1d7 - hardware.assembly: don't crash after running out of pipes to configure.
<_whitenotifier-5> [GlasgowEmbedded/glasgow] whitequark 8bbb89f - legacy: don't crash if only one pipe is claimed.
<_whitenotifier-5> [GlasgowEmbedded/glasgow] ... and 2 more commits.
<_whitenotifier-5> [glasgow] whitequark closed pull request #816: Fix a number of issues breaking the `analyzer` applet - https://github.com/GlasgowEmbedded/glasgow/pull/816
<_whitenotifier-5> [glasgow] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-816-3c84f4ff2a38956ccbb8e366e45b120c50bb76bc - https://github.com/GlasgowEmbedded/glasgow
<whitequark[cis]> Jonimus: it works
<Jonimus> Sweet, on a side note pulseview has windows builds right on the website, so I fought with wsl for nothing.
<Jonimus> And it crashed..
<whitequark[cis]> would you like to test my applet?
<Jonimus> Sure
<_whitenotifier-5> [glasgow] whitequark opened pull request #817: Add SPI analyzer applet - https://github.com/GlasgowEmbedded/glasgow/pull/817
<_whitenotifier-5> [glasgow] whitequark synchronize pull request #817: Add SPI analyzer applet - https://github.com/GlasgowEmbedded/glasgow/pull/817
<Jonimus> giving it a try now
<Jonimus> It appears to be doing something, but the bits I'm interested seem to be scrolled out of my terminals buffer before I can grab them, how hard would it be to save that to a file?
<whitequark[cis]> what should the format be?
<whitequark[cis]> i guess just pairs of hex numbers
<Jonimus> Heck if there was a way to get the debug output you have that'd be fine. I'm just trying to see what chip init looks like and then what the output looks like from there.
<whitequark[cis]> one moment
<whitequark[cis]> check the PR again
<_whitenotifier-5> [glasgow] whitequark synchronize pull request #817: Add SPI analyzer applet - https://github.com/GlasgowEmbedded/glasgow/pull/817
<whitequark[cis]> (also the debug output is saved with glasgow -L debug.log ...)
<Jonimus> If you missed earlier I'm trying to RE/verify that a new devices does the same init work as an older device using a CC2500 rf chip.
<whitequark[cis]> i missed that, yeah
<Jonimus> so basically the same thing you did with the nrf chip
<whitequark[cis]> which of them?
<Jonimus> The one glasgow has an applet for
<whitequark[cis]> which of them? ^^
<whitequark[cis]> there are at least four that i recall
<whitequark[cis]> nrf24l01, nrf24l01p, nrf24le1, nrf24lu-something
<Jonimus> Oh well in this case it doesn't matter, my goal is to take what I learn about what the offical Transmitter does and apply that to this https://github.com/pascallanger/DIY-Multiprotocol-TX-Module project
<Jonimus> Which supports the nrf24l01/p, the cc2500 and 3 other similar chips all in one package. But the protcol support is is currently either ship the hardware to the dev or try to get dumps of the spi comms for them to work from.
<Jonimus> Well I was able to confirm a good bit of what I wanted already on the cheaper TX I have, I'll have to do the same setup to my nicer TX and see if the one that actually receives telemetry does anything different though I suspect not but that was the goal.
<whitequark[cis]> nice
<Jonimus> thanks again for the help I'm gonna try to get some sleep and play some more in the morning. If this goes well I'll be trying this on a nrf based unit as well to double check that it matches what the project has documented and be looking into if there are more things I can add.
<whitequark[cis]> you're welcome!
<whitequark[cis]> i'm going to fiddle with this thing a bit more, it seems to not handle overflows that well when paired with a fast SPI device (SD card here)
<whitequark[cis]> oh, it's because this device polls the SD card at 27 MHz (the applet is only supposed to work at 24 MHz...)
<_whitenotifier-5> [glasgow] whitequark synchronize pull request #817: Add SPI analyzer applet - https://github.com/GlasgowEmbedded/glasgow/pull/817
<_whitenotifier-5> [glasgow] whitequark opened pull request #818: Implement COBS encoder and decoder - https://github.com/GlasgowEmbedded/glasgow/pull/818
<whitequark[cis]> so, the SPI analyzer works basically fine with slow SCKs, but I'm not happy with it
<whitequark[cis]> i think sampling the SPI from the system clock (48 MHz in our case) is very limiting: you can sniff at most 24 MHz SPI signals, but realistically it's less than that, especially if we're talking about dense, back-to-back transfers
<whitequark[cis]> i could always make a faster clock domain, but it would still be limiting, just somewhat less so
<_whitenotifier-5> [glasgow] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-818-5cedb3105b962db00f0fbc7403964c7ad751f03c - https://github.com/GlasgowEmbedded/glasgow
<whitequark[cis]> of course, i could always make a clock domain driven by SCK. but the problem in that case is: what happens once you raise CS#? you might no longer have any clock cycles, and so you wouldn't have any good way to push the "this is the end of the packet" message into the FIFO
<Wanda[cis]> mmmmm
<whitequark[cis]> proposal: implement a [glitchless clock mux](https://vlsitutorials.com/glitch-free-clock-mux/) in iCE40 fabric and just switch to the system clock when CE# is high
<Wanda[cis]> clearly you need DDR clocking and a clock XOR
<whitequark[cis]> the clock mux is a 4-input, 1-output function which fits into a single LUT and with care applied to the truth table it could be made glitchless
<_whitenotifier-5> [GlasgowEmbedded/glasgow] github-merge-queue[bot] pushed 1 commit to main [+2/-0/±2] https://github.com/GlasgowEmbedded/glasgow/compare/5cedb3105b96...3fdca6151a79
<_whitenotifier-5> [glasgow] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-818-5cedb3105b962db00f0fbc7403964c7ad751f03c - https://github.com/GlasgowEmbedded/glasgow
<_whitenotifier-5> [glasgow] whitequark closed pull request #818: Implement COBS encoder and decoder - https://github.com/GlasgowEmbedded/glasgow/pull/818
<whitequark[cis]> so you would use the resynchronized select signal to pick the action: shift in data or shift in end
<Wanda[cis]> ... 4-input, 1-output?
<Wanda[cis]> oh, that part
<Wanda[cis]> but
<Wanda[cis]> are you going to use the whole circuit as-is, with the flops?
<whitequark[cis]> yeah
<Wanda[cis]> it has a problem: switching away from a stopped clock does not work
<whitequark[cis]> oh right. i thought for some reason that switching away from a clock that is high does not work
<whitequark[cis]> but you are right
<Wanda[cis]> could always do some async design crimes
<whitequark[cis]> my headmate suggests not doing any of it but rather add a 1 bit resetless register that gets flipped for the first byte that is clocked into the FIFO on SPI side
<whitequark[cis]> s/it/this/
<whitequark[cis]> then on the other side, every time this flag flips polarity, it means there was a gap in CS#
<whitequark[cis]> and the SPI state machine in this case would be reset on CS#. provided there is no hold time violation between SCK and CS# i think this will work?
<whitequark[cis]> (and if there is, i guess it chews off one last byte, which isn't too bad; or CS# could be delayed via LUT crimes)
<whitequark[cis]> i want this applet to work at least up to 65 MHz which is roughly where ECP5, Xilinx, and Intel flash SCK is
<whitequark[cis]> 130 MHz would be ideal but probably pointless without HyperRAM
<whitequark[cis]> <whitequark[cis]> "my headmate suggests not doing..." <- ie if the register is 0 on reset, clock the first byte with 1 and flip it to 1 at the 8th SCK edge; this avoids transactions being glued together if someone clocks in only a few cycles and abandons a transaction
<whitequark[cis]> * ie if the register is 0 on reset, clock in the first pair of bytes with flag set to 1 and flip the register to 1 at the 8th SCK edge; this avoids transactions being glued together if someone clocks in only a few cycles and abandons a transaction
<whitequark[cis]> i can't actually think of any async crimes that would make this work given the very few constraints on SCK and CS#
Eli2 has joined #glasgow
ali_as has joined #glasgow
<whitequark[cis]> asjackson: so, all of the changes i was talking about to the applet system have landed in `main`
<whitequark[cis]> if you update your applet to use them (see the UART applet or the boilerplate example code) you will be able to instantiate two GPIB applets talking to each other easily
<asjackson> awesome stuff whitequark[cis] :) i will hopefully look at updating the bits tomorrow or monday
<whitequark[cis]> cool!
jfsimon has joined #glasgow
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #glasgow
<whitequark[cis]> <whitequark[cis]> "my headmate suggests not doing..." <- it works in simulation
<whitequark[cis]> once again i'm incredibly pleased with how easy it is to set up simulations for applet components with amaranth 0.5
<whitequark[cis]> historically i just didn't bother doing this because it was pure suffering, not anymore though
<whitequark[cis]> like, this is all you need to do a three clock domain async-heavy simulation: https://paste.debian.net/1375192/
<whitequark[cis]> instead of the old await iface.read(None) aka await iface.read() you now have to do await self._pipe.recv(self._pipe.readable or 1)
<whitequark[cis]> and I think this is much better because it has well defined semantics that is clear from the invocation
<whitequark[cis]> whoa, it works!!
<_whitenotifier-5> [glasgow] whitequark synchronize pull request #817: Add SPI analyzer applet - https://github.com/GlasgowEmbedded/glasgow/pull/817
<whitequark[cis]> check this out:
<asjackson> what's going on :D
<asjackson> 🏳️‍🌈
<whitequark[cis]> i have this risc-v devboard which reads a BMP from an SD card and displays it on a screen
<whitequark[cis]> long ago i came up with this particular bmp (or rather the less-glitched version of it) and put it on an SD card to test
<asjackson> nice!
<whitequark[cis]> and now i'm having the SPI analyzer extract all of the SD transactions and get data from them and write it to a file
<whitequark[cis]> which lets me grab the chunk of data corresponding to the image file and display it
<_whitenotifier-5> [glasgow] whitequark commented on pull request #817: Add SPI analyzer applet - https://github.com/GlasgowEmbedded/glasgow/pull/817#issuecomment-2888528055
remexre has joined #glasgow
dustinm`_ has quit [Ping timeout: 276 seconds]
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #glasgow
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #glasgow
dustinm`_ has joined #glasgow
<whitequark[cis]> hm, now that i'm testing it, it doesn't work very well at 24M
<whitequark[cis]> but i'm not sure if it's the analyzer or the wiring or the signal source or what else
<whitequark[cis]> looks to be at least partly due to how the qspi-controller applet works
<whitequark[cis]> yeah, after improving the wiring and adding a delay before deassertion and after reassertion of CS#, it works a lot better
<whitequark[cis]> not entirely clear what's going on, either a timing violation or just a signal integrity issue (i feel like it's probably the latter?)
Attie[m] has joined #glasgow
<Attie[m]> oh, this reminds me... I was trying to interface with an SPI device a while back, and it has fairly substantial timing requirements from asserting CS, to the first clock edge.
<Attie[m]> frustratingly I don't remember what it was now, and I wasn't in a position to tinker with Glasgow to get it working
<Attie[m]> (it was a pressured day on site with a customer...)
<whitequark[cis]> i think it's mostly signal integrity issues more so than design issues with the applet... at least thus far