Breaking the encryption on the Lerdge series mainboards so I can try porting Marlin 2.0 to it.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
sbaseloader.binThe Lerdge-S base loader (if you brick your board and are comfy finding SWD, this would let you reset it).macbinary - 58.79 kB - 06/17/2020 at 16:08 |
|
|
lerdgexboot1.0.2.patched.binPatched bootloader that does not reset security bits on startup. Must be loaded directly with an ST-link, will not load correctly through the lerdge X boot updateroctet-stream - 64.00 kB - 01/10/2019 at 18:33 |
|
|
ST7796S.pdfThis appears to be the LCD controller - most of the commands match up to what we see in the code.Adobe Portable Document Format - 3.40 MB - 01/09/2019 at 18:28 |
|
|
resetlerdge.shscript to call and then flash. Be sure to adjust paths as appropriate.x-sh - 288.00 bytes - 01/03/2019 at 16:16 |
|
|
lerdge_program.cfgopenocd script for resetting.cfg - 312.00 bytes - 01/03/2019 at 16:15 |
|
Today the official build support for Lerdge X, K, and S was merged into Marlin's bug fix branch. LCD Support is still coming but I published a branch which combines LCD, Lerdge, and the upgraded STM32 core for maximum goodness.
This project is nearly complete - what's left to wrap up is details of the K board's FRAM and RGB LEDs.
And then we move on...
After my last post, I realized that with a functional Ledge X and K v1, and someone helping with the Ledge S, I could aim a bit higher. My initial PR was meant to simply get Ledge-X building in Marlin, without LCD. I think now it's reasonable to say we should aim to have X, S, and K working minus the LCD. Whether or not we hold for the TFT pull request is another issue, and will largely be controlled by whether or not the TFT PR lands first. I know there's something wrong in current code where the init sequences aren't working, and I know a range of commits that broke it, and when I'm home, I'll gradually suss out which one is at fault. Also, I've found that I'm missing some pin information for the X (the transistor which enables/disables the divider network for thermistor use), so it'll be back to the multimeter for that.
I managed to unbrick my Lerdge K board (the bootloader dump sketch left it in a "SWD no longer works" state), and reset it with the K bootloader I have uploaded here, so the files are definitely good. I've also generalized the marlin build environment for Lerdge so adding support for K can be done with minimal fuss, but it will be at least a week before I have more hacking time.
A user contacted me who had a Lerdge S board, and flashed a build of Marlin for the X on it. It turns out the information I was given, that the pins were similar to the X, is not accurate, but that user is hacking away on the pins definitions, so S support will eventually be a thing.
The Lerdge S LCD reports itself as an 0x800C LCD...which is nothing.
But, it's definitely an ST7796. Forcing the override allows Marlin with LCD to boot on the S.
So that is definitely progress. Happy hacking, folks. See you in a week.
While we wait on Lerdge X support to be merged into Marlin...how about getting the new TFT UI up and running?
I had to extract Lerdge's init sequence from the binary and do a few other things. Note, the UI is scaled for a smaller screen, a known problem we're going to fix, but here it is - touch and all.
I'm working with the dev who is doing the primary TFT support to make sure it'll run on the X (and K) out of the box. Next update will be when we have a proper sized UI to show off...
There's been quite a break in updates on this project and that's for good reason. I do this for fun, and it stopped being fun. However, after the completion of the Chitu (Tronxy) work, I decided to loop back around. Marlin has evolved, the ST Arduino core has evolved. Everything has evolved...so I decided to start again.
It took quite a bit of messing around but I was able to get Marlin 2.0 running without LCD, building and encrypting automatically for LerdgeX (K is a different variant. The same scripts will be used but you need a different pin set for the variant and I'm not looking at that yet.
The PR is out to add support for Lerdge to Marlin.
No LCD, but you've seen it work (hell, the code is in my repo). With the new TFT support coming to Marlin, it is a matter of time.
You can follow the PR here:
Marlin's bugfix-2.0.x now contains pin definitions for the Lerdge X and K. I don't own an S, so I have no idea what the pins are. Next steps are to figure out if we HAVE to have a specific board definition (my suspicion is "yes") or if we can build with a generic variant. The reason I think we'd need a specific variant is that the variant's pin config specifices which pins are used by an ADC, and on Lerdge I had issues with the bed pin not having a default ADC definition (I had to uncomment it).
Tomorrow I'm hoping to get the Lerdge-S pinouts from Lerdge. Tonight, I dusted off the repositories and got everything compiling enough to make pull requests for pins. That'll be the beginning of getting this into Marlin 2.9 proper. There's a number of problems with the boot screens and touch controller, but we'll get it running.
A week ago, my STM32F4xx mcudev black board arrived, with a fun STM32F4 processor on it and a TFT LCD interface. I also ordered the cheapest LCD I could find on AliExpress, an Orise clone that specifically mentioned supporting FSMC access. The pinout wasn't identical to what the STM32F4XX wanted, but with a nest of jumper wires, I hooked them up to the right ports.
Why?
I want to build a nice, generic FSMC library where I can tell it the configuration and let it do the rest, and FSMC code is very picky. I found a sample for Keil MDK (which is very expensive) and slowly began cutting it over from the Standard Peripheral Library to the ST HAL. Finally, I managed to get some code that successfully initialize the LCD, but the Orise is an oddity - it can be hard reset from software. The reset pin isn't even used during init. Most LCDs require a reset sequence (lerdge certainly does).
The other advantage of this hardware is that it has an XPT2064 resistive touch, just like the lerdge, meaning that next I can hook the four wires (SPI + Interrupt) for the touch, and get that working.
Lastly, SDIO + DMA will be the end goal, with DMA from an aligned buffer. Touch work will come first.
The next few stages are not going to be terribly entertaining. As noted, I need to get the pin mappings into Marlin 2.x, which will produce an absolutely *minimal* printer. I don't say that lightly, I mean it - no SD, no LCD, no...most of the pretty bits. But once that's working and in, I can switch modes. I ordered from China (and just received) a beautiful little blackpill board - that's an STM32F4 system with SDIO SD card and a FMSC LCD interface.
Just like the lerdge boards.
What this means is that I can develop SDIO support for HAL_STM32 on a system that's actually designed for debugging, then move the code over to support Lerdge.
LCD? Same deal. The LCD in question uses a different command set, but that's irrelevant - I will wire it up identically and use it to debug FMSC LCD interaction, followed by U8G LCD interaction...followed by moving the code to Marlin. THe LCD supports the exact same XPT chip, so I can even debug touch interaction.
But first, I am going to finish out the M200 work.
My other project, Marlin 2.x on the Monoprice Mini/Malyan M200, is slowly starting to function, and there's a few benefits from that for my lerdge project. First off, I have a much better grip on how USB support has to work. Secondly, I've identified a few problems with PWM that have to be resolved -and also we need a better way to handle timers in the ST HAL. The problem is that F_CPU is used to derive some of the prescalar values for a timer, but that will vary based on the board's clock config. For instance, I could underclock an STM32F103 to 48mhz and USB/timers will still work fine. The RCC_GetClockConfiguration function will get us the clock divisors, and with a helper function to get every timer's proper clock source and divide out by the proper scaler, it should work.
Create an account to leave a comment. Already have an account? Log In.
The gecko is a Lerdge-S board, I think. Remember, pins debugging doesn't work at ALL for the STSTM32, but the good news is, it's likely that the S and the X are very, very similar.
I had a similar problem on my Mac with the CH drivers rebooting. I found different ones that worked for me. Not sure if this would help: https://3dprinterwiki.info/ch340x-driver-information/
Those did help - I got the latest ones and no longer blackscreen. So...progress.
Did you just do this to find out the link between the main control IC and the surrounding resources on the motherboard?
Which part? breaking the encryption? I did this because I wanted to load my own code. Because I figured it would teach me something new. And it certainly has.
Nice work ! I had considered getting a Gecko 3D printer but the fact that they use this closed-source board made it far less interesting: why buy a new unit if you have to immediately R&R the controller ? Marlin 2.0 support shouldn't be too difficult once you get the pin mapping figured out.
-=dave
I bought the lerdge because I got a great deal and it looked like solid hardware in general. Never figured I'd wind up digging this deep int oit.
Pins mapping is not nearly as hard as people make it out to be. There's a limited number of analog capable pins, so once you nail down the thermistors. The FSMC/SDIO pins are pretty much fixed, as well. SPI? Finding extruder dir pins can be a PITA. For me, right now the biggest blocker is that the external peripherals don't respond. I'll figure it out - it's probably something dumb. I just don't know what , yet.
Become a member to follow this project and never miss any updates
I have a Gecko 3D printer and I want to support. I got this hint from a Marlin dev: "
The most important thing is to identify what port & pin numbers are being used for all the I/O. M42 and M43 can assist that effort greatly. If you put M43 into "Watch" mode, you can ground various control pins (on the stepper drivers for example) and see what GPIO is identified as changed.
If you can build an accurate pin file for the board... You are almost where you want to be."