diff --git a/boards/ay-caramba/98-caramba.rules b/boards/ay-caramba/98-caramba.rules new file mode 100644 index 00000000..ffb80a73 --- /dev/null +++ b/boards/ay-caramba/98-caramba.rules @@ -0,0 +1,4 @@ +# BTT EBB42 v1.2 +SUBSYSTEMS=="usb", ATTRS{idProduct}=="614e", ATTRS{idVendor}=="1d50", ATTRS{serial}=="ay-caramba", ACTION=="add", SYMLINK+="ay-caramba", RUN+="/home/pi/printer_data/config/RatOS/scripts/klipper-mcu-added.sh" + +ACTION=="remove", ENV{DEVLINKS}=="/dev/ay-caramba" diff --git a/boards/ay-caramba/board-definition.json b/boards/ay-caramba/board-definition.json new file mode 100644 index 00000000..85cb650a --- /dev/null +++ b/boards/ay-caramba/board-definition.json @@ -0,0 +1,46 @@ +{ + "$schema": "../board-definition.schema.json", + "isToolboard": true, + "name": "Caramba", + "manufacturer": "Ay", + "id": "ay-caramba", + "firmwareBinaryName": "firmware-caramba.bin", + "compileScript": "compile.sh", + "flashScript": "flash.sh", + "documentationLink": "https://os.ratrig.com/docs/boards/btt/ebb42-12", + "fourPinFanConnectorCount": 1, + "disableAutoFlash": true, + "driverVoltages": [24], + "hasMcuTempSensor": true, + "outputPins": [ + { + "name": "part_fan_power", + "pin": "PA10", + "value": 0 + } + ], + "driverCount": 1, + "integratedDrivers": { + "extruder": "LDO-TMC2209" + }, + "dfu": { + "flashDevice": "0483:df11", + "dfuBootImage": "dfubooting.png", + "instructions": [ + "Connect the board via USB to the Raspberry Pi", + "Make sure the board is powered (you can use usb power by placing a jumper on the VBUS pins)", + "Press and hold the BOOT button on the board.", + "Press and release the RESET button on the board.", + "Release the BOOT button." + ], + "hasBoot0Jumper": false + }, + "LIS2DW": { + "cs_pin": "PA4", + "software": { + "sclk": "PA5", + "mosi": "PA6", + "miso": "PA7" + } + } +} diff --git a/boards/ay-caramba/compile.sh b/boards/ay-caramba/compile.sh new file mode 100755 index 00000000..d18ac13a --- /dev/null +++ b/boards/ay-caramba/compile.sh @@ -0,0 +1,19 @@ +#!/bin/bash +if [ "$EUID" -ne 0 ] + then echo "ERROR: Please run as root" + exit +fi +cp -f /home/pi/printer_data/config/RatOS/boards/ay-caramba/firmware.config /home/pi/klipper/.config +pushd /home/pi/klipper || exit +make olddefconfig +make clean +make + +if [ ! -d "/home/pi/printer_data/config/firmware_binaries" ] +then + mkdir /home/pi/printer_data/config/firmware_binaries + chown pi:pi /home/pi/printer_data/config/firmware_binaries +fi +cp -f /home/pi/klipper/out/klipper.bin /home/pi/printer_data/config/firmware_binaries/firmware-ay-caramba.bin +chown pi:pi /home/pi/printer_data/config/firmware_binaries/firmware-ay-caramba.bin +popd || exit diff --git a/boards/ay-caramba/dfubooting.png b/boards/ay-caramba/dfubooting.png new file mode 100644 index 00000000..596905ea Binary files /dev/null and b/boards/ay-caramba/dfubooting.png differ diff --git a/boards/ay-caramba/firmware.config b/boards/ay-caramba/firmware.config new file mode 100644 index 00000000..cf05266c --- /dev/null +++ b/boards/ay-caramba/firmware.config @@ -0,0 +1,113 @@ +CONFIG_LOW_LEVEL_OPTIONS=y +# CONFIG_MACH_AVR is not set +# CONFIG_MACH_ATSAM is not set +# CONFIG_MACH_ATSAMD is not set +# CONFIG_MACH_LPC176X is not set +CONFIG_MACH_STM32=y +# CONFIG_MACH_HC32F460 is not set +# CONFIG_MACH_RP2040 is not set +# CONFIG_MACH_PRU is not set +# CONFIG_MACH_AR100 is not set +# CONFIG_MACH_LINUX is not set +# CONFIG_MACH_SIMU is not set +CONFIG_BOARD_DIRECTORY="stm32" +CONFIG_MCU="stm32f042x6" +CONFIG_CLOCK_FREQ=48000000 +CONFIG_USBSERIAL=y +CONFIG_FLASH_SIZE=0x8000 +CONFIG_FLASH_BOOT_ADDRESS=0x8000000 +CONFIG_RAM_START=0x20000000 +CONFIG_RAM_SIZE=0x1800 +CONFIG_STACK_SIZE=512 +CONFIG_FLASH_APPLICATION_ADDRESS=0x8000000 +CONFIG_STM32_SELECT=y +# CONFIG_MACH_STM32F103 is not set +# CONFIG_MACH_STM32F207 is not set +# CONFIG_MACH_STM32F401 is not set +# CONFIG_MACH_STM32F405 is not set +# CONFIG_MACH_STM32F407 is not set +# CONFIG_MACH_STM32F429 is not set +# CONFIG_MACH_STM32F446 is not set +# CONFIG_MACH_STM32F765 is not set +# CONFIG_MACH_STM32F031 is not set +CONFIG_MACH_STM32F042=y +# CONFIG_MACH_STM32F070 is not set +# CONFIG_MACH_STM32F072 is not set +# CONFIG_MACH_STM32G070 is not set +# CONFIG_MACH_STM32G071 is not set +# CONFIG_MACH_STM32G0B0 is not set +# CONFIG_MACH_STM32G0B1 is not set +# CONFIG_MACH_STM32G431 is not set +# CONFIG_MACH_STM32H723 is not set +# CONFIG_MACH_STM32H743 is not set +# CONFIG_MACH_STM32H750 is not set +# CONFIG_MACH_STM32L412 is not set +# CONFIG_MACH_N32G452 is not set +# CONFIG_MACH_N32G455 is not set +CONFIG_MACH_STM32F0=y +CONFIG_MACH_STM32F0x2=y +CONFIG_HAVE_STM32_USBFS=y +CONFIG_HAVE_STM32_CANBUS=y +CONFIG_HAVE_STM32_USBCANBUS=y +CONFIG_STM32_DFU_ROM_ADDRESS=0x1fffc400 +# CONFIG_STM32_FLASH_START_2000 is not set +# CONFIG_STM32_FLASH_START_1000 is not set +CONFIG_STM32_FLASH_START_0000=y +CONFIG_STM32_CLOCK_REF_8M=y +# CONFIG_STM32_CLOCK_REF_12M is not set +# CONFIG_STM32_CLOCK_REF_16M is not set +# CONFIG_STM32_CLOCK_REF_20M is not set +# CONFIG_STM32_CLOCK_REF_24M is not set +# CONFIG_STM32_CLOCK_REF_25M is not set +# CONFIG_STM32_CLOCK_REF_INTERNAL is not set +CONFIG_CLOCK_REF_FREQ=8000000 +CONFIG_STM32F0_TRIM=16 +CONFIG_STM32_USB_PA11_PA12=y +# CONFIG_STM32_USB_PA11_PA12_REMAP is not set +# CONFIG_STM32_SERIAL_USART1 is not set +# CONFIG_STM32_SERIAL_USART1_ALT_PB7_PB6 is not set +# CONFIG_STM32_SERIAL_USART2 is not set +# CONFIG_STM32_SERIAL_USART2_ALT_PA15_PA14 is not set +# CONFIG_STM32_CANBUS_PA11_PA12 is not set +# CONFIG_STM32_CANBUS_PA11_PA12_REMAP is not set +# CONFIG_STM32_CANBUS_PA11_PB9 is not set +# CONFIG_STM32_MMENU_CANBUS_PB8_PB9 is not set +# CONFIG_STM32_MMENU_CANBUS_PD0_PD1 is not set +# CONFIG_STM32_USBCANBUS_PA11_PA12 is not set +CONFIG_USB=y +CONFIG_USB_VENDOR_ID=0x1d50 +CONFIG_USB_DEVICE_ID=0x614e +# CONFIG_USB_SERIAL_NUMBER_CHIPID is not set +CONFIG_USB_SERIAL_NUMBER="ay-caramba" + +# +# USB ids +# +# end of USB ids + +CONFIG_WANT_GPIO_BITBANGING=y +# CONFIG_WANT_DISPLAYS is not set +# CONFIG_WANT_SENSORS is not set +CONFIG_WANT_LIS2DW=y +# CONFIG_WANT_LDC1612 is not set +CONFIG_WANT_SOFTWARE_I2C=y +CONFIG_WANT_SOFTWARE_SPI=y +CONFIG_NEED_SENSOR_BULK=y + +# +# Optional features (to reduce code size) +# +# end of Optional features (to reduce code size) + +CONFIG_CANBUS_FREQUENCY=1000000 +CONFIG_INITIAL_PINS="" +CONFIG_HAVE_GPIO=y +CONFIG_HAVE_GPIO_ADC=y +CONFIG_HAVE_GPIO_SPI=y +CONFIG_HAVE_GPIO_I2C=y +CONFIG_HAVE_STRICT_TIMING=y +CONFIG_HAVE_CHIPID=y +CONFIG_HAVE_STEPPER_BOTH_EDGE=y +CONFIG_HAVE_BOOTLOADER_REQUEST=y +CONFIG_HAVE_LIMITED_CODE_SIZE=y +CONFIG_INLINE_STEPPER_HACK=y diff --git a/boards/ay-caramba/flash.sh b/boards/ay-caramba/flash.sh new file mode 100755 index 00000000..1bd294f7 --- /dev/null +++ b/boards/ay-caramba/flash.sh @@ -0,0 +1,9 @@ +#!/bin/bash +MCU=/dev/ay-caramba +if [ "$EUID" -ne 0 ] + then echo "ERROR: Please run as root" + exit +fi +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +FLASH_SCRIPT=$(realpath "$SCRIPT_DIR/../../scripts/flash-path.sh") +$FLASH_SCRIPT $MCU diff --git a/boards/ay-caramba/make-and-flash-mcu.sh b/boards/ay-caramba/make-and-flash-mcu.sh new file mode 100755 index 00000000..ce94f472 --- /dev/null +++ b/boards/ay-caramba/make-and-flash-mcu.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ "$EUID" -ne 0 ] + then echo "ERROR: Please run as root" + exit +fi + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +"$SCRIPT_DIR"/compile.sh +"$SCRIPT_DIR"/flash.sh diff --git a/boards/ay-caramba/toolboard-config.cfg b/boards/ay-caramba/toolboard-config.cfg new file mode 100644 index 00000000..adb76d2b --- /dev/null +++ b/boards/ay-caramba/toolboard-config.cfg @@ -0,0 +1,23 @@ +# WARNING. DO NOT EDIT THIS FILE. +# To override settings from this file, you can copy and paste the relevant +# sections into your printer.cfg and change it there. +# WARNING: it is NOT recommended to override board_pins aliases, +# use the boards pin names directly in your printer.cfg instead. +# Look up the pins you need in the boards pinout diagram. + +[board_pins ay_caramba] +mcu: toolboard +aliases: + x_endstop_pin=PB0, + e_step_pin=PB7, e_dir_pin=PB6, e_enable_pin=PB4, e_uart_pin=PB5, e_diag_pin=null, e_heater_pin=PA0, e_sensor_pin=PA2, + # leveling + bltouch_sensor_pin=null, bltouch_control_pin=null, + probe_pin=PA15, + # adxl345 + adxl345_cs_pin=PA4, + # fans + fan_part_cooling_pin=PA1, + fan_toolhead_cooling_pin=PA9 + # 4 pin fans + 4p_fan_part_cooling_pin=PA1, + 4p_fan_part_cooling_tach_pin=PB1, \ No newline at end of file diff --git a/boards/board-definition.schema.json b/boards/board-definition.schema.json index 101ff144..8b069508 100644 --- a/boards/board-definition.schema.json +++ b/boards/board-definition.schema.json @@ -232,6 +232,48 @@ } } }, + "LIS2DW": { + "description": "Which settings to use for the ADXL345 accelerometer", + "type": "object", + "additionalProperties": false, + "properties": { + "software": { + "description": "Whether to use software SPI", + "type": "object", + + "additionalProperties": false, + "properties": { + "sclk": { + "description": "The clock pin", + "type": "string" + }, + "mosi": { + "description": "The mosi pin", + "type": "string" + }, + "miso": { + "description": "The miso pin", + "type": "string" + } + } + }, + "hardware": { + "description": "Which SPI bus to use if using hardware spi", + "type": "object", + "additionalProperties": false, + "properties": { + "bus": { + "description": "The SPI bus to use", + "type": "string" + } + } + }, + "cs_pin": { + "description": "The chip select pin", + "type": "string" + } + } + }, "integratedDrivers": { "description": "Describes the drivers integrated on this board, if any", "type": "object",