makerbase-mks / MKS-PI

As we all know, the Klipper firmware has the advantages of high printing speed, high precision, and the ability to use the web page to control the printer, etc. MKS PI is a high-end microcomputer board designed by makerbase to replace the Raspberry Pi for the convenience of 3D printing users to use the Klipper firmware. In terms of hardware, MKS PI has a powerful 4-core 64-bit SOC onboard, with 1GBytes of DDR3 memory, supports HDMI screen interface and PI-TS35 screen interface, provides Ethernet port, 3-channel USB interfaces (can be connected to a 3D printer main board, USB Wireless network card, USB camera, U disk, USB keyboard and mouse, etc.); In terms of software, Makerbase provides a complete Klipper firmware transplanted based on the Armbian desktop system, and directly supports klipperScreen. Users only need to download the image file provided by Makerbase, burn it to the TF card, without a lot of construction work, use the usb port or serial port to connect your main board, configure the parameters on the webpage, and you can use the Klipper firmware happily!
GNU General Public License v3.0
112 stars 8 forks source link

Display turns white when connecting adxl345 when running from EMMC #14

Open findus4fun opened 2 years ago

findus4fun commented 2 years ago

Hi, when I connect an adxl345 sensor as described the screen turns white at the moment the Makerbase logo should show up.

I double checked wiring. The adxl345 runs fine on a bluepill connected via usb.

I slowed down the spi clk to 2 MHz by changing

    spi@ff190000 {
        compatible = "rockchip,rk3328-spi\0rockchip,rk3066-spi";
        reg = <0x00 0xff190000 0x00 0x1000>;
        interrupts = <0x00 0x31 0x04>;
        #address-cells = <0x01>;
        #size-cells = <0x00>;
        clocks = <0x02 0x20 0x02 0xd1>;
        clock-names = "spiclk\0apb_pclk";
        dmas = <0x12 0x08 0x12 0x09>;
        dma-names = "tx\0rx";
        pinctrl-names = "default";
        pinctrl-0 = <0x2e 0x2f 0x30>;
        status = "okay";
        max-freq = <0x2dc6c00>;
        cs-gpios = <0x31 0x08 0x01 0x31 0x07 0x01 0x29 0x12 0x01>;
        phandle = <0x87>;

        spi_for_lcd@0 {
            compatible = "ilitek,ili9341";
            pinctrl-names = "default";
            pinctrl-0 = <0x32>;
            reg = <0x00>;
            /*
            spi-max-frequency = <0x16e3600>;
            */
            spi-max-frequency = <0x1e8480>;
            bgr;
            fps = <0x14>;
            rotate = <0x10e>;
            buswidth = <0x08>;
            dc-gpios = <0x31 0x06 0x00>;
            reset-gpios = <0x31 0x04 0x01>;
            led-gpios = <0x31 0x05 0x00>;
            status = "okay";
        };

        spi_for_touch@1 {
            reg = <0x01>;
            compatible = "ti,tsc2046";
            pinctrl-names = "default";
            pinctrl-0 = <0x33 0x34>;
            ti,x-max = [0e c0];
            ti,x-min = [00 a4];
            ti,y-min = [00 c9];
            ti,y-max = [0f 4f];
            ti,x-plate-ohms = [00 28];
            ti,pressure-max = [00 ff];
            ti,swap-xy = <0x01>;
            touchscreen-inverted-y = <0x01>;
            interrupt-parent = <0x29>;
            interrupts = <0x16 0x00>;
            spi-max-frequency = <0x1e8480>;
            pendown-gpio = <0x29 0x16 0x00>;
            vcc-supply = <0x1e>;
            wakeup-source;
            status = "okay";
        };

        spi_for_cs2@2 {
            reg = <0x02>;
            compatible = "rockchip,spi_test_bus1_cs2";
            pinctrl-names = "default";
            pinctrl-0 = <0x35>;
            /*
            spi-max-frequency = <0x4c4b40>;
            */
            spi-max-frequency = <0x1e8480>;
            status = "okay";
        };
    };

Now display does not turn white but adxl345 says:

Failed to set ADXL345 register [0x2d] to 0x0: got 0x2f. This is generally indicative of connection problems (e.g. faulty wiring) or a faulty adxl345 chip. There are several spi devices on the mks-pi and only one on the bluepill. So could this be a problem?

image

Regards Jan

michalfrnoch commented 1 year ago

i have same problem

formy2000 commented 1 year ago

Anyone find a fix yet? Similar to above comments, my screen goes white when the ADXL345 is connected

redrathnure commented 1 year ago

Have you tried different image?

formy2000 commented 1 year ago

Have you tried different image?

I am using the image that came with the MKS EMMC (Armbian 22.05.0-trunk). I am assuming they placed that image on their product. Or is that an incorrect assumption.

redrathnure commented 1 year ago

I am assuming they placed that image on their product. Or is that an incorrect assumption.

yes, they are. However I had several issue with it (non stable display, misconfigured network settings, random version of software and few more). Unfortunately MKS support have not help me (no answers at all) and I decide to build a few custom images.

Last weekends I tested Jammy-current image together with MKS display, SKR 1.3 board (USB), ADXL345 sensor (SPI), WEB cam (USB) and few more devices - everything works fine.

If you decide to try it, you will have to set up the system from the beginning and install Klipper from scratch. However, this will probably solve your original problem and get you more or less fresh (and standard) Armbian.

formy2000 commented 1 year ago

I will give your image a try this week.

Also, I have 3 of the MKS Pi V1.1's. I found the blanks screen occurs when using the EMMC with the ADXL345 connected. On a different MKS Pi I had the same build but not through the EMMC and the screen works as it should when the ADXL345 is connected.

I am going to do more tests this evening.

Thanks for looking into this. It is unfortunate that MKS support is not involved more.

findus4fun commented 1 year ago

Hi, my MKS PI is also runnning from EMMC. Have not tried to run from SD yet.

@redrathnure does the ADXL345 work in klipper using your custom image?

I got tired and just used my old bluepill setup because it has only one spi slave on the the spi bus.

Thanks for providing custom images. I hope I will find time to test them soon, too.

redrathnure commented 1 year ago

Yes, an ADXL345 via SPI connection works. The tricky part is not forgetting about klipper-mcu service. Please follow Install the rc script and Building the micro-controller code instructions (or ADXL345/SPI Usage chapter from the fork)

findus4fun commented 1 year ago

I just tried you latest image from sd card. So far it worked very well. Tomorrow I will hook up my adxl345 and test if that works. Running from EMMC should be just flashing your Image to the EMMC. I will test that if my adxl345 is successfull.

Thank you very much for the effort you have put into building these images. Great Work.

formy2000 commented 1 year ago

Yes, an ADXL345 via SPI connection works. The tricky part is not forgetting about klipper-mcu service. Please follow Install the rc script and Building the micro-controller code instructions (or ADXL345/SPI Usage chapter from the fork)

I tried your custom build on the EMMC. Unfortunately, the screen goes white when the ADXL45 is connected. I still get results with ACCELEROMETER_QUERY so I assume the ADXL345 will function.

As soon as I disconnect the ADXL345, the screen returns to normal. I might also add that I like this screen better than the one given with the MKS build provided on the EMMC.

My only guess is still that the ADXL345 makes the screen go white (blank) when the build is through EMMC. When the build is on an SD card the screen is fine when the ADXL345 is connected.

Considering the connection of the ADXL345 is temporary, I will do the accellerometer tests with the white screen and see if the ADXL345 is functioning and remove when not being used.

findus4fun commented 1 year ago

I can confirm the screen going white when running from EMMC.

Maybe the screen going white is hardware related, but that is just a guess.

I think the new image has a better screenhandling and so I will keep running the new custom image.

formy2000 commented 1 year ago

I can confirm the screen going white when running from EMMC.

Maybe the screen going white is hardware related, but that is just a guess.

I think the new image has a better screenhandling and so I will keep running the new custom image.

I fully agree. The custom build is much better. Even though I had to add Klipper, Moonraker, etc from scratch, it is also my preference. As for the white screen issue, I also agree that it is a hardware issue. Screen works fine when ADXL345 is connected and not using EMMC. I doubt Makerbase will reply to my email.

findus4fun commented 1 year ago

I just came across MPU6050 as a replacement for adxl345. This will be connected via i2c. I have one board I will try to connect it to the mks-pi i2c pins. Hopefully these will work toggether with the tft screen.

formy2000 commented 1 year ago

I just came across MPU6050 as a replacement for adxl345. This will be connected via i2c. I have one board I will try to connect it to the mks-pi i2c pins. Hopefully these will work toggether with the tft screen.

Hopefully it works. Makerbase has just replied to me this morning and has acknowledged that it is an issue by stating the following:

"This problem is because the transmission frequency of the adexl345 acceleration sensor is relatively high, which will interfere with the product. The screen is transmitted through spi, so it may be affected, and the screen will be white. This may be a limitation of the spi transport. We're working on an HDMI screen that won't be affected by this."

findus4fun commented 1 year ago

I still doubt that they understand the problem. The TFT and adxl interface share the spi signals no matter if the image runs from SD card or Emmc.

redrathnure commented 1 year ago

TFT, touch screen and SPI port (adxl345) share the same RX/TX lines. SD cart and EMMC are connected to different lines. I am not sure how adxl345 may affect EMMC. In theory, if they use software implementation of SPI and/or SD/EMMC interfaces, we may have lack or CPU/resources to handle all devices on the same time. But I just speculating here... However, you may check CPU and overall system utilization during working with ADXL345.

findus4fun commented 1 year ago

I just came across MPU6050 as a replacement for adxl345. This will be connected via i2c. I have one board I will try to connect it to the mks-pi i2c pins. Hopefully these will work toggether with the tft screen.

Hm, looking at the schematics you have either i2c are ethernet Leds. You have to solder resitors to use one or the other. I will stick to my setup with an extra blue-pill.