fix(fpga): add FpgaResetBitstream() to force re-initialization

After aggressive field cycling (e.g. tear-off attacks), the FPGA's
internal SSC/DMA state can become corrupted even though the bitstream
is technically loaded. FpgaDownloadAndGo() caches downloaded_bitstream
and skips re-download if it matches, so subsequent commands fail
silently or hang.

Add FpgaResetBitstream() which sets downloaded_bitstream to
FPGA_BITSTREAM_UNKNOWN, forcing the next FpgaDownloadAndGo() to
perform a complete reload.
This commit is contained in:
xNovyz
2026-03-10 23:06:41 +01:00
parent 57f200d107
commit 0151c0d710
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -630,6 +630,10 @@ int FpgaGetCurrent(void) {
return downloaded_bitstream;
}
void FpgaResetBitstream(void) {
downloaded_bitstream = FPGA_BITSTREAM_UNKNOWN;
}
// Turns off the antenna,
// log message
// if HF, Disable SSC DMA
+1
View File
@@ -172,6 +172,7 @@ void SetupSpi(int mode);
bool FpgaSetupSscDma(uint8_t *buf, uint16_t len);
void Fpga_print_status(void);
int FpgaGetCurrent(void);
void FpgaResetBitstream(void);
void SetAdcMuxFor(uint32_t whichGpio);
// extern and generel turn off the antenna method