Secondary MCU for AXDL
Nov 7, 2021
Huy Le
2 minute read
PROJECT LAYOUT
  • initial plan
    • left - ADXL, middle - digispark attiny85, right - voltage regulator
    • found out that the attiny85 is not a supported device in klipper.
      • using atmega328p dev board instead

Flashed Klipper Firmware on Arduino Nano #

  • make menuconfig
    • disabled low level config
    • pulled down the compiled file, named the file firmware.hex
  • had avrdude from platformio
$ ~/.platformio/packages/tool-avrdude/avrdude -v -p atmega328p -C
$HOME/.platformio/packages/tool-avrdude/avrdude.conf -c arduino -b 57600 -D -P /dev/ttyUSB0 -U
flash:w:firmware.hex:i

Using Arduino Nano Atmega328P #

  • Pinout for Nano Atmega328P

  • adxl345 - this on has on board voltage regulator

  • adxl is using could be using SPI or I2C

    • some boards are forced into i2c mode with a pull-down resistor.
    • klipper works with SPI.. our board is SPI
  • SPI needs the following pins

Arduino Pin Arduino Pin Name ADXL345 Pin
3V3 VCC
10 PB2 (actual name in printf.cfg) CS
12 MOSI SDO
11 MISO (Remember, data line.. master IN slave out) SDA
13 SCL
  • looked at klipper source code
    • ping for nano should be called just “spi”

final configuration is

[mcu adxl]
serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0

[adxl345]
cs_pin: adxl:PB2
spi_bus: spi
axes_map: x,z,y

[resonance_tester]
accel_chip: adxl345
probe_points:
    60, 60, 20
##
  • Final product
    front
    Back

Things to note for reference #

  • Compare with Pi Pico
    • Pinout for reference
      ADXL345 pin RPi Pico pin name spi0a spi0b spi0c spi1a spi1b
      GND GND 38 38 38 38 38
      CS CSn 2 (GP1) 7 (GP5) 22 (GP17) 12 (GP9) 17 (GP13)
      SDO SPI RX 1 (GP0) 6 (GP4) 21 (GP16) 11 (GP8) 16 (GP12)
      SDA SPI TX 5 (GP3) 10 (GP7) 25 (GP19) 15 (GP11) 20 (GP15)
      SCL SPI SCK 4 (GP2) 9 (GP6) 24 (GP18) 14 (GP10) 19 (GP14)

Logs #

Thu 05/19/2022 #

  • 05:06 Using PlatformIO
    • Trying to use pio core to find Tiny85 to do do a test upload
      • had pyenv version, but removed it since it was old
      • had prebuilt binary sitting in .local/bin - removed it, because it was old
      • installed using brew, which will be easier to keep up with new versions, brew install platformio
    • digispark attiny85 wont work, we’ll be using atmega328p 16mhz i have laying around
    • ultimately, were looking to use klipper to compile, but need a way to push it to the MCU
  • 06:01 ultimately

Sat 05/21/2022 #

  • 10:48 Completed.


comments powered by Disqus