Thanks for reaching back out to me. So I made the simple program.
public class Program
static SPI SPI_Bus;
static byte tx_data, rx_data, m_tx_data, m_rx_data;
public static void Main()
SPI.Configuration config_A = new SPI.Configuration(GHI.Pins.G30.Gpio.PC7, false, 0, 0, false, false, 500, GHI.Pins.G30.SpiBus.Spi2);
SPI.Configuration config_B = new SPI.Configuration(GHI.Pins.G30.Gpio.PB0, false, 3, 0, false, true, 500, GHI.Pins.G30.SpiBus.Spi2);
SPI_Bus = new SPI(config_A);
tx_data = new byte;
rx_data = new byte;
tx_data = 0xA1;
tx_data = 0xA2;
tx_data = 0xA3;
m_tx_data = new byte;
m_rx_data = new byte;
m_tx_data = 0xB1;
m_tx_data = 0xB2;
m_tx_data = 0xB3;
SPI_Bus.Config = config_A;
SPI_Bus.Config = config_B;
SPI_Bus.WriteRead(m_tx_data, m_rx_data); // this is where the problem is expected
SPI_Bus.WriteRead(m_tx_data, m_rx_data); // the second transmission is expected to work
And this is what I see on my analyzer:
The program is straightforward. The pattern you see here repeats for forever. Interestingly, the “incorrect” transaction is always the same when the data is not changing between transactions. It looks to me like the G30 won’t pull the line low until a few clocks in. Further more my analyzer doesn’t even see three bytes here. I’m counting 24 clock pulses for the correct transaction and 22 for the incorrect.
Here you see MISO working but I have verified that this happens even without the devices attached so it can’t be logic level issues or signal integrity.
My program here demonstrates an obvious workaround. But I don’t rest easy knowing my receiving device receives something invalid at unknown times.
Can you reproduce the issue and see what causes the behavior?
SDK: Netmf 4.3 SDK (release notes match this firmware number)
It may be worth stating that if both configurations have Clock_polarity set to false then the issue does not occur. Of course this is not a viable fix because the G30 will not stabilize logic when Device B expects.