[Frank] has a Ultimaker2 and wanted to install a new bootloader for the microcontroller without having physical access to the circuitry. That means installing a new bootloader for the ATMega2560 without an In System Programmer, and as is usual on AVRs, the bootloader can only be edited with an ISP. Additionally, modifying the bootloader in any way runs the risk of corruption and a bricked circuit. That’s okay, because [Frank] knows how to do it, and he’s here to show you how.
You can think of the memory layout of the ATMega in the Ultimaker as being split in half, with the printer firmware in the first half and the bootloader in the second half. There’s extra space in both halves, and that’s something that comes in very useful. When the circuit powers up, it jumps to the bootloader, does it’s thing, then jumps to the very beginning of the application code – a vector table – that starts up the actual firmware.
[Frank]’s trick to adding on to the bootloader is to place the SD card bootloader in the space normally reserved for applications, not where you would expect to find a bootloader. This code is accessed by the stock bootloader jumping into a modified vector table at the beginning of the application data that points to new executable code. That code is the actual SD card bootloader, but because it is in the application part of the memory, it can’t perform Flash writing or erasing. To fix that, a tiny bit of code is tacked onto the end of the bootloader for performing Flash writes and jumps back to the application part of memory.
Mikeselectricstuff has a video on this subject from a couple years back. Not the gritty details we have here but it’s still a good watch.
https://www.youtube.com/watch?v=jbLy6kE-Szg
Well the sd card probably uses spi just make a dummy card and plug an isp on to that
There won’t be any reset pin access, plus the circuit is 5V and the SD card is behind a unidirectional 3V3 level shifter circuit, so that idea wouldn’t work.
The AVR SPI peripheral is 3.3V sensitive, I assume in programming mode (having reset access) would be no different…
The ISP header is just accessible (and populated) on the main board, no need to do ugly hacks like that if you want ISP access on the electronics.
Is there any way to program the controller in an SD card? Specifically for adjusting performance?
I picked up some cheap 32gig microSD cards, quite obviously NOT the Class 10 they are marked. The best one almost makes it to 3 megabytes/second write speed, and that only after I reformatted it with a program that somehow “found” another megabyte or so, increasing its actual capacity from 29 to just over 30. No longer works in my camera but does in anything else I tried it with.
Another of the three is at its original capacity and almost matches the “performance” of the rejiggered one. Works in my camera too.
The third is extremely slow, usually manages under 1meg/sec writes and is prone to spontaneous errors or simply giving up. I tried several times to transfer 24 videos totaling 8.1 gigs and every time it would fail part way through the 22nd. To make it stop I’d have to pull the card and/or forcibly restart Explorer. Then I’d have to do a quick reformat. Nothing wrong with the 22nd video, it copies to any other device, or by itself to the problem card, without problem. I first tried it in my phone, moving everything from the old 16 gig. It was very slow and when “done” there were still many files not moved. I found that there were hundreds of folders created on the new card with gibberish names. Fortunately none of the files actually moved were corrupted and I was able to move them back. I reformatted it then tried it in my camera. I took two pictures (that took a very long time to save) then a card error message popped up. Most likely this card is defekt but if there’s a way to salvage it, even if it’s no faster than the other two, I’d like to do it.
Sounds to me like you have counterfeit cards. All the classic signs there. As for the extra megabyte and the fact it won’t work in your camera now – it probably formatted it with a different cluster size. Even Fat vs. Fat32, etc… will result in slightly different capacities.
Didn’t change the size, it put more on.
C:\windows\system32>format l: /q
Insert new disk for drive L:
and press ENTER when ready…
The type of the file system is FAT32.
QuickFormatting 31992M
Initializing the File Allocation Table (FAT)…
Volume label (11 characters, ENTER for none)?
Format complete.
31.2 GB total disk space.
31.2 GB are available.
32,768 bytes in each allocation unit.
1,023,507 allocation units available on disk.
32 bits in each FAT entry.
Volume Serial Number is B00D-0F98
C:\windows\system32>format l: /q
Insert new disk for drive L:
and press ENTER when ready…
The type of the file system is FAT32.
QuickFormatting 30716M
Initializing the File Allocation Table (FAT)…
Volume label (11 characters, ENTER for none)?
Format complete.
30.0 GB total disk space.
30.0 GB are available.
32,768 bytes in each allocation unit.
982,655 allocation units available on disk.
32 bits in each FAT entry.
Volume Serial Number is 684C-BC3A
BTW there is a windows program called h2testw.exe It can read/write the SD from a USB reader and report back the write and read speed. Since it verify the write, you can see where it fails as it hits the real capacity.
I found it reading the discussion on DX on fake SD cards.
Love it, nice hack! I’ll be working on making it a pain in the ass for other chips! :p
What was missing (for me at least) in the description was the reason: “why?” Why would you want to reflash a UM2 that often? And if you should, why is using the USB cable for it too hard? In fact, you do not need ‘access to the electronics’, just a USB B cable in the appropriate socket on the side wouls give you enough access. Perhaps if you wanted to reflash a printer that is not yours, but have no maintenance access to?
I got a new extruder kit called Flex3Drive, it required the motor to spin backwards, a new default extrusion speed, a new default lower initial height for the level routine (the head is lower and I don’t want to crack my glass bed if it hits the nozzle), and a new homing path (it hits the back left cover because the head is lower). None of these changes exist yet.