Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Logic Level shifter for 12864 display on Duet 2 Wifi

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    11
    200
    16.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Schmartundefined
      Schmart @antlob
      last edited by Schmart

      @antlob Certainly not a stupid question. If you have a regular RepRapDiscount graphics display, with a ST7920 on it (or a BigTreeTech TFT24 with ST7920 emulation) then the pinout I'm showing you is very likely completely different, so wiring like in my schematic will not work. I think the pinout should instead be similar or identical to the connectors of the Maestro (shameless grab from the schematic):

      Maestro 12864 Pinout.png

      Do you have some pictures of the front and back of your display?

      Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

      1 Reply Last reply Reply Quote 0
      • Schmartundefined
        Schmart @dc42
        last edited by

        @dc42 I know the 12864 changes were a tight fit for the Duet Wifi/Ethernet already and that you were really looking to shave those last bytes off.

        Is there a way I can determine which functions or constructs primarily contribute to the firmware size growth?

        I haven't looked at optimizing my code (or any code actually) yet, but I also noticed that functions like DrawCircle() and ReadPixel() are not used at the moment. We can probably disable these with a #define. And I wanted to optimize the Flush() routine even more anyway because there are still enough similarities between the ST7920 and ST7565 with respect to flushing logic. I'm just not certain in how many bytes I can save there.

        To your idea of making a ST7565 specific build; in the existing code, a fair number of functions use the display buffer directly, so using the buffer with a rotated orientation would require careful checking and possibly abstracting these functions from accessing the buffer directly. That's some work, but still feasible, and perhaps something to do anyway because I have a hunch this might even save some code.

        Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

        dc42undefined 1 Reply Last reply Reply Quote 0
        • Schmartundefined
          Schmart
          last edited by Schmart

          I updated the schematic of how I hooked up my MiniPanel display to the Maestro. See a couple of posts above.

          Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

          1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators @Schmart
            last edited by

            @Schmart said in Logic Level shifter for 12864 display on Duet 2 Wifi:

            but I also noticed that functions like DrawCircle() and ReadPixel() are not used at the moment

            The linker eliminates any non-virtual functions that are not referenced, so no need to disable them using #define.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            dc42undefined 1 Reply Last reply Reply Quote 1
            • dc42undefined
              dc42 administrators @dc42
              last edited by dc42

              I've been working on the code in RRF 3.2 to vary the number of drivers depending on whether a display is configured or not. In the process, I finalised the pin assignments for Duet WiFi to the Fysetc mini 12864 display, as follows.

              constexpr Pin EncoderPinB = PortCPin(7);		// connlcd.3	-> exp2.6
              constexpr Pin EncoderPinA = PortAPin(8);		// connlcd.4	-> exp2.8
              constexpr Pin LcdNeopixelPin = PortDPin(18);       	// connlcd.5	-> exp1.5
              constexpr Pin LcdResetPin = PortCPin(28);		// connlcd.6	-> exp1.6
              constexpr Pin LcdA0Pin = PortDPin(19);			// connlcd.7	-> exp1.7
              constexpr Pin LcdCSPin = PortAPin(25);			// connlcd.8	-> exp1.8
              constexpr Pin EncoderPinSw = PortDPin(20);		// connlcd.9	-> exp1.9
              constexpr Pin LcdBeepPin = PortDPin(21);		// connlcd.10	-> exp1.10
              
              // Additional spi wiring for FYSETC Mini 12864 display:
              // connlcd.2 (gnd)	-> exp1.2
              // connsd.1 (+5V)	-> exp1.1
              // connsd.2 (gnd)	-> exp2.2
              // connsd.3 (SD CS)	-> exp2.7
              // connsd.4 (sck)	-> exp2.9
              // connsd.5 (mosi)	-> exp2.5
              // connsd.6 (miso)	-> exp2.10
              

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              Schmartundefined 1 Reply Last reply Reply Quote 1
              • jay_s_ukundefined
                jay_s_uk
                last edited by

                Sounds promising. I have one of these displays gathering dust

                Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                1 Reply Last reply Reply Quote 0
                • Schmartundefined
                  Schmart @dc42
                  last edited by

                  Hi @dc42

                  I've optimized and simplified the code further in my repo and managed to save a few hundred bytes.

                  Also, the ST7565 display now works without additional logic components, inverting the LCD_CS with a 74xx00 is not necessary anymore. I've used the exp_0 pin for DC and the exp_1 pin for CS now. My display accepts the logic levels perfectly.

                  I should be able to save another 60 bytes or so, but I have to first work out an issue that I uncovered when I start drawing columns pixel by pixel.

                  Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

                  1 Reply Last reply Reply Quote 0
                  • oliofundefined
                    oliof
                    last edited by

                    @Schmart where'd one find your patch, and what does the new wiring look like? Inquiring minds want to know ...

                    <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

                    Schmartundefined 2 Replies Last reply Reply Quote 0
                    • Schmartundefined
                      Schmart
                      last edited by

                      @dc42: I created a pull request of my changes today, and I tested:

                      • ST7920 display type 1
                      • ST7565 display type 2 that uses EXP_1 for active low CD
                      • ST7565 display type 3 which needs a NAND inverter IC to invert the LCD_CS towards the display

                      Also implemented a couple of optimizations, solved a few bugs and simplified the Flush routine.

                      I see some room for further size reduction of the firmware, but that would probably make some parts of the code a little slower. What's your stance on that?

                      Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

                      1 Reply Last reply Reply Quote 0
                      • Schmartundefined
                        Schmart @oliof
                        last edited by

                        Hi @oliof, back from fishing? 😉

                        The changes are in the following repo and branch.
                        https://github.com/SchmartMaker/RepRapFirmware/tree/ST7565

                        I have a binary firmware for the Maestro here:
                        https://1drv.ms/u/s!Au1g8fW6BaQzioADewiHDAxzQ_Adlg?e=KuNYOB

                        What's the board you're using? I'm asking, because the firmware build for the Duet Wifi and Duet Ethernet is still a little too large for the flash memory of these boards unfortunately.

                        Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

                        1 Reply Last reply Reply Quote 0
                        • Schmartundefined
                          Schmart @oliof
                          last edited by

                          @oliof I'll see if I can hack the wiring picture so that it reflects the new option that doesn't require the 74xx00.

                          Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

                          1 Reply Last reply Reply Quote 0
                          • oliofundefined
                            oliof
                            last edited by

                            I have a Duet2Wifi, but I can easily remove stuff I don't need (I did remove Hangprinter when trying the level shifter approach).

                            <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

                            Schmartundefined 1 Reply Last reply Reply Quote 0
                            • Schmartundefined
                              Schmart @oliof
                              last edited by Schmart

                              @oliof This is the wiring I used without the inverter.

                              So to be clear and safe, this is very specific wiring to connect the Duet 2 Maestro to a Creality ST7565-based MiniPanel display @3.3v logic levels.

                              The pinout of displays made vary wildly, and the connectors on display-side may need to be reversed (the plastic shroud rotated 180 degrees). Also, the firmware adaptations I made in my fork are relatively easy to change for the Duet 2 Wifi, but I believe you would need to make changes in the Pins.h specific to the board and maybe also in Display.cpp (for now).

                              Maestro ST7565 Wiring Option 2.png

                              Edit: Since @oliof is using the exact same Creality MiniPanel display from the CR-20, I have adjusted the diagram to match the exact orientation of the display connectors on that specific display. The tab goes on the side of pin #1.

                              Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

                              1 Reply Last reply Reply Quote 0
                              • oliofundefined
                                oliof
                                last edited by

                                @Schmart said in Logic Level shifter for 12864 display on Duet 2 Wifi:

                                The pinout of displays made vary wildly, and the connectors on display-side may need to be reversed (the plastic shroud rotated 180 degrees). Also, the firmware adaptations I made in my fork are relatively easy to change for the Duet 2 Wifi, but I believe you would need to make changes in the Pins.h specific to the board and maybe also in Display.cpp (for now).

                                I have a Creality minipanel I want to use, so we're in the clear there. I'll check how Pins.h need to be adapted if I get around to it before this lands in 3.2 or beyond.

                                <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

                                Schmartundefined 1 Reply Last reply Reply Quote 0
                                • Schmartundefined
                                  Schmart @oliof
                                  last edited by

                                  @oliof That would be so cool if you'd get it working as well. I'm not at my computer anymore, but I believe I'm using ‘M918 P2 E4 F2000000‘ in my config.g.

                                  Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

                                  1 Reply Last reply Reply Quote 0
                                  • dc42undefined
                                    dc42 administrators
                                    last edited by

                                    Please note, the wiring diagram posted by @Schmart above is not the wiring arrangement that will be supported in RRF 3.2. The wiring arrangement in 3.2 is listed in this post https://forum.duet3d.com/post/157139.

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    Schmartundefined antlobundefined 2 Replies Last reply Reply Quote 1
                                    • Schmartundefined
                                      Schmart @dc42
                                      last edited by

                                      @dc42 I saw the post, it wasn't clear to me if this was for the Duet 2 Wifi/Ethernet only or also for the Maestro?

                                      Creality CR-20 Pro with a Duet 2 Maestro, 3Dfused X+Z-axis rail kit, HIWIN-based DIY solution for the Y-axis, E3D Hemera, working ST7565 MiniPanel and various other small hardware improvements.

                                      oliofundefined dc42undefined 2 Replies Last reply Reply Quote 0
                                      • oliofundefined
                                        oliof @Schmart
                                        last edited by

                                        @Schmart I'd assume it will be the same for either.

                                        <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

                                        1 Reply Last reply Reply Quote 0
                                        • dc42undefined
                                          dc42 administrators @Schmart
                                          last edited by dc42

                                          @Schmart said in Logic Level shifter for 12864 display on Duet 2 Wifi:

                                          @dc42 I saw the post, it wasn't clear to me if this was for the Duet 2 Wifi/Ethernet only or also for the Maestro?

                                          It's for Duet WiFi/Ethernet. For the Maestro, I chose pin exp.pa21 to connect A0 to (same as in your diagram). To avoid having to invert the CS signal in hardware, I am considering requiring CS of a 7567-based display to be connected to exp.pa22.

                                          Duet WiFi hardware designer and firmware engineer
                                          Please do not ask me for Duet support via PM or email, use the forum
                                          http://www.escher3d.com, https://miscsolutions.wordpress.com

                                          1 Reply Last reply Reply Quote 1
                                          • antlobundefined
                                            antlob @dc42
                                            last edited by antlob

                                            @dc42 Can you please confirm if that wire arrangement ( https://forum.duet3d.com/post/157139.) will work not only for the MINI LCD 12864 but also for a standart LCD 12864, mine is a BigtreeTech. Many thanks! If that's the case from lines 11 to 17 I must connect them only if I want the LCD 12864 SD Card support, right? If I prefer the one on the panel due I only need to connect the LCD 12864 to ConnLCD on the Duet 2 Wifi, right?

                                            antlobundefined A Former User? 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA