On Hacking MicroSD Cards (2013)
bunniestudios.com
bunniestudios.com
2019 https://news.ycombinator.com/item?id=18959766
Discussed at the time: https://news.ycombinator.com/item?id=6980058
These algorithms are too complicated and too device-specific to be run at the application or OS level, and so it turns out that every flash memory disk ships with a reasonably powerful microcontroller to run a custom set of disk abstraction algorithms. Even the diminutive microSD card contains not one, but at least two chips — a controller, and at least one flash chip (high density cards will stack multiple flash die)."
[...]
>"The embedded microcontroller is typically a heavily modified 8051 or ARM CPU. In modern implementations, the microcontroller will approach 100 MHz performance levels, and also have several hardware accelerators on-die.
Amazingly, the cost of adding these controllers to the device is probably on the order of $0.15-$0.30,
particularly for companies that can fab both the flash memory and the controllers within the same business unit. It’s probably cheaper to add these microcontrollers than to thoroughly test and characterize each flash memory chip, which explains why managed flash devices can be cheaper per bit than raw flash chips, despite the inclusion of a microcontroller.
The downside of all this complexity is that there can be bugs in the hardware abstraction layer, especially since every flash implementation has unique algorithmic requirements, leading to an explosion in the number of hardware abstraction layers that a microcontroller has to potentially handle. The inevitable firmware bugs are now a reality of the flash memory business, and as a result it’s not feasible, particularly for third party controllers, to indelibly burn a static body of code into on-chip ROM."
[...]
>"From the DIY and hacker perspective, our findings indicate a
potentially interesting source of cheap and powerful microcontrollers for use in simple projects.
An Arduino, with its 8-bit 16 MHz microcontroller, will set you back around $20.
A microSD card with several gigabytes of memory and a microcontroller with several times the performance could be purchased for a fraction of the price.
While SD cards are admittedly I/O-limited, some clever hacking of the microcontroller in an SD card could make for a very economical and compact data logging solution for I2C or SPI-based sensors."
For your $2, you get:
* An internal oscillator which lets you run without an external clock circuit (typically limited to around 8MHz, and can cause clock drift, so not good of accurate timing is important).
* Hardware UART interfacing logic
* Hardware SPI interfacing logic
* Hardware I2C interfacing logic
* Several ADCs
* 23 GPIOs
* 2kB data memory
* 1kB EEPROM
* 32kb flash memroy
There are other microcontrollers out there, each with their own trade-offs. I personally like AVRs, as they have good quality open source compilers, you can mooch off the Arduino community for libraries[3], and in-circuit programmers can be had for cheap[1].
If you want to learn more, I suggest this article[2].
0 - https://www.mouser.com/ProductDetail/Microchip-Technology-At...
1 - https://www.adafruit.com/product/46
2 - https://www.evilmadscientist.com/2007/using-avr-microcontrol...
There is a DIP ATMega328P version and in fact it's the one used on the Arduino UNO. It's also socketed! You can program it on the UNO, take it off, and it's good to go to be plugged into a breadboard, soldered standalone on perfboard, etc. and replaced with a new one.
But yeah, 64gb in basically half a fingernail is unbelievable