#Updating MCU after Klipper Update

90 messages · Page 1 of 1 (latest)

empty wraith
#

I'm having issues with updating the CBs after the current Klipper update.
My operation for updating the firmware was:
ssh into raspberry pi
cd ~/klipper
make menuconfig (image attached)
make clean
make
./scripts/flash-sdcard.sh /dev/serial/by-id/usb-Klipper_stm32f407xx_440028001850324330373220-if00 btt-skr-2-f407

it seems to not be able to connect to the mcu. What process should I use to solve this issue?

inner badge
# empty wraith I'm having issues with updating the CBs after the current Klipper update. My op...

Your last command ./scripts/flash-sdcard.sh /dev/serial/by-id/usb-Klipper_stm32f407xx_440028001850324330373220-if00 btt-skr-2-f407 Where di youy get it ? Normally, you should get the name of the device using ls /dev/serial/by-id. Is this what you did ? if i'm not mistaken, it always ends with -if00, but i may be wrong.
Also, if you go through the terminal, you should put your mainboard on DFU mode

empty wraith
foggy bone
#

Your menuconfig screenshot shows the mcu being configured for uart (serial) com, not usb. Are you sure that's what you wanted?

empty wraith
foggy bone
empty wraith
foggy bone
#

The message you posted originally isn't a connection issue though

#

Its just a version mismatch

#

So if you have an actual connection failure, such as you would get if you flashed the firmware with an incorrect com interface setting...that's a different issue than the one in the screenshot

empty wraith
#

Running flash-sdcard.sh has issues with connecting to the mcu as I'm trying to solve the screen shotted issue

foggy bone
#

Well you haven't posted any of that output, so I have no comment on it

#

But make menuconfig doesn't impact the function of that command (just the results afterwards, if the firmware is wrong)

#

So trying different things in make menuconfig is neither going to help, nor hinder, a flash-sdcard issue

empty wraith
#

Ok so how can I solve the issue in the screenshot?

foggy bone
#

I mean, you're basically on the right track. You need to reflash the firmware on each of your 3 (yes, 3) mcus

#

But you need to use the correct settings for each mcu

#

And (apparently) you need a flashing technique that actually works for you, which you seem to be implying isnt flash-sdcard

empty wraith
#

ok heres my process:
ssh into rpi
cd klipper
make clean
maek menuconfig
make
cp out/klipper.bin to local computer
rename to firmware.bin
place on 8gb sd card and insert into mcu
turn voron on and hope

foggy bone
#

Should work. Of course, as described, that's only going to update 1 of 3.

#

But it should be easy enough to tell whether it took, based on whether one of the version numbers bumps

#

You could also show the full output from flash-sdcard. We might be able to get that going too 😛

empty wraith
#

pi@voron24:~/klipper $ ./scripts/flash-sdcard.sh /dev/serial/by-id/usb-Klipper_stm32f407xx_440028001850324330373220-if00 btt-skr-2-f407
Flashing /home/pi/klipper/out/klipper.bin to /dev/serial/by-id/usb-Klipper_stm32f407xx_440028001850324330373220-if00
Checking FatFS CFFI Build...
Connecting to MCU............................................................................................

SD Card Flash Error: Unable to connect to MCU
Traceback (most recent call last):
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1647, in main
spiflash.run()
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1584, in run
self.run_reactor_task(self.run_reset_upload)
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1570, in run_reactor_task
k_reactor.run()
File "/home/pi/klipper/klippy/reactor.py", line 292, in run
g_next.switch()
File "/home/pi/klipper/klippy/reactor.py", line 340, in _dispatch_loop
timeout = self._check_timers(eventtime, busy)
File "/home/pi/klipper/klippy/reactor.py", line 158, in _check_timers
t.waketime = waketime = t.callback(eventtime)
File "/home/pi/klipper/klippy/reactor.py", line 48, in invoke
res = self.callback(eventtime)
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1518, in run_reset_upload
self.mcu_conn.connect()
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1202, in connect
raise SPIFlashError("Unable to connect to MCU")
SPIFlashError: Unable to connect to MCU

foggy bone
#

did you stop klipper first?

empty wraith
#

I had the sd card in the wrong mcu the first time, heres the output in the correct slot...

#

pi@voron24:~/klipper $ ./scripts/flash-sdcard.sh /dev/serial/by-id/usb-Klipper_stm32f407xx_440028001850324330373220-if00 btt-skr-2-f407
Flashing /home/pi/klipper/out/klipper.bin to /dev/serial/by-id/usb-Klipper_stm32f407xx_440028001850324330373220-if00
Checking FatFS CFFI Build...
Connecting to MCU...Connected
Checking Current MCU Configuration...Done
MCU needs restart: is_config=1, is_shutdown=0
Attempting MCU Reset...Done
Waiting for device to reconnect.....Done
Connecting to MCU...Connected
Initializing SD Card and Mounting file system...

#

SD Card Information:
Version: 2.0
SDHC/SDXC: True
Write Protected: False
Sectors: 124669952
manufacturer_id: 3
oem_id: SD
product_name: SK64G
product_revision: 8.133
serial_number: FA423978
manufacturing_date: 7/2022
capacity: 59.4 GiB
fs_type: FAT32
volume_label: b''
volume_serial: 2267068614
Uploading Klipper Firmware to SD Card...Done
Validating Upload...Done
Firmware Upload Complete: firmware.bin, Size: 28980, Checksum (SHA1): B83508965309908B6255A275C7A538D5BCF2F7F7
Attempting MCU Reset...Done
Waiting for device to reconnect....Done
Connecting to MCU...Connected

#

SD Card Flash Error: Failed to Initialize SD Card. Is it inserted?
Traceback (most recent call last):
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1324, in _configure_mcu_spibus
self.fatfs.mount(printfunc)
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 327, in mount
raise OSError("flash_sdcard: failed to mount SD Card, returned %s"
OSError: flash_sdcard: failed to mount SD Card, returned FR_NOT_READY

During handling of the above exception, another exception occurred:

#

Traceback (most recent call last):
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1647, in main
spiflash.run()
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1589, in run
self.run_reactor_task(self.run_verify)
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1570, in run_reactor_task
k_reactor.run()
File "/home/pi/klipper/klippy/reactor.py", line 292, in run
g_next.switch()
File "/home/pi/klipper/klippy/reactor.py", line 340, in _dispatch_loop
timeout = self._check_timers(eventtime, busy)
File "/home/pi/klipper/klippy/reactor.py", line 158, in _check_timers
t.waketime = waketime = t.callback(eventtime)
File "/home/pi/klipper/klippy/reactor.py", line 48, in invoke
res = self.callback(eventtime)
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1557, in run_verify
self.mcu_conn.configure_mcu()
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1359, in configure_mcu
self._configure_mcu_spibus(printfunc=printfunc)
File "/home/pi/klipper/scripts/spi_flash/spi_flash.py", line 1327, in _configure_mcu_spibus
raise SPIFlashError(
SPIFlashError: Failed to Initialize SD Card. Is it inserted?

foggy bone
#

That's curious seems like it lost the sdcard when the mcu restarted

#

But it also seems like something did happen

#

If you start klipper back up, did any versions change?

empty wraith
#

seems one did update:

#

Your Klipper version is: v0.12.0-98-g5e433fff
MCU(s) which should be updated:
mcu: Current version v0.11.0-205-g5f0d252b
rpi: Current version v0.11.0-277-g21b78429
Up-to-date MCU(s):
z: Current version v0.12.0-98-g5e433fff

foggy bone
#

Great!

#

So now do the other one

empty wraith
#

but it seems that as I was trying to fix the other mcu the other way I mentioned the serial changes

foggy bone
#

How so?

empty wraith
#

in /dev/serial/by-id/ the id have changed from
/dev/serial/by-id/usb-Klipper_stm32f407xx_370039000850324E31333020-if00
to
/dev/serial/by-id/usb-Klipper_stm32f407xx_12345-if00

#

the id of the updated mcu didnt change

#

I have tried changing the serila in printer.cfg and trying the same process but it didnt update

foggy bone
#

Oh

#

So... that's an error in your make menuconfig

#

In the umm. What's it called now? Usb id...hang on. Gotta look

#

Yep. Under "usb ids" you should have "usb serial number from chipid" turned on

empty wraith
#

ok i had to do the card process to get the serial number back. I went through the process again but it does not show the mcu has updated

foggy bone
#

so you've put the firmware with the usb id setting fixed into both mcus, but only one of them took it?

empty wraith
#

seems so

foggy bone
#

and you did put a card with firmware.bin into each mcu? (remembering that when it flashes successfully, it gets renamed, so you have to rename it back before putting it into the second mcu)

empty wraith
#

maybe thats it

#

so i removed everything on that sdcard and tried again

pi@voron24:~/klipper $ ./scripts/flash-sdcard.sh /dev/serial/by-id/usb-Klipper_stm32f407xx_370039000850324E31333020-if00 btt-skr-2-f407
Flashing /home/pi/klipper/out/klipper.bin to /dev/serial/by-id/usb-Klipper_stm32f407xx_370039000850324E31333020-if00
Checking FatFS CFFI Build...
Connecting to MCU...Connected
Checking Current MCU Configuration...Done
Initializing SD Card and Mounting file system...

SD Card Information:
Version: 2.0
SDHC/SDXC: True
Write Protected: False
Sectors: 124669952
manufacturer_id: 3
oem_id: SD
product_name: SK64G
product_revision: 8.133
serial_number: FA423978
manufacturing_date: 7/2022
capacity: 59.4 GiB
fs_type: FAT32
volume_label: b''
volume_serial: 2267068614
Uploading Klipper Firmware to SD Card...Done
Validating Upload...Done
Firmware Upload Complete: firmware.bin, Size: 29028, Checksum (SHA1): 1B099A6B174AEAB6AC966590275369BA91AE7CC4
Attempting MCU Reset...Done
Waiting for device to reconnect....Done
Connecting to MCU...Connected

This board requires a manual reboot to complete the flash process.
If the board's bootloader uses SDIO mode for its SDCard, then a full
power cycle is required. Please perform the power cycle now and then
rerun this utility with the 'check' option to verify flash.

Attempting MCU Reset...Done
SD Card Flash Complete

#

shutdown and check but its still showing it as not updated

#

the check shows that its the right version though

foggy bone
#

sorry, I'm confused what you mean

#

what exactly is the red screen showing at this point?

empty wraith
#

Klipper reports: ERROR

MCU Protocol error

This is frequently caused by running an older version of the
firmware on the MCU(s). Fix by recompiling and flashing the
firmware.

Your Klipper version is: v0.12.0-98-g5e433fff
MCU(s) which should be updated:
mcu: Current version v0.11.0-205-g5f0d252b
rpi: Current version v0.11.0-277-g21b78429
Up-to-date MCU(s):
z: Current version v0.12.0-98-g5e433fff

Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.

mcu 'rpi': Command format mismatch: query_adxl345 oid=%c rest_ticks=%u vs query_adxl345 oid=%c clock=%u rest_ticks=%u

foggy bone
#

huh. well, I have to agree. only one of them has updated. still

#

so, manual flashing it is, I guess

#

put firmware.bin on to an sdcard (and it really would be better with a smaller card) and put it into the one that hasn't flashed yet

empty wraith
#

yep thats what works

#

so 1 left: rpi

#

i'm not sure what that is, could it be the input shaper

foggy bone
#

err

#

kinda

#

it ISN'T input shaper

#

it's stuff on your pi

#

but you probably installed it BECAUSE OF input shaper

#

so that you could attach your adxl to your pi

#

just repeat the "build the code" step here:

quaint stumpBOT
empty wraith
#

ok back up and running thanks for the help

gentle tapir
#

ok is there a fix code for the last update i have did what everyone else has done still not up and running please help

foggy bone
#

To be clear, "the thing" is rebuilding and reflashing the firmware on each of your two (real & virtual) mcus

gentle tapir
#

@foggy bone so redo form start to the pi and octopus just like a new build

gentle tapir
#

ok it up and this is now ehen i home it

foggy bone
#

If reinstalling led to timer too close errors, my guess would be you set something wrong in make menuconfig

gentle tapir
#

and i have a octopus pro

foggy bone
gentle tapir
#

it is my cnfg file iwill re do it

foggy bone
#

I don't actually think your config is likely to be the issue here

#

as I said, I think you probably did something wrong in the firmware for the octopus

gentle tapir
#

ok i just re flash the firmware on octpus with a new sd card and have the same thing

foggy bone
#

Can you grab a screenshot of make menuconfig ?

gentle tapir
#

will do

foggy bone
#

And I guess maybe a klipper log too rather than just the config

gentle tapir
#

@foggy bone well i did something to the pi sd card im just going re do it from start