Microcontroller programmers - need to disambiguate some information - Page 1
Forum section: electronics / beginners

author: bodzio_stawski
author_rank: Regular Contributor
timestamp: March 20, 2023, 11:27:34 pm
content: Hello!I'm wondering about some aspects of hardware tools for programming microcontrollers. Unfortunately, so far this topic has been neglected by me - I admit. I am wondering about the structure of programmers for microcontrollers, namely (examples):1) USBasp - programming tool designed for ATmega and ATTiny microcontrollers, which has a pre-programmed Atmega microcontroller on board.2) Programming tool based on CH340, usually named as "USB-UART converter based on the CH340 chip, which can be used as a programmer for STC microcontrollers". Ch340 of course does not require programming. link below:shorturl.at/uGHV63) Universal programmersI had a hard time finding a decent reference here. I used a foreign language article automatically translated into English, for which I apologize (see the attachment in pdf).Universal programming boards should probably be understood as programming tools that, using CPLD (and maybe FPGA) gain a function that allows reprogramming the internal structure of gates to work with particular interfaces of microcontrollers, like ISP or JTAG.Question:Trying to understand how microcontroller programming devices work, two things bother me:1. Some boards like USBasp are based on microcontrollers, but others like 2) - CH340 chip only (not programmable). Why in the case of 2) a non-programmable chip is enough?2. Even universal programmer boards that reprogram themselves internally (CPLD) depending on the desired interface, when selected, emulate this interface, so they probably become it - as if they were single, non-programmable chips.But then nothing else is needed - no additional microcontroller is needed if I'm not mistaken.So why a seemingly overcomplicated solution 1) if we have either a cheaper solution 2) or a 3) more universal solution?

author: darkspr1te
author_rank: Frequent Contributor
timestamp: March 21, 2023, 07:20:42 am
content: Generally programmers come in two major flavours, LVP and HVP that low voltage programming and high voltage programming. Then you will have a subset of those programmers being MCU controlled and Host controlled.The mcu controlled units tend to have a lot more functions baked in and cover more hardware types as they often built specific for those devices. The non MCU or host controlled programmers are often hacks or custom software to provide the functions and may even require additional hardware to interface to the device under test.I personally have many programmers from Pic32 to STLink v2, universal jtag adapter (bus blaster) , multi interface device (bus pirate) , black magic programmer and custome ones i've built to dump firmware from protected devices.if you intend to hack about with many devices then you will end up with many programmers, if you are staying with a chip type then you will no doubt end up with that specific programmer.darkspr1te

author: Psi
author_rank: Super Contributor
timestamp: March 21, 2023, 07:31:13 am
content: Every MCU manufacture decides how they want to do programming, and each approach has advantages.

author: BillyO
author_rank: Super Contributor
timestamp: March 21, 2023, 02:19:28 pm
content: If you are interested in getting going with Atmel MCU's why not start with Arduino to get your feet wet? The platform is quite flexible and integrates a lot of the open source software tools that you can then investigate. The same from the hardware side. The Arduino uses a simple LV programming method that employs a USB to TTL serial converter.

author: dobsonr741
author_rank: Frequent Contributor
timestamp: March 21, 2023, 02:32:52 pm
content: The universal parallel port programmer you attached is from 15 years ago. Since then parallel ports gone extinct. The obvious choice is USB.It’s the ease of use and low cost adoption that drives an MCU lineages on the maker market. Prime example: Arduino. Also, the flash memory no longer requires high voltage to reprogram - so the HVP programmers died.What is left are the boot loaders, no need for programmers at all, or SWP, that gives JTAG equivalent higher functions, more than boot loader provides.CH340 is not a programmer, it is a usb to serial bridge, to communicate with the serial bootloader. You’ll find it when a low end MCU is not having native USB.The trend you can see is reduced connection count for programming, saving usable pins. And the communication going red using the number of parallel lines to bare minimum and to high speed (SWP is a 5MHz) or native USB.PICS and AVRs with their specific programmers are the relic of the past, you might have noticed the new trends with STM32 and ESP lineages.So yes, universal programmers exist, you can say they are USB boot loaders and SWP.

author: Infraviolet
author_rank: Super Contributor
timestamp: March 21, 2023, 08:46:08 pm
content: As someone who has made a lot of use of an arduino as an AVR programmer for other AVR chips I can give some suggestions about question 1.When using a microcontroller in a programmer the microcontroller is just running a piece of software to emulate the behaviour of a dedicated programmer chip, as long as it can act quickly enough to mett any time requirements it is functionally identical from an outside view. What a programmer does is take a compiled file (often a hex file) fed to it from a computer by software such as avrdude, and bit bang that hex file over an SPI style link to the chip being programmed, also toggling the chip's reset line at some points and reading back info from the chip about whether it has been successful. The programmer is just there to take the hex file which the computer is putting out and convert it to highs and lows on wires so as to load it in to the chip.The Arduino IDE does this sort of thing all in the background when "uploading with a programmer".