PIC/AVR/EEPROM programming voltage SMPS

Great minds must think alike :slight_smile: That was also my first attempt at a VPP ā€œPlankā€ for Bus Pirate 5, but I think @electronic_eel has a point that margining a cheap SMPS chip is going to be easier/more reliable than trying to roll our own.

Some old PIC I worked with had CCP modules that I believe I could use to implement simple pulse-skip without any interrupt overhead. The RP2040 interrupts have a lot more overhead than the simple PIC, not fighting those battles seems like winning the war.

Are you going to have a KFC Christmas bucket? :joy:

2 Likes

Well I have a question regarding order @ian or @Jin . Cuz I ordered SMPS plank. And I wonder if there is going to be improved version. Which one will I get. Which one is going to be supported by software. I mean is there a point to even send it. The order is hanging because of the RS232 (HQ) in production as @ian mentioned on the chat.

So I might wait for the best solution dreaming about KFC bucket

1 Like

The current ā€œdevelopers boardā€ is the only one that exists. Anything else is vaporware. The idea being if anyone is eager to port some open source PIC/AVR/etc programmer to the Bus Pirate there would be some method to generate a programming voltage.

Also, I had fun designing it :slight_smile:

Someone linked an open source PIC programmer that Iā€™ll port as a 3rd party firmware. It seems pretty low priority though, unless you tell me otherwise.

JTAG is brought up a lot, but rarely PIC. I assume PIC/AVR/MSP430 are not particularly popular these days, with all the cheap and open source friendly ARM stuff like ESP32. Also the dedicated dev tools are cheap and common, not the offensively expensive ghouls they were in the past.

I would love to hear other thoughts on this though, and of course the end goal is to add everything and the kitchen sink.

2 Likes

Well I kind of hope to use SMPS plank to unbrick my UPS. We verified that EEPROM is ok. So now I would like to try to dump MCU https://ww1.microchip.com/downloads/en/DeviceDoc/doc0265.pdf this chip from working unit to da bricked unit.

I understand that most likely (100% sure) its not me who is going to write the code for it. But I can surely test that in real life scenario. As BusPirate is really swiss army knife withe the plank possibities.

Edit:
I also now realize how good is RP2040 in general. Great choice for BP. Kitchen sink and toastie maker included

2 Likes

I had a look at the datasheet. It appears that the chip has a parallel programming interface?

Address is set on Port 1 pins 0-7 and port 2 pins 0-3. Data is in and out on all of port 0, which is 8 pins.

You also need to set the mode on 4 pins 2.6,2.7,3.6,3.7. I guess you need ~28 pins to program it?

The low-voltage program-
ming mode provides a convenient way to program the
AT89C51 inside the userā€™s system, while the high-voltage
programming mode is compatible with conventional third-
party Flash or EPROM programmers.

Is this chip removable? It sounds like the high voltage programming versions donā€™t like to be reprogrammed in circuit (or rather the circuit might not like it).

If it is a removable DIP chip, then there are cheap-ish (?) writers if it really is ā€œindustry standardā€.

Dropped an MT3608 on the schematic without much more thought. Using a PWM for margining is probably preferable, because we currently only have 4 pins remaining for actual programming duties.

Pin Purpose
VPP_SET PWM signal to margin SMPS output
VPP_FB VPP measurement feedback to the Bus Pirate
VPP_HIGH VPP high side enable switch
VPP_LOW VPP low side enable switch

Its PLCC44 package. I am waiting for header with board to convert to basic gold ping. Like a breakout thing.

I guess you also want to buffer the PWM after filtering with a simple opamp.

I think having explicit high/low pulses and not just High-Z + High is a good idea.

How important would it be to have one more pin for programming? Would that allow to work with more kinds of controllers?

If it is important, you could combine VPP_HIGH and VPP_LOW into one signal by using the High-Z/input mode to differentiate. Could be done with a comparator or TL431.
See for example here for how to do it: Electronic Eel: "Common problem: the microcontroller I selected haā€¦" - Treehouse Mastodon

If it is important to get 6 pins, you could move everything to I2C extenders on the plank and just route SCL and SDA over the two remaining ones.

2 Likes

I figured Iā€™d copy the Bus Pirate 5 margining. Low pass and then an op-amp.

That is a very fun little technique!

I donā€™t think itā€™s particularly important. We have enough for an SPI interface, but Iā€™ve never seen a uC with an SPI interface (not counting JTAG here). PICs have 2 wires plus VPP/RESET, AVR too? MSP430 doesnā€™t need a VPP in my past experience.

3 Likes

Guys you simply rock! I am still learning circuits theory and how stuff actually work.

1 Like

AVR is a mess in this regard. They have like a dozen different programming protocols, and each controller just supports one of the regular and one of the HV protocols.

High Voltage Serial Programming, High Voltage TPI programming and High Voltage UPDI look like they are possible with 12V + 4 regular lines.

High Voltage Parallel Programming wonā€™t work, youā€™d need 8 data lines in addition to the 12V and some control pins.

2 Likes

There is another kind of controller that needs high voltage programming: the Padauk PMS150, PFS154 and derivatives, aka ā€œ10 cent microcontrollersā€. These were the cheapest option before the CH32V003 and PY32F002 came out.

IIRC you need two precisely variable voltages to program the Padauks. It has been a long time since I played with these, so I donā€™t remember all the details. But the programmer schematics usually used a boost converter to create a stable high voltage and then two opamps you could control with DACs or PWM to set the actual voltage derived from the boosted one.

There is a long thread on the eevblog forum that explains all the details:

Iā€™m not sure if it makes sense to try to integrate this capability into this plank, at the expense of digital IOs. But I just wanted to make this a informed decision.

2 Likes

Well I do get now that this plank wont help me program what I want. I am no EE so kinda looking for ready solution. Hoped for BP

Edit: actually recently I joined that forum and there is one person with exact same brick. Diffent model a bit but well the same hardware and firmware inside.

Donā€™t get stuff thatā€™s not useful. Open a support ticket and someone can remove it from your order.

The on-chip
Flash allows the program memory to be reprogrammed in-system or by a conven-
tional nonvolatile memory programme

But also look at the datasheet a bit to see if thereā€™s another programming mode. I only spent 3 minutes reading the datasheet so itā€™s possible I missed something. Would they really advertise that itā€™s in system programmable if you need to connect 30pins?

They included a BBS in the contact details, so a 30 pin hookup may have been considered in-circuit in this vintage.

1 Like

Support ticket submitted. You are right.

So I actually found this:

Notes about programming that stupid chip. And it seems complicated. Am I going to even do that in home enviorment?

But its possible to program it in-circuit.


I have this nice breakout for it. Should I lose hope?

1 Like

I think you should take the chip out of the circuit before trying to program it. The rest of the circuit will likely mess up the programming signals.

Also I think you can program it with a BP by using some I2C I/O expanders and a high voltage source to get the programming voltage.

3 Likes

Thatā€™s a wild ride! Hayes modems at 1200 baud. Programming languages that no longer exists in living memory.

But I think this is just the 5v version again.

There was a ā€œgrey boxā€ that could deal with the old 40 pin dip stuff, but I canā€™t seem to find it on taobao or Ali express. It may also be ancient history.

Dumping the chip is doable, but will need some custom hardware and firmware. I probably wouldnā€™t go the io expander approach because Iā€™m lazy, but I also donā€™t know what uC still exists that has 30 ios at 5volts. I guess an equally old PIC or something.

1 Like

Forgot to add this to my previous message: This will be a custom board as itā€™s quite application specific. Probably a one off, or very limited sales, so financially it doesnā€™t make sense for somebody to design something from scratch.

I was thinking about having two 16-bit I/O expanders with different addresses like SX1509 that Sparkfun is selling but thatā€™s for 3.3V output only with 5V tolerant pins. That wonā€™t work.

A shift register can work for address bits and there are 5V ones out there. But reading firmware will be challenging, you need another circuit to do that.

It is doable, just kinda hard because we lost all the tools. One may need to search auction sites for a programmer and a PC with a serial port. :slight_smile:

3 Likes

There is some article related. I am loosing hope and looking for 12V dedicated programmer. Owww I there a chance to use RS232 plank with some additional stuff and use it? Or maybe physical RS232 port in my old PC?

3 Likes

By custom hardware I meant more something on a bread board, but otherwise spot on. High voltage and parallel programming are really old school so hope for used equipment on eBay or roll your own.

Have you searched for the MC51 (whatever itā€™s called in the data sheet) standard programmer?

An easy 12v supply is 8 AA batteries or 2 ā€œlantern batteriesā€.

1 Like