diff --git a/docs/API_Server.md b/docs/API_Server.md index 01d330230..434245fae 100644 --- a/docs/API_Server.md +++ b/docs/API_Server.md @@ -345,6 +345,26 @@ and might later produce asynchronous messages such as: The "header" field in the initial query response is used to describe the fields found in later "data" responses. +### adxl355/dump_adxl355 + +This endpoint is used to subscribe to ADXL355 accelerometer data. +Obtaining these low-level motion updates may be useful for diagnostic +and debugging purposes. Using this endpoint may increase Klipper's +system load. + +A request may look like: +`{"id": 123, "method":"adxl355/dump_adxl355", +"params": {"sensor": "adxl355", "response_template": {}}}` +and might return: +`{"id": 123,"result":{"header":["time","x_acceleration","y_acceleration", +"z_acceleration"]}}` +and might later produce asynchronous messages such as: +`{"params":{"overflows":0,"data":[[3292.432935,-535.44309,-1529.8374,9561.4], +[3292.433256,-382.45935,-1606.32927,9561.48375]]}}` + +The "header" field in the initial query response is used to describe +the fields found in later "data" responses. + ### angle/dump_angle This endpoint is used to subscribe to diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index d9125d47b..8b2aee0ec 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -1836,6 +1836,35 @@ cs_pin: # measurements. ``` +### [adxl355] + +Support for ADXL355 accelerometers. This support allows one to query +accelerometer measurements from the sensor. This enables an +ACCELEROMETER_MEASURE command (see [G-Codes](G-Codes.md#adxl345) for +more information). The default chip name is "default", but one may +specify an explicit name (eg, [adxl355 my_chip_name]). + +``` +[adxl355] +cs_pin: +# The SPI enable pin for the sensor. This parameter must be provided. +#spi_speed: 5000000 +# The SPI speed (in hz) to use when communicating with the chip. +# The default is 5000000. +#spi_bus: +#spi_software_sclk_pin: +#spi_software_mosi_pin: +#spi_software_miso_pin: +# See the "common SPI settings" section for a description of the +# above parameters. +#axes_map: x, y, z +# See the "adxl345" section for information on this parameter. +#rate: 4000 +# Output data rate for ADXL355. ADXL355 supports the following data +# rates: 4000, 2000, 1000, 500, 250, 125, 62.5, 31.25, 15.625, +# 7.813, and 3.906. The default is 4000. +``` + ### [icm20948] Support for icm20948 accelerometers. @@ -1958,8 +1987,9 @@ section of the measuring resonances guide for more information on # are reachable by the toolhead. #accel_chip: # A name of the accelerometer chip to use for measurements. If -# adxl345 chip was defined without an explicit name, this parameter -# can simply reference it as "accel_chip: adxl345", otherwise an +# an accelerometer chip was defined without an explicit name, this +# parameter can simply reference it by section name (for example, +# "accel_chip: adxl345" or "accel_chip: adxl355"), otherwise an # explicit name must be supplied as well, e.g. "accel_chip: adxl345 # my_chip_name". Either this, or the next two parameters must be # set. diff --git a/docs/G-Codes.md b/docs/G-Codes.md index 184bc66af..e495965ec 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -71,40 +71,47 @@ modules are automatically loaded. ### [adxl345] The following commands are available when an -[adxl345 config section](Config_Reference.md#adxl345) is enabled. +[adxl345 config section](Config_Reference.md#adxl345) or +[adxl355 config section](Config_Reference.md#adxl355) is enabled. #### ACCELEROMETER_MEASURE `ACCELEROMETER_MEASURE [CHIP=] [NAME=]`: Starts accelerometer measurements at the requested number of samples per -second. If CHIP is not specified it defaults to "adxl345". The command +second. If CHIP is not specified, Klipper uses the default configured +accelerometer chip. The command works in a start-stop mode: when executed for the first time, it starts the measurements, next execution stops them. The results of measurements are written to a file named -`/tmp/adxl345--.csv` where `` is the name of the -accelerometer chip (`my_chip_name` from `[adxl345 my_chip_name]`) and +`/tmp/--.csv` where `` is the +accelerometer section type (for example, `adxl345` or `adxl355`) and +`` is the name of the accelerometer chip (`my_chip_name` from +`[adxl345 my_chip_name]` or `[adxl355 my_chip_name]`) and `` is the optional NAME parameter. If NAME is not specified it defaults to the current time in "YYYYMMDD_HHMMSS" format. If the accelerometer does not have a name in its config section (simply -`[adxl345]`) then `` part of the name is not generated. +`[adxl345]` or `[adxl355]`) then `` part of the +name is not generated. #### ACCELEROMETER_QUERY `ACCELEROMETER_QUERY [CHIP=] [RATE=]`: queries -accelerometer for the current value. If CHIP is not specified it -defaults to "adxl345". If RATE is not specified, the default value is -used. This command is useful to test the connection to the ADXL345 +accelerometer for the current value. If CHIP is not specified, +Klipper uses the default configured accelerometer chip. If RATE is +not specified, the default value is used. This command is useful +to test the connection to the configured accelerometer: one of the returned values should be a free-fall acceleration (+/- some noise of the chip). #### ACCELEROMETER_DEBUG_READ `ACCELEROMETER_DEBUG_READ [CHIP=] REG=`: -queries ADXL345 register "register" (e.g. 44 or 0x2C). Can be useful +queries accelerometer register "register" (e.g. 44 or 0x2C). Can be +useful for debugging purposes. #### ACCELEROMETER_DEBUG_WRITE `ACCELEROMETER_DEBUG_WRITE [CHIP=] REG= VAL=`: Writes raw "value" into a register "register". Both "value" and "register" can be a decimal or a hexadecimal integer. Use -with care, and refer to ADXL345 data sheet for the reference. +with care, and refer to the accelerometer data sheet for the reference. ### [angle] diff --git a/docs/Measuring_Resonances.md b/docs/Measuring_Resonances.md index e4f9b8e95..bb959a8d5 100644 --- a/docs/Measuring_Resonances.md +++ b/docs/Measuring_Resonances.md @@ -1,10 +1,10 @@ # Measuring Resonances -Klipper has built-in support for the ADXL345, MPU-9250, LIS2DW and LIS3DH compatible +Klipper has built-in support for the ADXL345, ADXL355, MPU-9250, LIS2DW and LIS3DH compatible accelerometers which can be used to measure resonance frequencies of the printer for different axes, and auto-tune [input shapers](Resonance_Compensation.md) to compensate for resonances. Note that using accelerometers requires some -soldering and crimping. The ADXL345 can be connected to the SPI interface +soldering and crimping. The ADXL345 and ADXL355 can be connected to the SPI interface of a Raspberry Pi or MCU board (it needs to be reasonably fast). The MPU family can be connected to the I2C interface of a Raspberry Pi directly, or to an I2C interface of an MCU board that supports 400kbit/s *fast mode* in Klipper. The @@ -15,7 +15,7 @@ When sourcing accelerometers, be aware that there are a variety of different PCB board designs and different clones of them. If it is going to be connected to a 5V printer MCU ensure it has a voltage regulator and level shifters. -For ADXL345s, make sure that the board supports SPI mode (a small number of +For ADXL345 and ADXL355 boards, make sure that the board supports SPI mode (a small number of boards appear to be hard-configured for I2C by pulling SDO to GND). For MPU-9250/MPU-9255/MPU-6515/MPU-6050/MPU-6500/ICM20948s and LIS2DW/LIS3DH there @@ -257,6 +257,23 @@ probe_points: It is advised to start with 1 probe point, in the middle of the print bed, slightly above it. +For ADXL355 over SPI on the Raspberry Pi, use the same setup with an +`[adxl355]` section: + +``` +[mcu rpi] +serial: /tmp/klipper_host_mcu + +[adxl355] +cs_pin: rpi:None +#rate: 4000 + +[resonance_tester] +accel_chip: adxl355 +probe_points: + 100, 100, 20 # an example +``` + #### Configure ADXL345 With Pi Pico ##### Flash the Pico Firmware