-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support 512K "RCT6" in BTT SKR Mini #15890
Support 512K "RCT6" in BTT SKR Mini #15890
Conversation
the SKR Mini E3 v1.2 actually has 256k, since it uses STM32F103RCT6, according to the STMicroelectronics product site. I believe some SKR Mini E3 were shipped with STM32F103RE variant which does have 512k, but that's the exception not the rule. Edit: forgot to add the link to STMicroelectronics product site. |
9573029
to
c947ca8
Compare
Co-authored-by: AletheianAlex <6373527?+AletheianAlex@users.noreply.github.com> Co-authored-by: steenerson <13660022?+steenerson@users.noreply.github.com>
c947ca8
to
2544618
Compare
@damvcoool Yes but the point is, that version 1.2 with the F103RC still has 512kb, have a look at this Reddit thread where the guys confirmed this: |
f82d6c8
to
f24b3ee
Compare
f24b3ee
to
8c1974d
Compare
It seems risky to use more than the documented amount of flash by default. It is the equivalent of overclocking a CPU. It might work for some chips, but isn't guaranteed to work for all. For example, they may allow failures in half their flash and bin those parts to the RC part number, even though the chip is otherwise the same as an RE. Some users might have a perfectly reliable 512k, while other users may have a reliable 256k and a flaky 256k. They might even design their chip to allow either half of the flash to fail testing, and they choose which half to enable when they package the die. Depending on which half is enabled you may or may not even have the other half connected. Maybe none of this is happening, but it is a risk we take by using these chips off-spec. |
I do support giving people the option to build with 512k if they choose, without making it the default for RC chips. Both my mini boards have RE chips on them, so it would be nice to easily make use of the space, or allow users with RC chips to attempt it if they choose. |
@sjasonsmith I totally agree |
Thanks for prettying this up! This has been done with bluepill F103C8 boards going back years, and I spent 20 minutes searching last week and couldn't find a single example of anyone posting that they didn't have the doubled space available or that it didn't work correctly. I personally think ST would have fully masked these to 256K chips and not just left it available but undocumented if they weren't sure the full 512K was working, there's just too much downside to shipping unverified hardware. They even report the full size if you connect to the USART bootloader instead of st-link. That being said, I tend to agree that 256K vs 512K should still be left as an option. I was thinking about making 256K default but adding a compile error for >224K program size that suggests trying 512K and making the change to 512K be a single config option somewhere. But haven't gotten anywhere with it. |
I'm usually one for being cautious with things affecting lots users, but this is why I made it default. We can always make it an option if it becomes an issue. |
It is wise to switch to this if the OEM manuals assume we default to non-usb? (i.e. the last section of this https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3/tree/master/firmware/V1.2) Unless I misunderstand the implication of USB by default. As I understand it, this uploads the firmware over USB ready for flash on reboot as part of the PlatformIO build? |
That guide is out of date since you no longer have to add in BigTreeTech's custom stepper library. It was also probably conservative about space since enabling USB on 256k chips ate up a lot of storage. |
While that's certainly true, I also no longer use it, everybody buying this board is still being directed there. |
BigTreeTech’s repo lags behind this one, so hopefully the guide will be updated once they pull in upstream changes. |
all the shops show RCT6 chip, i dont agree forcing to 512K by default without ability to easily swap (.ld etc) its a mistake imo |
One point of the OP is that the chips marked "RCT6" on these boards have been found to actually have 512K. So the markings on the chip are not meaningful. |
Related Still need more info about bootloader |
So, simplest approach here is to make an extra environment, and use |
i fear read/write to upper 256Ks on RCT6 might overwrite first bytes.. like the fake SD cards.... seems very weird to me if that is true... may be fake/chinese STM32 chips else |
Please watch the linked video in which it is tested so we all are on the same page. https://www.youtube.com/watch?v=EBIahC1P2e0 |
I'm using 128K of flash memory on legit STM32F103C8T6 for years without any issues, although datasheets specified 64K of flash memory. Many of Chinese manufacturers exploited this "feature" too, for example some smart soldering stations and transceiver modules for RC remote controllers. Original ST-Link V2 + STM32 ST-Link Utility indicated 128K of memory too, you could write whatever you want to upper memory region and read it back again. Someone could attach ST-Link V2 to SKR mini e3 v1.2, which has RCT6 chip on-board to confirm STM32 ST-Link Utility displays 512K instead of 256K of flash and post a photo + screenshot here. I'm way too lazy to disassemble my printer again |
I'll just provide my patched bootloader plus my custom firmware (sorry, I haven't truncated this file): For anybody, who want's to figure out, what I have done: I looked for places, where the values 0x08007000 (start address of application) and 0x08040000 (end address of memory) are located. Then I looked where the addresses of that places are used and disassembled the source in that locations. I saw that 0x08040000 was subtracted by 0x08007000. So I assumed that this is a length calculation. Changing the value 0x08040000 to 0x08080000 unlocked flashing up to 512kb. That was quite easy. I don't write down, what commands I have used in radare2. You can look them up in the r2 manual. |
also not works for me
put my firmware firmware.zip in the SD. restart the unit, sound the speaker fast, and then white screen :S |
This is why the feature is optional. It doesn't work for everyone, unfortunately. |
Thanks first @saeugetier for providing the FW or bootloader. radare2 is already hard, if you have never done anything in this direction before. :-D
What surprises me is that your FW has a value "9800" and mine (bootloader-bigtreetech-e3-dip.bin) "981c", so from the right of 0x08040000 in the screenshot. And you read out the range from (Value from 0x08080000 to 0x080842c8) and overwritten it to (0x08040000 to 0x080442c8), is it right? I still have to figure out how to do that. But first, I test your FW... @sl1pkn07 have you tried to flash the Marlin firmware via stlink without touching the bootloader? |
Yes, zero problems (flash step) in all cases, except one bootloader pasted in the BTT issue bigtreetech/BIGTREETECH-SKR-E3-DIP-V1.0#2 (comment) |
Through all of the posts here I was able to get my E3 V1.0 with RCT6 unlocked above the 224kB threshold. With the use of the STlink V2 I was able to read a full 512kB, but the bootloader appeared to have it locked down so it wouldn't look at firmware.bin above 228kB. With STlink I was able to find that near address 0x000012B8 the value was set to 08040000 (256kB), so I changed that to 08080000 (512kB), saved and programmed. Took a firmware.bin at 230kb and it loaded as per normal. Not sure if this is a valid way, but it was interesting. Also tried @steenerson V1.2 bootloader and that also worked (which I'm running now). Thanks all |
Sounds legit. I changed the value at this address, too. That unlocked the bootloader to accept 512kb. |
is strange. open the bootloader 1.2 in STM32 st-link utility (windows), in the direction 12B8, in the 8 colum, say cleary 0808000. but i'm really sure NOT works for me. |
I received stlink today and the value under 0x000012B8 is already entered under 08080000. And @sl1pkn07 seems to have a RET6, too? |
I have RET6, yes |
A larger (244KB) firmware over stlink flash works for me too. Flashing over the SD card doesn't work for me anymore. Can anyone tell me how to address the second UART port in Marlin? Is this enough?
|
I have an e3 dip (ordered quite a while ago when it came out) How would I validate that the memory of it extends to 512? I have the rct6 variant of the chip so before i start flashing anything I'd like to know im not going to break anything. Preferably without ordering anything new. I know it's from Malaysia but that's about it. |
@wieltar The easiest way is to compile a firmware.bin file that is bigger than 224kb using one of the 512K default env. in platformio file. If the bootloader reads the firmware file, it will take the approx. 15 sec before you get the regular Marlin screen. If the bootloader doesn't, then it will just start up as per normal. You cannot hurt/brick it by trying firmware. If it is one of the early runs, then it more than likely has the "locked to 256" bootoloader, and you would then need additional hardware (i.e. STlink V2) to be able to read/write to the bootloader. I have the same early run DIP unit (and also an early run E3), and both of mine were locked down. |
I'm confused on which env to use. BTT official just updated their readme and it states to use _NOUSB variant (https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3/tree/master/firmware/V1.2). Can someone please explain what the difference is? Is this if you do not plan on using the USB port the board comes with? Any penalty (besides the memory space) from enabling the USB? |
The The other variant (without the The naming is a little unclear, I agree. |
Ah thank you! So all the bells and whistles (with plenty of memory to spare) would be: |
anyone can test this? https://github.com/sl1pkn07/SKR_E3_DIP_Bootloader i'm not coder, only just edit to build in actual systems builded with STM32CubeIDE 1.1.0 |
I just got my stlink clone in the mail and i looked into flashing a new bootloader for my e3 dip 1.0 since it is "locked down" but it does have the 64k of ram available. I have no clue on how to "unlock" the bootloader and verify a flashed firmware.bin without accidentally overriding the bootloader since it's all hex mumbo to me. Can anyone tell/guide me, how to use st link utility and flash the new firmware/bootloader? |
Some boards have 512k of available memory, not 256k, and need the RE build to make use of it. See MarlinFirmware#22050 for discussion and testing, and MarlinFirmware#15890 for the original discussion of 1.2 RET6 boards.
Description
BigTreeTech's SKR Mini line of boards with
STM32F103RCT6
MCUs can use 512k of flash (and potentially 64k of ram, but is untested/implemented in this PR) as if they were fitted with anSTM32F103RET6
.This is similar to the double flash "feature" of
STM32F103C8T6
/bluepill boards.USB is also now enabled by default since we don't have to worry about space.
*Thanks to @AletheianAlex via this video & addendum, @steenerson via this reddit thread , and reddit user yuchen_ting for initially posting about this.
Benefits
Related Issues
#15254, #15398