-
First success with Armbian, NanoPi and ILI9341 Touch
04/20/2023 at 20:35 • 1 commentAfter having a hard time getting the ILI9341 touchscreen working with the NanoPi Neo (Allwinner H3) it seems to work now.
To have more GPIOs available for other stuff the touch and display share one SPI bus.
There is basically nothing available out of the box and I'm a total noob with NanoPi, Armbian and overlays so there may be errors.
But it works.
root@nanopineo:~# uname -a Linux nanopineo 5.15.93-sunxi #23.02.2 SMP Fri Feb 17 00:00:00 UTC 2023 armv7l armv7l armv7l GNU/Linux
This is the wiring between ILI9341 and NanoPi Neo:
/* 3.3v <--> VCC & LED GND <--> GND PC2 <--> SCK & T_CLK PC1 <--> SDO<MISO> & T_DO PC0 <--> SDI<MOSI> & T_DIN PA1 <--> DC PG8 <--> RESET PC3 <--> CS PA3 <--> T_CS PG9 <--> T_IRG */
This is the overlay ( ili9341-touch-double-spi-cs.dts ):
/dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target = <&pio>; __overlay__ { spi0_cs1: spi0_cs1 { pins = "PC3"; function = "gpio_out"; output-high; }; spi1_cs1: spi1_cs1 { pins = "PA3"; function = "gpio_out"; output-high; }; opiz_display_pins: opiz_display_pins { pins = "PA1", "PG8", "PA6"; function = "gpio_out"; }; ads7846_pins: ads7846_pins { pins = "PG9"; function = "irq"; }; }; }; fragment@1 { target = <&spi1>; __overlay__ { pinctrl-names = "default", "default"; pinctrl-1 = <&spi1_cs1>; cs-gpios = <0>, <&pio 0 3 0>; /* PA3 */ }; }; fragment@2 { target = <&spi0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-names = "default", "default"; cs-gpios= <&pio 2 3 0>, <&pio 0 3 1>; opizdisplay: opiz-display@0 { pinctrl-1 = <&spi0_cs1>; reg = <0>; /* Chip Select 0 */ compatible = "ilitek,ili9341"; spi-max-frequency = <1000000>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&opiz_display_pins>; rotate = <90>; bgr = <0>; fps = <33>; buswidth = <8>; dc-gpios = <&pio 0 1 0>; /* PIN_22 GPIOA1 > */ reset-gpios = <&pio 6 8 1 >; /* GPIOG8> */ /*led-gpios=<&pio 0 6 0>; PIN_12 GPIOA6 > */ debug=<4>; }; ads7846: ads7846@1 { reg = <1>; /* Chip Select 1 */ compatible = "ti,ads7846"; spi-max-frequency = <1000000>; status = "okay"; pinctrl-2=<&spi1_cs1 &spi1_cs1>; pinctrl-names = "default"; pinctrl-3 = <&ads7846_pins>; interrupt-parent = <&pio>; interrupts = <6 9 2>; /* PG9 IRQ_TYPE_EDGE_FALLING */ pendown-gpio = <&pio 6 9 0>; /* PG9 */ /* driver defaults, optional */ ti,x-min = /bits/ 16 <0>; ti,y-min = /bits/ 16 <0>; ti,x-max = /bits/ 16 <0x0FFF>; ti,y-max = /bits/ 16 <0x0FFF>; ti,pressure-min = /bits/ 16 <0>; ti,pressure-max = /bits/ 16 <0xFFFF>; ti,x-plate-ohms = /bits/ 16 <400>; }; }; };
This is the /boot/armbianEnv.txt
verbosity=1 bootlogo=false console=serial disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 overlays=usbhost1 usbhost2 spi0 param_spidev_spi_bus=0 param_spidev_spi_cs=1 param_spidev_spi_cs=0 rootdev=UUID=XYZ-LONG-UUID-IS-LONG rootfstype=ext4 user_overlays=ili9341-touch-double-spi-cs usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
After connecting via ssh and starting evtest it shows this when touched ( not sure if it shows the correct coordinates yet )
Event: time 1682020476.763295, -------------- SYN_REPORT ------------ Event: time 1682020476.775286, type 3 (EV_ABS), code 0 (ABS_X), value 535 Event: time 1682020476.775286, type 3 (EV_ABS), code 1 (ABS_Y), value 3553 Event: time 1682020476.775286, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 65169
To add the overlay:
armbian-add-overlay /path/to/ili9341-touch-double-spi-cs.dts
I'm still not sure if it works like it should. But at least it does something that looks promising.
-
Which way to go? Many roads for the motion.
04/20/2023 at 11:14 • 0 commentsOne of the keys for a good EDM process is the motion management. My goal is to create an easy to use and easy to build 3 to 4 axis CNC EDM mill.
But what are the options?
ESP32
For a single axis sinker EDM the ESP32 works very well. But the more axis it uses the slower the final axis speed will be. The ESP32 won't allow parallel motion where multiple axis can move at the same time. EDM doesn't need much speed so that could still work good enough.
But also access to the SD card is a problem. It pauses the process and takes some time to read GCode.
Marlin with 3D printer board
One option would be to create a marlin fork. This would match many of the G-EDM goals. Most people could use the boards they already have in their printers and just flash the custom firmware onto it. But it has downsides:
Marlin is a very complex software. Hard to get into it, but still doable. Marlin is also 3D printing specific and I would need remove most of it to create a pure EDM Marlin fork.
Now another problem. The boards many people already have in their printers support steppers up to 1.4A. This is the case at least for the Silent Enderv2 board.
This would work for most people but it is a limiting factor. For example: The Nema17 steppers of the G-EDM are rated 1.69A.
Klipper
What about Klipper? I haven't worked with Klipper yet but it looks nice. From my understanding Klipper uses some kind of serial communication to control other boards? This is a problem with EDM. Serial Communication next to the sparks created by EDM won't work reliable until everything is shielded.
NanoPi Neo with custom software
The next variant would be really specific and custom. Using a NanoPi Neo with a custom homemade software. Maybe a QT-Application.
This would allow me to reuse the code I already have but it won't reach the goal of making it easily available to everyone. The NanoPi Neo is exotic and a little outdated.
But it may be possible to adapt the code to other boards too.
It is hard to get the ILI9341 touchscreen to work with it. There are no device tree overlays in the wild that support a shared SPI with two chip selects. And this is needed because if touch and the screen don't share some pins there won't be enough GPIO Pins left to wire up everything else.
I talked with two friends about this. One just said: "Yes" The other said: You will get the display working!
:D It is tough. -
First look at the NanoPi as motion controller
04/18/2023 at 13:37 • 0 commentsCurrently testing a NanoPI Neo. The basic display works. Now it is time to get the touch working.
For a 4 axis cnc router a single ESP may not be a good choice. The final axis speeds would be very slow.
The NanoPi has 4 cores and I will try to spawn worker threads for the steppers across the cores where they wait for positioning commands.
One core will be used only to monitor the feedback signal and the other cores for motion and UI.