You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
On my Windows 11 PC I have a FT232H connected to a ST7789 display. When calling Show() on the display (MicroGraphics) my application hangs. I have traced it into the TftSpiBase calling Exchange on the SpiBus to write the data and in the Ft232H driver it seems that if there is no data available (displays don't send anything back, MISO/CIPO isn't even connected) then the code for the FT232H will just spin, looking for bytes to receive, see this snippet:
internal int ReadInto(Span<byte> buffer)
{
var totalRead = 0;
uint read = 0;
while (totalRead < buffer.Length)
{
var available = GetAvailableBytes();
if (available > 0)
{
Native.CheckStatus(
FT_Read(Handle, in buffer[totalRead], available, ref read));
totalRead += (int)read;
}
}
return totalRead;
}
In the above code GetAvailableBytes is always returning 0, so it will spin forever. I believe the root cause is that the TftSpiBase is calling Exchange on the SpiBus, instead of Write.
To Reproduce
Steps to reproduce the behavior:
Go to the Ft232h_Sample and add this method:
async Task TestSPIDisplay(FtdiExpander expander)
{
var display = new St7789
(
spiBus: expander.CreateSpiBus(),
chipSelectPin: expander.Pins.D0,
dcPin: expander.Pins.D1,
resetPin: null,
135, 240
);
var microGraphics = new MicroGraphics(display)
{
CurrentFont = new Font12x16(),
Rotation = RotationType._270Degrees
};
microGraphics.Clear();
microGraphics.DrawText(0, 0, "Loading Menu");
microGraphics.Show();
while (true)
{
Debug.WriteLine("Sleeping...");
await Task.Delay(1000);
}
}
Run it
If you set a breakpoint you'll see that we never get to the while (true) loop.
Note that you can run this without a display connected, but you need a FT232H adapter hooked up.
Expected behavior
No hanging or spinning loop, beautiful MicroGraphics visible on the display
The text was updated successfully, but these errors were encountered:
Describe the bug
On my Windows 11 PC I have a FT232H connected to a ST7789 display. When calling
Show()
on the display (MicroGraphics) my application hangs. I have traced it into the TftSpiBase callingExchange
on the SpiBus to write the data and in the Ft232H driver it seems that if there is no data available (displays don't send anything back, MISO/CIPO isn't even connected) then the code for the FT232H will just spin, looking for bytes to receive, see this snippet:In the above code
GetAvailableBytes
is always returning 0, so it will spin forever. I believe the root cause is that the TftSpiBase is callingExchange
on the SpiBus, instead ofWrite
.To Reproduce
Steps to reproduce the behavior:
while (true)
loop.Note that you can run this without a display connected, but you need a FT232H adapter hooked up.
Expected behavior
No hanging or spinning loop, beautiful MicroGraphics visible on the display
The text was updated successfully, but these errors were encountered: