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.
The 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
Patched 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 updater
octet-stream - 64.00 kB - 01/10/2019 at 18:33
This 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
script to call and then flash. Be sure to adjust paths as appropriate.
x-sh - 288.00 bytes - 01/03/2019 at 16:16
openocd 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.
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.
Become a member to follow this project and never miss any updates