Emulator of Original Dell Charger Using ATTINY85
github.com
github.com
Unless you have a USB bootloader programmed on the chip, but you still need the adapter to flash the bootloader in the first place.
That said, lots of current MCUs come with UART, I2C and/or USB bootloaders allowing to erase/program (if not disabled). This bootloader is typically included in factory ROM, not to be programmed by you or a third party.
The only exception is if the motherboard GPIO was say 3.3v and you had a 1.8v only MCU, but level shifters aren't exactly expensive.
I unplug my phone for a moment, or use one of several identical cables I have lying around. If this thing needs a dedicated cable then that seems just as annoying in practice as needing a dedicated "programmer" box.
And of course with wireless enabled microcontrollers one can update over the air. Nordic NRF5x over Bluetooth for example, or ESP32 over WiFi.
1: http://digistump.com/products/1
2: https://github.com/micronucleus/micronucleus
Beyond that, a few hundred bytes is usually enough for a simple bootloader. That tends to accelerate things even more. And writing bootloaders tends to be fun. I've done a tinyusb bootloader on an attiny45 with the user program sharing the v-usb stack in the bootloader and also a CEC bootloader. The CEC one of course took several minutes.
Here is an article on reverse engineering the memory module. https://hclxing.wordpress.com/2014/02/06/hacking-the-dell-la...
Yikes! I used a no-name charger on my Dell Latitude for quite a while, and it never stopped me from charging. Just annoyed me about it (press F1 to continue on boot) whenever I took the battery out (wiping the CMOS) and didn't turn off the AC warnings in the BIOS. The one I was using didn't have a serial chip in it, so the laptop flagged it as unknown.
If that is the case, part of me wants to play Devil's advocate and say that Dell have erred on the side of caution: these no-name adapters really are quite terrifying with thermals, which makes me wonder what wattage they're actually rated for. I was frequently in WTF mode because the adapter block was too hot to keep my hand on. I didn't really have a choice either, as my battery was at like 38% capacity. This official 130W is barely warm under load.
Aside: one thing that really eek'd me out about that no-name adapter is that it has a green LED inside it. The only thing is, you can only (just barely) see it through the slits on the sides because the plastic isn't clipped together properly. The manufacturing quality is atrocious.
# Running on battery power.
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
3500000
3500000
3500000
3500000
# No-name charger inserted.
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
3500000
3500000
3500000
3500000
# Genuine charger inserted.
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
3500000
3500000
3500000
3500000
[0]: https://unix.stackexchange.com/questions/576692/ignore-ppc-s...[0]: https://news.ycombinator.com/item?id=30458632 (god I really suck with the links today, lol)
http://web.archive.org/web/20100329110047/http://www.laptop-...
An explanation of (one of) the design flaws:
http://web.archive.org/web/20100412160453/http://www.laptop-...
Not only is it clearly hostile to the aftermarket, but putting a chip that has 12V absolute maximum ratings in an environment where it could easily be shorted to the 19-20V output of the PSU seems almost like "engineered unreliability" to me.
On the other hand, when IBM/Lenovo had to solve the problem of identifying the wattage available, they used a simple and robust solution of a single resistor:
https://www.thinkwiki.org/wiki/Power_Connector#Signal_Pin
https://www.thinkwiki.org/wiki/Power_Connector#Signal_Pin_2
The only improvement I could make upon that scheme would be to make the correspondence between resistance and wattage monotonic, but otherwise it's an example of non-overengineering and aftermarket-friendly solution.
I'm excited for the Rust + AVR world to move forward a bit so I can keep playing with it without the currently required hacks :)
Nim can already run on most MCUs (I've experimented with samd21 and rp2040), it just requires a few compiler flags or linking steps that are not super well documented. Ratel aims to automate that and provide some high level interfaces for hardware access (gpios, etc).
In the interest of shameless self promotion :), my own experimentations are :
https://github.com/EmbeddedNim/svd2nim
https://github.com/auxym/nim-on-samd21
And I've used and contributed to picostdlib (https://github.com/beef331/picostdlib), the rp2040 support library.
All just as a hobby, but it's interesting to learn that some companies are actually looking into Nim for firmware! Embedded seems like such a slow moving industry. I believe the author of Nesper and Nephyr also developed them for professional work.
Nim I believe is an answer to it though, and embedded being slow moving with a C target is perfect for it!
I even have hardware UART support and have a working SIM7000 modem connection going (though only with AT commands, not PPPoS yet, though I'm planning on that next).
Nim is the future of firmware development, of that I am sure.
But folks are reporting that if you make a 20V USB-micro, they'll charge. Sweet. Riskier than this links careful negotiation over 1-wire, but so convenient. I'll probably rip apart one of my usb-c to 20v barrel jacks & make a cable, in case I want to go back to these units. The need for a custom charger has been a huge barrier to ever wanting to use them again, very nice that these old systems will just work, when given power.
EDIT: On further thought I think that connector must be intended to represent the laptop input and Vcc is the output of a generic power supply (with sufficient voltage and current capacity). It was not clear to me because my Dell laptop doesn't appear to have a 3-pin power connector so maybe this only applies to certain models.
The only benefit of the attiny seems to be that you can save a few millimeters of board space, but if that's your concern there are plenty of far smaller, cheaper and more capable microcontrollers in BGA packages.
It's also kind of a fun challenge working within the limitations on both the HW and SW side.
Truth be told, the 85:s are a bit old now, it was released around 2005. But even the more modern "[012]-series" [1] don't support USB, it is kind of the point. The linked Wikipedia page says:
ATtiny microcontrollers specifically excludes various common features, such as: USB peripheral, DMA controller, crypto engine, or an external memory bus.
[1]: https://en.wikipedia.org/wiki/ATtiny_microcontroller_compari...
[1] https://www.mouser.com/ProductDetail/SparkFun/PGM-11801?qs=W...
I'm generally against capital punishment, but for whatever exec pushed this through - I think we could make an exception.