Jump to: navigation, search

Recore

Software for Recore

Distro

Starting with Armbian Butser Server (kernel 5.4) https://dl.armbian.com/pine64/Buster_current Flash the software to a USB drive.

With a clean board, it's necessary to start the board from a host computer using FEL mode.

sunxi-fel -v -p spl sunxi-spl.bin write 0x44000 bl31.bin write 0x4a000000 u-boot.bin reset64 0x44000

The output will appear in teminal that can be started with:

minicom -D /dev/ttyUSB0 -w

If a dongle with Armbian is present in one of the USB host slots, it should boot from the dongle.

Booting from USB if an OS is present on the eMMC

If the eMMC is parititioned and has an OS, u-boot will launch right into that. In order to override that and boot from a USB dongle, stop u-boot by pressing a key and then write:

setenv devnum 0
run usb_boot

Install distro to eMMC

Create Partition:

export card=/dev/mmcblk0
blockdev --rereadpt ${card}
cat <<EOT | sfdisk ${card}
1M,,L
EOT
mkfs.ext4 ${card}p1

Copy Kernel and rootfs to eMMC

Use the flash script in Redist

mount /dev/mmcblk0p1  /mnt/
rsync -aAx --human-readable --info=name0,progress2 --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/media/*,/mnt/*,lost+found/} /* /mnt
echo "rootdev=/dev/mmcblk0p1" >> /mnt/boot/armbianEnv.txt

Update the UUID in fstab to the UUID of the eMMC part 1

blkid
nano /etc/fstab

Make eMMC bootable (WIP)

Place U-boot-spl in sector 15 (8KB offset) Clean card:

dd if=/dev/zero of=/dev/mmcblk0 bs=1k count=1023 seek=1

Flash the binary

dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8

The board (A2) does not boot using this technique. It might be the binary file itself or it might be a hardware issue.

Install Klipper

It's good to add a separate user for Klipper:

useradd klipper -s /bin/bash -G sudo,dialout
passwd klipper
mkdir /home/klipper
chown klipper:klipper /home/klipper
su klipper
cd ~
git clone https://github.com/intelligent-agent/klipper
cp klipper/config/generic-recore.cfg ./printer.cfg
./klipper/scripts/install-ubuntu-18.04.sh

You can check the log by writing

tail -f /tmp/klippy.log 

Install host firmware

cd /home/klipper/klipper
apt install libgpiod-dev
cp .config_linux .config
make 
make flash
chown klipper:klipper /dev/pts/1

Install STM32 firmware

cd /home/klipper/klipper
cp .config_stm32f031 .config
make
./scripts/flash-stm32.sh

Running Klipper

Before (re)starting klipper, The STM32 needs manual reset and the host-mcu needs to be started.

/home/klipper/klipper/scripts/reset-stm32.sh
klipper_mcu

Install Octoprint

cd ~
sudo apt update
sudo apt install python-pip python-dev python-setuptools python-virtualenv git libyaml-dev build-essential
mkdir OctoPrint && cd OctoPrint
virtualenv venv
source venv/bin/activate
pip install pip --upgrade
pip install octoprint


Manual control and testing

OC-reset = PG1 = 193.

echo 193 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio193/direction
echo 1 > /sys/class/gpio/gpio193/value

EN-HP = PG2 = 194

echo 194 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio194/direction
echo 0 > /sys/class/gpio/gpio194/value


Testing TMC2209

In window/shell 1:

xxd -c 4 /dev/ttyS2

In window/shell 2:

echo -n -e '\x5\x0\x6\x6F' > /dev/ttyS2

The return should be along the lines of

00000000: 0500 066f  ...o
00000004: 05ff 0620  ... 
00000008: 0001 4058  ..@X