Mcu protocol error

I have to reflash the firmware every time I want to print something. The mcu and host have the same build but if i restart klipper something goes wrong where it thinks its on the old build still and I get an error. If you look under system loads the mcu is the same version as the host but it does not recognize it for some reason. has anyone else run into this and is it a simple fix.

It sais everything. You Need to Flash your Board with the latest klipper Firmware. Look at your Board manual how to Flash Firmwares. Klipper at host 0.10.x klipper at mcu 0.9.x

I have done so multiple times. It works while printing but if it is shut down when I turn it back on i get this error. It shows up as the same under mcu just not in the error itself. It also seems weird that sometimes when I reboot the mcu doesn’t show up under system loads until I flash it again.

if I look at the log, the last line is :

Build file /home/pi/klipper/klippy/../out/klipper.dict(7723): Fri Oct 14 17:08:42 2022
Last MCU build version: v0.10.0-608-g638303b3
Last MCU build tools: gcc: (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] binutils: (2.31.1-11+rpi1+11) 2.31.1
Last MCU build config: BUS_PINS_i2c1=PB6,PB7 BUS_PINS_i2c3=PA8,PC9 BUS_PINS_i2c2=PB10,PB11 BUS_PINS_spi3a=PC11,PC12,PC10 BUS_PINS_spi2a=PC2,PC3,PB10 BUS_PINS_i2c1a=PB8,PB9 RESERVE_PINS_crystal=PH0,PH1 STEPPER_BOTH_EDGE=1 ADC_MAX=4095 BUS_PINS_spi4=PE13,PE14,PE12 BUS_PINS_spi3=PB4,PB5,PB3 BUS_PINS_spi2=PB14,PB15,PB13 BUS_PINS_spi1=PA6,PA7,PA5 RESERVE_PINS_USB=PA11,PA12 PWM_MAX=255 MCU=stm32f446xx STATS_SUMSQ_BASE=256 BUS_PINS_spi1a=PB4,PB5,PB3 CLOCK_FREQ=180000000
Build file /home/pi/klipper/klippy/../out/klipper.elf(299668): Fri Oct 14 17:08:52 2022

However a few lines above that is the old build for some reason:

Extruder max_extrude_ratio=83.150338
mcu 'mcu': Starting serial connect
webhooks client 1949133560: New connection
webhooks client 1949133560: Client info {'program': 'Moonraker', 'version': 'v0.7.1-705-g2603cc2'}
Loaded MCU 'mcu' 91 commands (v0.9.1-568-ga0c27571 / gcc: (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907] binutils: (2.31.1-11+rpi1+11) 2.31.1)
MCU 'mcu' config: BUS_PINS_i2c1=PB6,PB7 BUS_PINS_i2c2=PB10,PB11 BUS_PINS_spi3a=PC11,PC12,PC10 BUS_PINS_spi2a=PC2,PC3,PB10 BUS_PINS_i2c1a=PB8,PB9 RESERVE_PINS_USB=PA11,PA12 CLOCK_FREQ=180000000 BUS_PINS_spi1a=PB4,PB5,PB3 STATS_SUMSQ_BASE=256 STEP_DELAY=2 ADC_MAX=4095 BUS_PINS_spi4=PE13,PE14,PE12 RESERVE_PINS_crystal=PH0,PH1 BUS_PINS_spi2=PB14,PB15,PB13 BUS_PINS_spi1=PA6,PA7,PA5 BUS_PINS_spi3=PB4,PB5,PB3 MCU=stm32f446xx
Protocol error
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 180, in _connect
    cb()
  File "/home/pi/klipper/klippy/mcu.py", line 726, in _connect
    config_params = self._send_get_config()
  File "/home/pi/klipper/klippy/mcu.py", line 704, in _send_get_config
    "config is_config=%c crc=%u is_shutdown=%c move_count=%hu")
  File "/home/pi/klipper/klippy/mcu.py", line 856, in lookup_query_command
    cq, is_async, self._printer.command_error)
  File "/home/pi/klipper/klippy/mcu.py", line 497, in __init__
    serial.get_msgparser().lookup_command(respformat)
  File "/home/pi/klipper/klippy/msgproto.py", line 319, in lookup_command
    msgformat, mp.msgformat)
  File "/home/pi/klipper/klippy/msgproto.py", line 244, in _error
    raise error(self.warn_prefix + (msg % params))
error: mcu 'mcu': Command format mismatch: config is_config=%c crc=%u is_shutdown=%c move_count=%hu vs config is_config=%c crc=%u move_count=%hu is_shutdown=%c
Build file /home/pi/klipper/klippy/../.config(2724): Thu Oct 13 19:21:28 2022

I think i fixed it. I was able to go into the pi with winscp to look at the files. It seems like there was a copy of the old config still in the filesystem labeled as .config_old under the klipper folder. It was greyed out so it didn’t show up when using ssh. I don’t know why it was left there but if anyone has this issue I suggest using ssh to get rid of the old config.

go to the klipper folder using

cd ~/klipper

then use this to show all files

ls -a

and if there is a .config.old or .config_old, I can’t remember how it was formatted, just delete it using

rm .config.old

Hopefully someone will correct me if I’m wrong but this seems to have been the solution for me as everything is working fine now.

1 Like

Well it turns out I was wrong and the error still comes up. I uninstalled and reinstalled klipper but that didn’t help at all. I feel like I tried everything but I can’t figure it out. Any help would be appreciated. Until then I guess I’ll just keep flashing the mcu every time I want to print something.

What kind of board/mcu are you using? How does it flash, via SD Card? It sounds like the bootloader has stored an old version and is flashing it every time you reset.

I have a fysetc spider board that I flash over usb using ssh through the raspberry pi. I was using kiauh to flash it but to rule it out as the problem I started flashing through the command line. I hadn’t thought about using an sd card because I’ve always done it through usb. There is no sd card in the board at the moment so I guess I’ll try flashing it with an sd card next time.

I was unable to flash it with the sd card but I ended up finding the stock firmware and flashing that with the STM32CubeProgrammer. After everything was essentially erased I reinstalled klipper. Everything works now but I still wish I knew why I had this issue to begin with.