RatOS - Unknown pin chip name 'vref_scaled'
I currently have my 3D Printer up and running mainline Klipper with a Duet 6HC v1.02. Today, I started testing to see if I could migrate to RatOS even though it does not officially support the Duet series of boards.
I copied over my (almost entire) working configuration to the printer.cfg file (this includes a board_pins mapping).
Unfortunately, I am running into an error saying
Unknown pin chip name 'vref_scaled'
Here are my configuration sections that utilize verf_scaled:
[board_pins duet3_6hc]
mcu: mcu
aliases:
temp0=PC15
# VSSA Sense
vssa=PC13,
# VREF Sense
vref=PC0,
[adc_scaled vref_scaled]
vref_pin: vref
vssa_pin: vssa
[heater_bed]
sensor_pin: vref_scaled:temp0
Any idea why it is causing the error?124 Replies
Error from klippy.log:
Config error
Traceback (most recent call last):
File "/home/pi/klipper/klippy/klippy.py", line 175, in _connect
self._read_config()
File "/home/pi/klipper/klippy/klippy.py", line 141, in _read_config
self.load_object(config, section_config.get_name(), None)
File "/home/pi/klipper/klippy/klippy.py", line 130, in load_object
self.objects[section] = init_func(config.getsection(section))
File "/home/pi/klipper/klippy/extras/heater_bed.py", line 28, in load_config
return PrinterHeaterBed(config)
File "/home/pi/klipper/klippy/extras/heater_bed.py", line 11, in __init__
self.heater = pheaters.setup_heater(config, 'B')
File "/home/pi/klipper/klippy/extras/heaters.py", line 272, in setup_heater
sensor = self.setup_sensor(config)
File "/home/pi/klipper/klippy/extras/heaters.py", line 292, in setup_sensor
return self.sensor_factories[sensor_type](config)
File "/home/pi/klipper/klippy/extras/thermistor.py", line 103, in create
return PrinterThermistor(config, self.params)
File "/home/pi/klipper/klippy/extras/thermistor.py", line 83, in PrinterThermistor
return adc_temperature.PrinterADCtoTemperature(config, thermistor)
File "/home/pi/klipper/klippy/extras/adc_temperature.py", line 23, in __init__
self.mcu_adc = ppins.setup_pin('adc', config.get('sensor_pin'))
File "/home/pi/klipper/klippy/pins.py", line 117, in setup_pin
pin_params = self.lookup_pin(pin_desc, can_invert, can_pullup)
File "/home/pi/klipper/klippy/pins.py", line 98, in lookup_pin
pin_params = self.parse_pin(pin_desc, can_invert, can_pullup)
File "/home/pi/klipper/klippy/pins.py", line 83, in parse_pin
raise error("Unknown pin chip name '%s'" % (chip_name,))
pins.error: Unknown pin chip name 'vref_scaled'
webhooks client 4122328464: New connection
webhooks client 4122328464: Client info {'program': 'Moonraker', 'version': 'v0.8.0-379-g346a3d7'}
Because vref_scaled isn't listed under aliases
But you shouldn't be making aliases anyway. Just use the pin names directly
The vref_scaled is not an alias though, it's using this supported config from the Config_Reference.md document (both in mainline Klipper and RatOS docs). @blacksmithforlife πΊπΈ
Also for context, I have been using aliases with this particular board because it better aligns with the Duet pinout specifications rather than ordinary Klipper pins. This makes it a lot easier to set up the configuration files.
You can't do aliases for virtual "chip"s like adc_scaled
if you could it would have to go something like:
I removed the aliases from the adc_scaled section, see below:
[adc_scaled vref_scaled]
vref_pin: PC0
vssa_pin: PC13
I am still encountering the Unknown pin chip name 'vref_scaled'.you might want to look at https://github.com/Klipper3d/klipper/blob/master/config/generic-duet3-6hc.cfg for a working klipper example
That was my starting reference when I first built my configuration. It's just weird that it's working fine on regular Klipper but not on RatOS.
My newly revised adc_scaled matches the reference you provided.
ratos is klipper
https://os.ratrig.com/docs/introduction
Why is it working on my machine not running RatOS then π
upload your non-working printer.cfg
lines 49-96, get rid of them and reference the pin directly
example
becomes
For context, are aliases not compatible with RatOS? I would really prefer to keep them as they match up with the Duet pinout image.
you have
but the example I gave has
sure they are fine, but you really don't need them
I know that I don't need them but they are convenient π
(at least for Duet boards specifically)
except when the alias is causing problems like in
vref_scaled:temp2
Works on my other Klipper instance π€·ββοΈ
upload your working printer.cfg
I updated all of the lines that have the vref_scaled to the actual pin. I still have the same error :/
you have a completely different ordering in that file. Ordering matters because you can overwrite previous definitions
I assume the
temp0
is in [include pin_aliases_duet3_6hc.cfg]
?Yes
It's the same section that's in the non-working CFG.
klipper will dump the combined configs into one in the klipper.log file. I would suggest you compare the config output between the working and non-working klipper.log files
yes, but it in a different order. Plus that working one has a lot of includes that I can't see. You need to compare apples to apples
Are includes supported in RatOS for reference?
again, ratos in this case is just klipper
I ask because RatOS has user overrides and my board is 100% not supported by RatOS natively (but is in Klipper of course), that is why I'm being thorough.
Here's my full config for reference. https://github.com/DrFate09/daedalus_klipper/tree/main/printer_data/config
GitHub
daedalus_klipper/printer_data/config at main Β· DrFate09/daedalus_kl...
Contribute to DrFate09/daedalus_klipper development by creating an account on GitHub.
but the klipper.log file makes it easier as it combines everything for you instead of me having to do it manually by looking at your git repo.
For example:
I appreciate your patience π€
After comparing the two klippy.log files (left: RatOS, right: Klipper), on RatOS, the adc_scaled is one of the last config lines loaded while for Klipper, it is one of the first config lines loaded.
Why is RatOS moving it to one of the last config lines while it is one of the first lines in the printer.cfg?
I think the issue is that RatOS is moving the adc_scaled below the configs that reference vref_scaled like this example with the bed heater.
Line 62634 (vref_scaled) vs line 62305 (heater_bed)
ratos isn't doing anything you have
[include RatOS.cfg]
near the top of your printer.cfg. that defines a bunch of things first and everything else gets shifted down. So it seems like you need to define
before including RatOS.cfgThat fixed the issue, thanks! Running into another one, pin ADC_TEMPERATURE used multiple times in config.
you will have to start digging into the includes and what not to see what is trying to use that pin
Just found the solution to that last one π
what was the problem?
I actually have a new issue. I have the issue where pin PC13 is used too many times. Looking at the Klippy.log, it is specified as the pin for vssa_pin but it is also being injected from my fake Octopus board.
I believe it's maybe because the vref_scaled is used several times in different temperature lines.
I used this config to override it. [duplicate_pin_override] pins: ADC_TEMPERATURE
I used this config to override it. [duplicate_pin_override] pins: ADC_TEMPERATURE
do you need to specify it multiple times? Better to actually fix it instead of putting a bandaid on it with
duplicate_pin_override
Yes, it's a shared virtual chip on the Duet board for thermistors.
See extruder and heater_bed sections: https://github.com/Klipper3d/klipper/blob/master/config/generic-duet3-6hc.cfg
GitHub
klipper/config/generic-duet3-6hc.cfg at master Β· Klipper3d/klipper
Klipper is a 3d-printer firmware. Contribute to Klipper3d/klipper development by creating an account on GitHub.
It's supported here, but it's not supported as suffixes to vref_scaled when used, like the below is no go.
But this is fine
@miklschmidt any idea on this one?
it is specified as the pin for vssa_pin but it is also being injected from my fake Octopus board.For what? Just override whatever is using PC13 incorrectly with the correct pin
I have and it's vssa_pin = PC13
The only other mentions in my klippy.log are from the Octopus board.
No what else is using PC13?
you can have PC13 a million times in the board_pin aliases, that's no problem, it's only when used that you have to refer to it by the same name, and it can only have one purpose.
It's also being injected as my Stepper Z step_pin.
So if klipper tells you you're using PC13 more than once, that's because you've assigned PC13 to more than the vssa_pin in [adc_scaled vref_scaled]
You should probably correct that in your modified board's config.cfg then π
I have though.
(note that the configurator will need to be restarted to pick up changes in configs)
I'm rebooting the Pi, let me see what it does.
That will restart the configurator service, which in turn will generate a new RatOS.cfg when it starts back up.
And if you've fixed you config.cfg that should then resolve the problem.
Mind taking a look at this? I'm not understanding the issue unfortunately.
Poop, I just realized that most of my overrides in my printer.cfg are being ignored.
Left printer.cfg, right klippy.log.
I think i'm going to need a debug zip (download from side menu in the configurator) π
Also this is the very top of the log, this may be days old
you want to look at the very end
there's a whole bunch of crap in printer.cfg that you don't need.
Wait which version of RatOS did you install?
I used the Rollover Logs feature to clean out the klippy.log before I shared it with you.
I'm using the latest Release Candidate from GitHub, RatOS-v2.1.0-RC1.
As requested.
Ah dangerklipper, nice π
Or you mean the mainsail button?
Either way, doesn't matter π
excellent
Here's a fresh log from RatOS.
Well, you don't want RatOS.cfg at the bottom for starters
That makes RatOS override all of your stuff.
It should be at the very top
https://discord.com/channels/582187371529764864/1250993879117860894/1251232068604530780
^^followed his advice
that was just that one section
Not your entire configuration π
Gotcha, let me try that.
so line 103-105 goes to the top. Then 347-350 immediately follows that, then the rest of your stuff
pin ADC_TEMPERATURE used multiple times in config
I'll try moving my override like the other section.
I don't see ADC_TEMPERATURE defined in your printer.cfg anywhere
π€·ββοΈ
It's just marked as a duplicate_pin_override
maybe just remove that as you don't seem to use it?
Removed it and now this again.
uhm.. where.. sec.. will look in the log
it's not in the log either
Did you add a new include or something?
Nope.
wut
If I had to bet on it, it's this section that is shared between multiple thermistors:
[adc_scaled vref_scaled]
vref_pin: PC0
vssa_pin: PC13
So it's like a hidden built in klipper alias? i've never seen it before
What do you mean?
The ADC_TEMPERATURE?
Yes, there's no pin called "ADC_TEMPERATURE"
And you're not assigning it anywhere
So wtf is it π
this is used like
vref_scaled:pin
. Not ADC_TEMPERATURE
.https://github.com/Klipper3d/klipper/blob/fcf064ba6851042a12a71975c229a9670b34cf31/src/atsam/adc.c#L15
Well hello there..
GitHub
klipper/src/atsam/adc.c at fcf064ba6851042a12a71975c229a9670b34cf31...
Klipper is a 3d-printer firmware. Contribute to Klipper3d/klipper development by creating an account on GitHub.
it's some internal SAM* implementation hocus pocus
Apropos Duet boards and quirks
Here's another error, Option 'spi_bus' is not valid in section 'tmc5160 stepper_x'
yeah use software_spi instead of spi_bus
hardware spi is super broken
Option 'software_spi' is not valid in section 'tmc5160 stepper_x'
Wrong string?
spi_software_mosi_pin = PA7
spi_software_miso_pin = PA6
spi_software_sclk_pin = PA5
cs_pin = PC4
Replace those with the duet pins
Dah hell, Option 'spi_software_mosi_pin' is not valid in section 'tmc5160 stepper_y'
It's not included in TMC STEPPER_Y! π§
it's written to RatOS.cfg.
when you pick 5160's RatOS defaults to SPI mode, and it uses software spi because otherwise you'll get conflicts when ie the ADXL345 is connected to the same bus.
For some reason klipper doesn't work in hardware_spi when a bus is shared. It works fine for multiple drivers, but not multiple device types. It's a bug that's existed since forever.
Not entirely sure if it's a board design detail or a klipper implementation detail.
How do I get around it?
by using software spi. I believe the reason it's complaining is your "chain_length/chain_position" paramters.
Those are mandatory I believe.
GitHub
klipper/config/generic-duet3-6hc.cfg at master Β· Klipper3d/klipper
Klipper is a 3d-printer firmware. Contribute to Klipper3d/klipper development by creating an account on GitHub.
yeah it's running a shared chip select pin.. sigh
This is why no Duet boards are supported π
they just do everything differently
You're not going to make this work without a proper board-definition.json that you can load in the configurator, forcing hardware spi
π¦
Basically you want to duplicate one of the boards in here: https://github.com/Rat-OS/RatOS-configuration/tree/v2.1.x/boards
GitHub
RatOS-configuration/boards at v2.1.x Β· Rat-OS/RatOS-configuration
The RatOS modular klipper configuration. Contribute to Rat-OS/RatOS-configuration development by creating an account on GitHub.
And do a proper board implementation
I started working on one yesterday....but since there aren't any Duet examples, I'm going in blind.
There's nothing unique about Duet in that case. The available options in board-definition.json are the same. The important part to the spi problem is defining the
motorSlots
and with all of these quirks, I really don't know what does and does not need to specified.
Nope, it's a lot work
And i'm pretty sure it's going to need extra features, that no other board in existence uses.
This is where I stopped yesterday.
But it's definitely possible to implement in 2.1. Would've never been possible in 2.0.
Should use "hardware", and the hardware schema would need to be updated to allow for chain_length/position
If you have time, could you quickly glance over them and see if there is anything glaring wrong.
couple of syntax errors (trailing commas), and you'd need to swap the spi_software pins for spi_bus and chain_length/position in the motor slots but otherwise it looks ok
i recommend cloning the repository and editing in vscode, that'll give you autocompletion for the json schema.
Solution
But regardless, you're going to need features that don't yet exist
What do you mean by that?
the configurator currently doesn't support chain_position/chain_length
π¦
and i believe it'll complain if trying to use shared cs_pins (because it'll break klipper)
π©
I can add the functionality, but i have a shit ton of more important stuff to do first
Totally understand, not a lot of Duet board users either.
i've had a few requests, and people who own those like them a lot, so it does make sense to try and implement support
If you're up for it, i'll ping you when i get that far.
I've been collectings resources in my GitHub repo to try and document all the little things of Duet to get Klipper on it, https://github.com/DrFate09/daedalus_klipper
GitHub
GitHub - DrFate09/daedalus_klipper
Contribute to DrFate09/daedalus_klipper development by creating an account on GitHub.
perfect
Specifically the Duet 6HC
that would be my first priority π