Author Topic: Can you program any modern microcontroller yourself (without programmer)  (Read 8726 times)

0 Members and 1 Guest are viewing this topic.

Offline possumTopic starter

  • Contributor
  • Posts: 13
  • Country: au
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?
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 5385
  • Country: gb
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #1 on: October 27, 2018, 12:31:53 am »
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.
« Last Edit: October 27, 2018, 12:38:43 am by MK14 »
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3916
  • Country: it
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #2 on: October 27, 2018, 12:57:24 am »
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 flash
this 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
 
The following users thanked this post: MK14, possum

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #3 on: October 27, 2018, 02:18:58 am »
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.

  • the relatively modern Analog Devices "Precise(1) Processor" comes with a serial bootloader(2) in the masked ROM
  • the 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 uart
  • others?


(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
« Last Edit: October 27, 2018, 02:31:02 am by legacy »
 
The following users thanked this post: MK14

Offline tsman

  • Frequent Contributor
  • **
  • Posts: 599
  • Country: gb
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #4 on: October 27, 2018, 02:20:38 am »
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.
« Last Edit: October 27, 2018, 02:27:04 am by tsman »
 
The following users thanked this post: MK14, possum

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #5 on: October 27, 2018, 02:39:53 am »
I believe the award for the weirdest beast can be assigned to the first "TiniJava"  :D

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-in waba(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.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4662
  • Country: us
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #6 on: October 27, 2018, 02:40:44 am »

>
Quote
when we used cpu+eprom, we could easily flash it ourself
No, 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...
« Last Edit: October 27, 2018, 02:43:05 am by westfw »
 
The following users thanked this post: possum

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17822
  • Country: fr
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #7 on: October 27, 2018, 02:54:30 am »
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.(...)

Ahah, 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.
 
The following users thanked this post: GeoffreyF

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4662
  • Country: us
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #8 on: October 27, 2018, 03:55:04 am »
Quote
the "universal" EPROM programers
Dave did a tear-down of one of the Data I/O "Universal Programmer."
 

Offline jaromir

  • Supporter
  • ****
  • Posts: 349
  • Country: sk
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #9 on: October 27, 2018, 09:33:18 am »
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?

Programming 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.
 
The following users thanked this post: MK14

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #10 on: October 27, 2018, 11:51:31 am »
there is nothing that can stop you from bitbanging it by hand

like 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" cables  :D

sorry 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.
 
The following users thanked this post: MK14

Offline jaromir

  • Supporter
  • ****
  • Posts: 349
  • Country: sk
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #11 on: October 27, 2018, 01:29:37 pm »
like bitbanging jtag by hand?

If 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

 
The following users thanked this post: MK14, possum

Online technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #12 on: October 27, 2018, 02:18:53 pm »
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.
 
The following users thanked this post: MK14, possum

Online NorthGuy

  • Super Contributor
  • ***
  • Posts: 3567
  • Country: ca
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #13 on: October 27, 2018, 03:42:19 pm »
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" cables  :D

FT232H lets you automate bitbanging JTAG and works at 30 MHz. I don't know if this qualifies as manual :)
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #14 on: October 27, 2018, 03:58:20 pm »
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" cables  :D

FT232H lets you automate bitbanging JTAG and works at 30 MHz

Indeed! 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 itself :D

my 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 ...


and works at 30 MHz

I reserve some doubt on this.
 

Online technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #15 on: October 27, 2018, 05:47:06 pm »
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.
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #16 on: October 28, 2018, 05:30:06 am »
you can build a board with STM32F042 or STM32F405 with BOOT0 line and USB brought out

how does it work? I haven't yet given an eye to it.
which software is used on the host side for the usb?
 

Online technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Can you program any modern microcontroller yourself (without programmer)
« Reply #17 on: October 28, 2018, 05:42:23 am »
you can build a board with STM32F042 or STM32F405 with BOOT0 line and USB brought out

how does it work? I haven't yet given an eye to it.
which software is used on the host side for the usb?
ST 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->