Skip to content
Go to file

Latest commit

The last byte of a multi-DMA i2c transfer could be lost, not because
of an error in the i2c display controller, but because of a bug in
FlashFloppy's I2C DMA handling.

When the last byte of a transmit is acknowledged by the receiver,
I2C sets the BTF flag in SR1. This is not cleared until SR1 is read
and a further byte is transmitted. Unfortunately this means that if
we are slow to start a new DMA after the previous completes, BTF
gets set. And it won't clear because we don't read SR1. Then at the
end of the final DMA, we wait for BTF and then issue STOP. But
because BTF is already set, we issue STOP too early and the final
byte is not transmitted.

The fix is to always wait for BTF at the end of a DMA transfer.
Because this requires us to wait for the final two bytes (one in the
data register, and one in the shift register) the delay can be 50us
(Fast I2C) up to 200us (Standard I2C). We avoid spin-waiting by
enabling the I2C Event IRQ and calling back into the DMA pipeline
when we are interrupted on BTF.

Git stats


Failed to load latest commit information.
Latest commit message
Commit time


FlashFloppy is a floppy-drive emulator for the ubiquitous Gotek hardware. Connect to retro machines just like a real floppy drive but use disk images on a modern USB stick!

  • Say goodbye to old and unreliable floppy disks
  • Download and play from the disk-image archives for your retro machines

FlashFloppy is the #1 floppy emulator:

FlashFloppy is Free and Open-Source Software.




FlashFloppy is a labour of love: working on it takes a lot of time and effort. Although it is Free Software and a pet project of mine, beer & coffee tokens will fuel me in the push onwards and upwards!

For further information please see the Donations page.


Most code is public domain; the rest is MIT/BSD or Open Source friendly (see the COPYING file).

The source code, and all binary releases, are freely redistributable in any form. Because FlashFloppy includes third-party code, you should include or link to the COPYING file in any redistribution.

This means, for example, you are free to sell and profit from Gotek devices programmed with a binary release of FlashFloppy. However at a minimum you should incorporate or link to the COPYING file on your selling page. For example:

  • FlashFloppy is free software. For more information see the license.


Floppy drive emulator for Gotek hardware




No packages published


You can’t perform that action at this time.