diff --git a/python/spi.py b/python/spi.py index 89018a6a..d853ba80 100644 --- a/python/spi.py +++ b/python/spi.py @@ -322,6 +322,9 @@ class STBootloaderSPIHandle(BaseSTBootloaderHandle): """ Implementation of the STM32 SPI bootloader protocol described in: https://www.st.com/resource/en/application_note/an4286-spi-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf + + NOTE: the bootloader's state machine is fragile and immediately gets into a bad state when + sending any junk, e.g. when using the panda SPI protocol. """ SYNC = 0x5A diff --git a/tests/hitl/5_spi.py b/tests/hitl/5_spi.py index 6964c9ab..106a1c7d 100644 --- a/tests/hitl/5_spi.py +++ b/tests/hitl/5_spi.py @@ -3,29 +3,10 @@ import pytest import random from unittest.mock import patch -from panda import Panda, PandaDFU -from panda.python.spi import SpiDevice, PandaProtocolMismatch, PandaSpiNackResponse +from panda import Panda +from panda.python.spi import PandaProtocolMismatch, PandaSpiNackResponse -@pytest.mark.skip("doesn't work, bootloader seems to ignore commands once it sees junk") -def test_dfu_with_spam(p): - dfu_serial = p.get_dfu_serial() - - # enter DFU - p.reset(enter_bootstub=True) - p.reset(enter_bootloader=True) - assert Panda.wait_for_dfu(dfu_serial, timeout=19), "failed to enter DFU" - - # send junk - d = SpiDevice() - for _ in range(9): - with d.acquire() as spi: - dat = [random.randint(-1, 255) for _ in range(random.randint(1, 100))] - spi.xfer(dat) - - # should still show up - assert dfu_serial in PandaDFU.list() - class TestSpi: def _ping(self, mocker, panda): # should work with no retries