Can you program any modern microcontroller yourself (without programmer) - Page 1
Forum section: electronics / general

author: possum
author_rank: Contributor
timestamp: October 27, 2018, 12:22:58 am
content: In good old days, when we used cpu+eprom, we could easily flash it ourself – no need to have a computer and programmer – just set data and address lines. Can even do it by hand using switches, if your code is not too big.It there any modern microcontrollers which let you do something similar?

author: MK14
author_rank: Super Contributor
timestamp: October 27, 2018, 12:31:53 am
content: I'm not 100% sure of the exact details (the datasheets, on how the serial boot loader works, would be a good starting place, for you), but I think some microcontrollers, have built in serial downloaders, in their flash or similar.So if you arrange for your switches/buttons, to (via TTL parallel load shift registers or something), to serially respond/use the serial bootloader (possibly some Atmel MCUs and probably others). You could probably step by step (single step like), gradually enter your initial code into it, and go from there.N.B. As I said, I'm NOT 100% sure about it, but it might work. The clocking would have to be sorted out, so that the MCU waits for each serial byte to be ready (set on the switches), then programmed in, BYTE by BYTE.

author: JPortici
author_rank: Super Contributor
timestamp: October 27, 2018, 12:57:24 am
content: TL;DR: yes you can.For example, you can make a programmer for any Microchip PIC, you just need to follow the command sequence described in the part's flash programming specification document.There the programming protocol is completely described.for microchip ICSP is SPI-esque, but for larger/more complex chips they use a programming executive... basically you only load the smallest program possible (just like a bootloader) which in turn run RTSP (run time self programming) on the internal flashthis approach is used by almost everybody, some chips come with builtin bootloaders for uart,usb,even CAN i think, but the idea is the same: program the flash directly with a small bare bones firmware that will be able to communicate with the host (programmer/computer/whatever) and program the rest of the flash with some high level support

author: legacy
author_rank: Super Contributor
timestamp: October 27, 2018, 02:18:58 am
content: Quote from: MK14 on October 27, 2018, 12:31:53 amthe relatively modern Analog Devices "Precise(1) Processor" comes with a serial bootloader(2) in the masked ROMthe old Motorola 68hc11 comes with a serial bootloader(3) in the masked ROM, allowing you to upload 256 or 512, or 1Kbyte of code+data in the built-in ram(4)Atheros MIPS32 SoCs bootstrap from an SPI device(5), but there was an old Atheros with an SPI-to-UART adapter and a "pulse strobe" which made it able to bootstrap from the uartothers?(1) it should be called "precise" because it has built-in ADCs and DACs.(2) there is a custom protocol(3) it's wild and raw, there is no protocol at all, it uploads bytes from the first to the last.(4) the exact size depends on the MPU model. Usually, it's 512byte on the E-series.(5) usually SPI-flash or SPI-FeRAM, but there are also SPI-ROM-emulators

author: tsman
author_rank: Frequent Contributor
timestamp: October 27, 2018, 02:20:38 am
content: STM32 microcontrollers have an internal bootloader that supports USB DFU, UART, I2C and CAN. Which ones are supported depends on the microcontroller you've got. I'd still suggest using a J-Link or ST-Link for programming/debugging though even though you can program them without one.Many years ago, you could buy EEPROMs and combo EEPROM + port expanders from Xicor that were preprogrammed from the factory with their 8051 or 68HC11 bootloader. They called it a Self Loading Integrated Code E2PROM. No need to program anything before assembly and without the costs of having the EEPROMs programmed with your custom code.

author: legacy
author_rank: Super Contributor
timestamp: October 27, 2018, 02:39:53 am
content: I believe the award for the weirdest beast can be assigned to the first "TiniJava"Not exactly all in the chip, but considering it was manufactured in a sim72 shaped card (preassembled and sold ready out the box) and it was considered a "processor", this beast comes with a built-inwaba(1) firmware capable to upload from the LAN and then execute chunks of modified java1-bytecode.(1) sort of simplified java virtual machine, specifically this was for a special version of 8051 core extremely enhanced which Maxim/Dasemi manufactured in the 2000s with a clock of @40Mhz, a larger address bus and tons of built-in peripherals.

author: westfw
author_rank: Super Contributor
timestamp: October 27, 2018, 02:40:44 am
content: >QuoteNo, you couldn't. When we used CPU+RAM, you could program via panel switches - address, data, WE - bang.But EPROM was an absolute horror, frequently requiring multiple pulses of obscure voltages that were different for each vendor's chip. The older the EPROM, the worse it was. Early parallel flash wasn't better.You usually needed an expensive stand-alone EPROM programmer to do it for you. Only in the post-PC era could you get inexpensive EPROM burners that used the PC for the "thinking."A bunch of the current microcontrollers are "better" and still have parallel programming modes. The larger AVRs, for instance. And I'm pretty sure I've seen a hack where someone keyed in a program using one of the serial protocols...

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 27, 2018, 02:54:30 am
content: Quote from: westfw on October 27, 2018, 02:40:44 amAhah, true that!I remember the "universal" EPROM programers had convoluted programming voltage circuitries and a lot of different programming "algorithms" embedded in software.Even building one as a diy project was no small feat if you wanted to get a chance to make it program the EPROMs you were actually using.

author: westfw
author_rank: Super Contributor
timestamp: October 27, 2018, 03:55:04 am
content: QuoteDave did a tear-down of one of the Data I/O "Universal Programmer."

author: jaromir
author_rank: Unknown
timestamp: October 27, 2018, 09:33:18 am
content: Quote from: possum on October 27, 2018, 12:22:58 amProgramming specifications for may MCUs are avaiable, those days mostly serial, there is nothing that can stop you from bitbanging it by hand. Few switches and RS flipflops or monostable multivibrators are all you need to debounce them.I'm pretty sure I've seen it before for AVR, but can't find it now.

author: legacy
author_rank: Super Contributor
timestamp: October 27, 2018, 11:51:31 am
content: Quote from: jaromir on October 27, 2018, 09:33:18 amlike bitbanging jtag by hand? the thing you are supposed to do as first aid when you have just bricked(1) your router on the attempt to play sort of "hacking" game, which usually means that you have bought a cheap router to install OpenWRT/Linux on it to show the world that you HAVE great attributes, but you have had bad luck, and the toy is now broken.yes, in the theory of theories ... bitbanging jtag is good, except that is so damn slow, and usually, it doesn't work with "home-made" cablessorry for my sarcasm, my neighbor is stressing me for that, and again I am going to suggest him to buy a damn cheap and decent usb-jtag cable, and again he is going to insists that bitbanging jtag is good blablablabla, and it sounds like a record round round round, and I think my next purchase is a set of earplugs(1) he must have tried to upload something in the boot area of the flash, something must have gone wrong like a mess, and now he needs a way to in-circuit-reprogram the flash. The Jtag offers a way to take the control of the bus of the SoC, therefore it can inject byte in ram, allowing the user to bootstrap from there to directly program the SPI chip, or the jtag can be directly used to program the chip.

author: jaromir
author_rank: Unknown
timestamp: October 27, 2018, 01:29:37 pm
content: Quote from: legacy on October 27, 2018, 11:51:31 amIf you wish, why not. It's pointless, as pointless as question by OP, but doable. That's why people are using more sophisticated tools.Anyway, JTAG is quite complicated interface, there are simpler ones, AVR ISP being one example.Oh, I finally found the video answering OP's question

author: technix
author_rank: Super Contributor
timestamp: October 27, 2018, 02:18:53 pm
content: STC 8051 MCU is programmed using just serial and an internal mask ROM serial bootloader, Those chips only require a serial port to program. STM32 chips has mask ROM bootloaders too that supports serial or USB boot.

author: NorthGuy
author_rank: Super Contributor
timestamp: October 27, 2018, 03:42:19 pm
content: Quote from: legacy on October 27, 2018, 11:51:31 amFT232H lets you automate bitbanging JTAG and works at 30 MHz. I don't know if this qualifies as manual

author: legacy
author_rank: Super Contributor
timestamp: October 27, 2018, 03:58:20 pm
content: Quote from: NorthGuy on October 27, 2018, 03:42:19 pmIndeed! It's a cheap USB-JTAG cable for which there are JTAG controlling programs, it's not exactly a bitbanging by hand since it has support from the FTDI company itselfmy neighbor insists on using a homemade cable with resistors a buffer for the LPT port, and both the hardware and software are a mess.Result? it doesn't work and he is stressing me on the how/why/what/etc ...Quote from: NorthGuy on October 27, 2018, 03:42:19 pmI reserve some doubt on this.

author: technix
author_rank: Super Contributor
timestamp: October 27, 2018, 05:47:06 pm
content: Depending on your needs, you can build a board with STM32F042 or STM32F405 with BOOT0 line and USB brought out. With an empty Flash or with BOOT0 held high upon boot the device will enter a mask ROM USB boot loader, and you can then program it using some PC software.There you have some bootstrapping methods since this firmware can implement something else’s programming protocol.

author: legacy
author_rank: Super Contributor
timestamp: October 28, 2018, 05:30:06 am
content: Quote from: technix on October 27, 2018, 05:47:06 pmhow does it work? I haven't yet given an eye to it.which software is used on the host side for the usb?

author: technix
author_rank: Super Contributor
timestamp: October 28, 2018, 05:42:23 am
content: Quote from: legacy on October 28, 2018, 05:30:06 amST has a Windows-only kit of software and drivers that will allow you to program a chip when it is in mask ROM USB DFU bootloader. To enter this mode you need to bring out the USB lines and BOOT0 line: BOOT0 at high level will boot the chip into the bootloader, and USB for host connection.The AFAIK the F042, F072, F405 and F407 families has this feature. All except F042 requires an external 8MHz crystal on HSE clock to work.