Skip to main content
Topic: Universal MCU Programmer (Read 7477 times) previous topic - next topic

Universal MCU Programmer

Dangerous Prototypes community,

I just broke into electronics, I am a computer engineering student at a four year university, and I am going to start participating where I can here...

So right now I am still learning what most of you might consider basics, but I am currently working on a little tool I am calling usb pirate (this name is probably already used, but since I doubt this will leave my local machine I didn't care)

It's pretty simple, I am using the FT232R (as used in the usb lcd universal backpack), and expanding its serial output to 16 bits with 2 series shift registers (the same shift register used in the usb lcd backpack (74HC595), in fact most of this circuit is from the usb lcd backpack). I've also added a 12V output (5 to 12V stepup with enable output) that is digitally controlled by the FT232R.

So my intention with device is programming any MCU that I want, as well as having more than enough 5V outputs than I can possibly want for other uses. The software used to control the board is already written, all that I need to develop is programming routines for specific MCUs (PIC, 8051, ect). Software has always been a strength of mine.

It would be cool to get pointed in a better direction with my hardware, or just even be aware of limitations. I will post additional information upon request.

So in the unanticipated event that this is something that might want to be documented and worked on here, fuck to the yea. Id be happy to open a project.

-FatalShrooms

Re: Universal MCU Programmer

Reply #1
Of course I didnt even look at Bus Pirate. Looks like I am building that...

Re: Universal MCU Programmer

Reply #2
Man that is quite the task before you. I mean just gathering the data will be months of work (each chips unique identifier, what protocol each chip supports, chips max size, chips page size, bootloader size/area, how to put it into program mode, eeprom size (if you want eeprom support).)

This will take you years! Good luck.

There is a program called AVRdude (for avrs of course) and in its package includes a large file that contains everything about ever avr chip made; its how they are able to support every differnt chip; like you cannot save a sample file from a LA and play it back on a differnt AVR and expect it to work. So every chip is differnt.

But if you can take that file and modify it to your needs; the AVR gathering is done for you. I dont know how AVRdude is licensed so I would check that first; and if you have any plans to sell it or share its source; you should contact them and ask or find if there page says its OK to use that file how ever you like...

How far along are you in this project?

Re: Universal MCU Programmer

Reply #3
Yeah seems like a lot of work. Fortunatelly, most companies provide programming specifications when you want to develop programming solutions.

Cypress programming specifications for PSOCs can be found here http://www.cypress.com/?rID=2543, they even have an APnote with code.

Re: Universal MCU Programmer

Reply #4
Yea I expected that this is far to ambitious and low level to make any serious system, and that there already was a solution to such a system. This project is more of a learning experience for me. However I was only planning on supporting a few MCUs for myself, tonight I just about finished supporting PIC16F87xA MCUs.

The project so far outputs 16 bits with a clock period of 30ns * 16, and I am (in the process of) using 4 of those bits to program a PIC16F87xA. For the PIC16F87xA series I have a file that handles all programming routines as specified in "PIC16F87XA Flash Memory Programming Specification”, but I'm about a day or two from attempting to actually program one.

After I get this working I might just drop some coin on either parts (maybe an AVRdude) or a good programmer. Maybe then I will start working within this community. Any suggestions on something I might be useful for?

Re: Universal MCU Programmer

Reply #5
We worked on a FT232 multi-programmer once. There are actually a number of apps (JTAG programmer) and patches to get various apps (AVRdude) to work with FT232.

PIC programming will be an issue, as most PICs have some little quirk. You're welcome to our piratePICprog code.

Another thing with will probably be a huge limiting factor is the serial->parallel output on the 595s. It's a great technique, but it can be painfully slow when you have to clock in 10-20bytes for EACH word (2-3bytes) of flash that you program (on eg PICs).
Got a question? Please ask in the forum for the fastest answers.

Re: Universal MCU Programmer

Reply #6
it would be cool just to make an app that would request the user to input the data for unknown chips...like add to the database stuff...
something like it asks you what kind of protocol the uC uses for programing... than asks you for the ID...programing code...and stuff like that... that would make it universal, but not necessarily be so much work ass to search through every uc and add them to  your database...
best regards FIlip.

Re: Universal MCU Programmer

Reply #7
The serial to parallel output should only multiply the entire programming period by 16 right? Anyways I'm still just now breaking into MCUs. I really like arakis' idea if it would actually work. What kind of variables are present in MCU programming algorithms? If we can get a good list I might throw this together, while of course minimizing hardware (maybe removing the 595's if they arnt necessary).
chip ID (database key)
programming code
setup time
hold time
[maybe a simple UI to move programming commands around as objects? That could allow for the quirkiness i've seen in PICS, eg delay 4ms after certain commands for internal timed procedure]
Vpp?


I don't know, enough about MCU's in general, I've only looked at programming routines on 3. Atmel 4051, 8051, and this PIC. So I don't really know if this project is reaaally worth it. In fact, I was planning on trying to work on a daughter board (or some expansion) to the bus pirate. I read someone suggested reopening working on bus pirate's PIC programmer. It may be better for me to just to work on something thats already well developed.

Re: Universal MCU Programmer

Reply #8
Well, in case anyone is interested, I think I'm giving up on this haha. I got to a point where I am programming from a hex file, but there is one thing I cant write my brain around...

Example HEX:
:06 0000 00 0A128A11CC2F48

:10 0F98 00 83010A128A11D02F8312031385018316 45

:10 0FA8 00 03138501F001F1017108803AFF008330 D5

:10 0FB8 00 7F02031DE12FE8307002031CE42FE52F A8

:10 0FC8 00 E72FD62FD62F0130F0070318F10A0030 8B

:10 0FD8 00 F1077108803AFF0083307F02031DF62F 66

:10 0FE8 00 E8307002031CF92FFA2FE72FD62FD62F DF

:08 0FF8 00 D62F0A128A110028 0D

:00 0000 01 FF

Its a simple program, but for this particular PIC, I am supposed to input data in 14 bit words. For example F1 is a data word that is supposed to be latched into the uC. I just dont see any combination I am supposed to input, Maybe take 14 bits out of this byte string at a time? ANYWAYS I think I have learned more than enough with this project, and I am going to just build a supported piece of hardware and move on with my life.

It was fun, but I hated it at the same time haha. If there is any applicable insight have at it. And thanks!

Re: Universal MCU Programmer

Reply #9
I made an AVR programmer from scratch. Google HEX wiki and you can see info on it. All you really need todo should delete all the crap you dont want and only upload the actual hex.

Re: Universal MCU Programmer

Reply #10
So I finished writing code to program a PIC16...  And yea ian I totally underestimated what you said about shift registers making this thing super slow. Im only loading a 9 line hex file right now and I can actually see the command LED (just a little blinky test atm) issuing commands. This is totally useless.

So now that I know a bit more about hardware. I guess I should just set up a SPI / I2C pinout straight off my FT232R. If I also have a controllable 12V source I should be able to mess with just about any MCU I come across right?

Also while im here, whats the best way to get a 12V digital controlled line? I was considering a 5V -> 12V dc-dc with EN, but I bet id get slammed on that too somehow...

Re: Universal MCU Programmer

Reply #11
Quote
So now that I know a bit more about hardware.

Then it was a huge success :) I only knew about the serial to parallel slowness because I've been there myself.

Take a look at our universal programmer, it does exactly what you describe with a 12V source and FT232:
http://dangerousprototypes.com/docs/FT232_programmer
Got a question? Please ask in the forum for the fastest answers.

Re: Universal MCU Programmer

Reply #12
Were there any problems with it? I was pretty sure I read you cant pull more than like 150uA out of that 3v3 pin, (ballparking what i remember)...  But then, I guess programming MCUs probally doesnt draw much current anyway?

So the big thing for me is that Vpp, it looks like you modify, probally trim that 13V by using 2 ft232r pins. I am still very bad with transistors, that class is next quarter, but for this circuit is it just a simple on off to each transistor? Looks to me like one is your Vpp EN control, and the other is like a current controller? Ohh and you got a Vdd switch too.

Yea I just know nothing about thresholds, or something. I know my transistors never work as intended so I am missing a piece of that puzzle lol

Neet thanks for sharing!

 

Re: Universal MCU Programmer

Reply #13
We never went further with it, but the circuit should be ok.The 13VPP supply is just a booster IC. The FT232 pins switch 13volts with the transistors. 3.3volt pins can source anywhere from 4ma to 25ma in my experience.
Got a question? Please ask in the forum for the fastest answers.