In spi.py, i read the following in the class SPI command interface
# Once CS is low, we'll shift in our command.
with m.State('RECEIVE_COMMAND'):
# If CS is de-asserted early; our transaction is being aborted.
with m.If(~spi.cs):
m.next = 'IDLE'
But it should be, something like the following.
# Once CS is low, we'll shift in our command.
with m.State('RECEIVE_COMMAND'):
m.d.sync += spi.sdo.eq(0)
# If CS is de-asserted early; our transaction is being aborted.
with m.If(~spi.cs):
m.next = 'IDLE'
In the current code, sdo is ill defined if a command is received. This can change depending upon whether a word is sent back.
A description of current behavior is here;
https://github.com/hstarmans/FPGAG/blob/master/test/FPGAG/test_luna.py