Hi everyone, I recently got a Glasgow to play with and it has been super cool so far. I have been experimenting with the spi-controller applet to read data from microSD cards. I'm really impressed how easy it is to get something up and running with just a little bit of Python code. While using the default applets is fun, I also wanted to experiment with building some custom gateware. The idea is to move some of the sending a byte and checking the response from the Python code to the gateware to reduce the latency. So, I took the spi-controller applet and added in some extra commands. But when testing the gateware the FSM seems to get stuck after only sending a single byte. To get some more insight in what was going on, I decided to add a simulation test so I could look at all the signals. To my surprise the FSM just worked correctly in the simulation. My guess is that there is a subtle difference in how the SPI controller gateware works in simulation and on the hardware, but I can't figure out what the exact problem is. I have included a snippet of code for the state which gets stuck. This is part of a component which is basically identical to the SPIControllerComponent. ``` with m.State("Command-Wait-For-Ready"): m.d.comb += [ ctrl.i_stream.p.chip.eq(chip), ctrl.i_stream.p.mode.eq(spi.Mode.Swap), ctrl.i_stream.p.data.eq(0xFF), ] with m.If(should_tx): m.d.comb += ctrl.i_stream.valid.eq(1) with m.If(ctrl.i_stream.valid & ctrl.i_stream.ready): m.d.sync += should_tx.eq(0) with m.If(i_count != 0): m.d.comb += ctrl.o_stream.ready.eq(1) with m.If(ctrl.o_stream.valid & ctrl.o_stream.ready): m.d.sync += i_count.eq(i_count - 1) with m.If(i_count > 1): m.d.sync += should_tx.eq(1) with m.If(i_count == 0): m.d.sync += o_count.eq(6) m.next = "Command-Transmit" ``` I have also attached two screenshots, one of the simulation, which looks to be working correctly, and one of the logic analyzer output when attached to the hardware. I hope that someone can spot where I'm making a mistake, and if any more information is needed please let me know.