5V MCU dilema. - Page 1
Forum section: electronics / general

author: paulca
author_rank: Super Contributor
timestamp: June 24, 2025, 02:36:49 pm
content: So I have a 5V Z80 circuit. I want to put an in-circuit programmer into it.I have a working Z80 board and I have a working STM32 Flash programmer. However, one is 5V the other is 3v3 and the chip is removed to flash.The way I see it is:1. I use an ATMega2560 bare metal and implement the USB->UART IC etc (basically C&P most of an Arduino). Accept that the Arduino is slow.2. Suck it up and start dropping down 16bit wide dual supply bidirectional bus transceivers and use an STM32F411RTC.Option 1 is probably easier all in. Option 2 however presents an in-circuit MCU which could do a lot more than just program the ROM. It's fast enough with decent enough triggering timer ports to intercept the Z80 and even puppet it to an extend for "in circuit debugging" via a basic commandline. The MCU can even generate the Z80 clock by default.Are there other options I'm not seeing? Can I get away with a bunch of normal 3.3V/5V tolerant 74HC245s rather than the expensive 16bit bidirectional 74HC16LVC245 or something. I read in their datasheet that they can be used to cross voltage boundaries because they are basically just level switchers with an "off button". I'm not sure how practical this is for dual voltage DMA though.

author: brucehoult
author_rank: Super Contributor
timestamp: June 24, 2025, 02:47:23 pm
content: Sorry, what's the problem? Why don't you just run everything at 5V?

author: NorthGuy
author_rank: Super Contributor
timestamp: June 24, 2025, 03:18:12 pm
content: What protocol do you use for programming?What is the data rate?

author: Kleinstein
author_rank: Super Contributor
timestamp: June 24, 2025, 04:01:21 pm
content: With an 8 bit system (Z80) there should be only the 8 data lines that have to be bidirectional. The addresses should be only one direction. One could consider an intermediate supply voltage (like 4 V) for the level translation up.Some of the older computer chips could also be OK with 3.3 levels even with 5 V supply.

author: SiliconWizard
author_rank: Super Contributor
timestamp: June 24, 2025, 04:43:14 pm
content: Normally, for TTL level, the high threshold is around 2.4-2.5V, so driving TTL inputs with CMOS outputs @3.3V usually works plenty fine.You only need level translation in the other direction, and if the pins are "5V-tolerant", you may not need any level translation at all.

author: paulca
author_rank: Super Contributor
timestamp: June 24, 2025, 05:28:25 pm
content: Why not all at 5V?That would be the Arduino Option. The arduino would be fine with ROM programming, but probably only ROM programming.Other options with more grunt are all 3.3V. Aka STM32.Protocol: Chip side JEDEC Parallel 16addr, 8 data.Speed: Glacial currently. I like leaving room for improvement. Like total data write and verify rate of about 2kByte/s.The STM32 is however fast enough to be an in circuit debugger and do so by generating the Z80 clock and thus stopping or slowing it, on breakpoints, enabling UART bus logging etc.. Hence the looking towards fully active bus transceivers. Read and write both buses.I don't mind the cost and I don't mind the schematic/pcb or SMD chips. I just thought I would ask for options, just incase someone says there is a compatible STM32 that runs at 5V or something along those lines.Also, I'm torn. The ATMega I expect is going to less hassle overall, but also provides less opportunities.A driver if you will, is that V2 of my Z80 core board is going to require internalising the main buses (without headers) and only expose a single 25pin IO bus. 8 address lines, 8 data lines and about 8 control. Single 50 pin IDC.To meet this requirement and still have flexibility for later, I thought giving an in-circuit MCU free run, almost co-processor or supervisor role would still allow me to access the core bus if I needed to without having to have pin headers and ribbons everywhere.

author: Siwastaja
author_rank: Super Contributor
timestamp: June 24, 2025, 06:02:48 pm
content: Indeed 5V TTL is directly compatible with 5V-tolerant 3.3V CMOS. This is good to keep in mind - also that any 74HCTgate can be used as a unidirectional level translator.

author: NorthGuy
author_rank: Super Contributor
timestamp: June 24, 2025, 06:40:17 pm
content: I would use a single 74LVC8T245 for bidirectional lines. It is unidirectional with switchable direction. The rest you can connect directly if the target uses TTL levels.BTW: FT2232H provides 8051 interface which you can control directly from PC through USB. I've never used this interface, but it looks exactly what you want. If you use FT2232H you do not need to program MCU, but it is rather expensive - around $5, and it doesn't solve your voltage level problem.

author: paulca
author_rank: Super Contributor
timestamp: June 24, 2025, 07:17:48 pm
content: Quote from: NorthGuy on June 24, 2025, 06:40:17 pmI am, for some reason, tempted to just buy and place 2x 74LVC16T245's and bi-directional all 16 address, 8 data and room for 8 control lines.It allows everything from the MCU being "effectively out of circuit" to the Z80 HALTed or BUSRQ'd and the MCU running rampant through the RAM with full control and most places in between.I already have working USB programmer code on the F411. Just need to port packages and that actually makes it easier as I get a full 16 bit wide GPIO register all to myself and my choice of 8 wide blocks.

author: fchk
author_rank: Frequent Contributor
timestamp: June 24, 2025, 07:27:14 pm
content: Quote from: paulca on June 24, 2025, 02:36:49 pmYes. There is for example Microchip dsPIC33EV. 5V, 70 Mhz, 16 Bit. Widespread. I use them often when I need a fast 5V platform.Nuvoton has got 5V ARM controllers as well. Might be difficult to source, though.And: There are modern 3.3V Z80 variants. eZ80F92 for example: 50 MHz, 24 bit linear addres space, 24 bit registers, fully binary compatible to classic Z80 code, 3.3V, ZDI Debugger interface, speed equals an 70MHz Z80 (since many opcodes take fewer cycles).

author: neil555
author_rank: Contributor
timestamp: June 24, 2025, 07:36:03 pm
content: STM8's can run from 5v and the 207/208 variants run at 24Mhz (20 mips)https://www.st.com/en/microcontrollers-microprocessors/stm8s207rb.html

author: PCB.Wiz
author_rank: Super Contributor
timestamp: June 24, 2025, 11:05:00 pm
content: Quote from: paulca on June 24, 2025, 05:28:25 pmThere are many 5V MCUs with 32b cores.lcsc gives 442 stocked ARM cores with 5.5V ratings, and if I add a filter for 72Mhz+, it gives 114 hits.If I then look for eval boards withincluded DEBUGsomething like this perhaps ? A $6 module. 1.8-5.5V MCU 96MHz ?https://lcsc.com/product-detail/Development-Boards-Kits_Flashchip-Microelectronics-FCM32F103RBT6_C2972841.htmlOr, you could pick a part that is 5V tolerant. Gigadevice parts look to be mostly 5VT = 5V tolerant ports, tho direct wide Vcc is simpler to manage..Maybe one of these - I'm guessing bootloader included herehttps://www.lcsc.com/product-detail/Development-Boards-Kits_LCSC-boards-LCKFB-LSPI-SkyStar-HC32F4A0PITB-LITE_C22440612.htmlhttps://www.lcsc.com/product-detail/Development-Boards-Kits_LCSC-boards-LCKFB-LSPI-SkyStar-GD32F407VET6-LITE_C20607214.htmlAddit : I see the 288MHz Artery AT32F435/437 M4's claim 5V tolerant on most pins, but that's getting serious over-kill for a programmer.https://lcsc.com/product-detail/Development-Boards-Kits_ARTERY-AT-START-F437_C3294497.htmldown tohttps://www.aliexpress.com/item/1005007826615642.html

author: dmsc
author_rank: Newbie
timestamp: June 25, 2025, 12:02:53 am
content: Hi!So, you need a 5V MCU with USB..... a lot of options are available.If you want fast and cheap, perhaps some RISC-V MCU from WCH, like the CH32X033F8P6, 10 chips for USD 2.6:https://www.aliexpress.com/item/1005006109106046.htmlOr, if you need more pins and 80MHz, the CH32V103C8T6, 10 chips for USD 4.35:https://www.aliexpress.com/item/1005006693737444.htmlOr, if you want ARM instead of RISC-V, WCH also has the CH32F103C8T6, 5 chips for USD 4.6:https://www.aliexpress.com/item/1005006700457342.htmlThe RISC-V chips have USB bootloaders, so flashing a new firmware is very easy.Have Fun!

author: brucehoult
author_rank: Super Contributor
timestamp: June 25, 2025, 12:17:42 am
content: Quote from: paulca on June 24, 2025, 05:28:25 pmNo, that's not true.Original CH32V003 is 2.7V - 5.5V and newer 00x chips are 2.0-5.5. The CH32V103 (which has USB) and CH570D (which has USB and 2.4 GHz radio) also run on 3.3 or 5V. The higher-end 200 and 300 series are 2.5 or 3.3 only, but there's a lot more power in the low end series than in an AVR! 32 bit RISC with at least 48 MHz, 80 MHz for the 203, and 96 MHz for the 570.

author: Psi
author_rank: Super Contributor
timestamp: June 25, 2025, 12:48:23 am
content: Quote from: neil555 on June 24, 2025, 07:36:03 pmSome STM32F0's seem to run at 5V. Not saying it's a good idea, or that the will be in-spec, or that all peripherals will work correctly. But I've seen some STM32F042's run off 5V without issues. At least not obvious issues.My theory is that they were originally going to support 5V at some point in the core design stage but for whatever reason decided not to. But that's just a theory.https://www.eevblog.com/forum/chat/stm32f0-on-5v-instead-of-3-3v-im-surprised-it-actually-works-expected-smoke/

author: woofy
author_rank: Frequent Contributor
timestamp: June 25, 2025, 08:03:41 am
content: I had the same dilemma with my Z80 project, My solution was to just use RAM on the Z80, run it a 3.3v and connect an FPGA to the bus.A modern 20MHz Z80 runs well at 3.3v/10MHz so no interface issues. The memory is a 128kx8 static RAM, 32k at the bottom, 16k banked then 16k OS space at the top, controlled by the FPGA. The FPGA bit stream SPI flash is much larger than needed for the FPGA so also contains the OS, making it fast and easy to update the code.On boot the FPGA maps 256 bytes of its internal RAM to the Z80 which holds the boot loader. The Z80 can then access the SPI via the FPGA and load its OS.It then jumps to the OS and restores RAM to the bottom 256 bytes.So the FPGA handles all decoding and RAM banking, but also has plenty of resources for peripherals such as the VGA output to a monitor.Maybe this gives you some more ideas.

author: paulca
author_rank: Super Contributor
timestamp: June 25, 2025, 09:23:27 am
content: Interesting. You seem well further ahead than I. I am trying to make small steps and take my time, but at the same time I am avoiding "easy options" which will just need redone later as "inflexible."A project like this is full of such things. I repeatedly ignore people's short cuts and hacks and go the long way to do it "right" as far as I can tell.Running the whole board on 3.3V ... It is a 20Mhz class Z80 and it will run on 3.3V. Actually don't tell anyone, but I found it that it also runs on -2.5-2.5v 1kHz clock input. The second time I set it up on the breadboard I forgot to connect VCC to the board and connected the clock... which I had also forgot to offset to DC 0-5V. So I send it +-2.5V at 1kHz and it booted and ran.However. I am using "period" 74HC gates. They get very, very slow down below 4V or so. By 2.8V they are taking nearly a micro-second for rise time.If I can get everything running together, the Z80 core + MCU debugger/programmer, it opens many "Era fusion" style opportunities. For example, the MCU can alsosimulatebe an IO device. The Z80 writes to that device the MCU sends it over USB. The Z80 just got USB support. Add a 5" TFT to the MCU and Z80 just got a video card. So many options.I can see many, many routes.1. Don't bother with "in circuit" programming with the ROM, you have 32K of SRAM, use it, write a "serial loader" and keep the rom mostly static, do most things in RAM.... like it would in the era. Serial programming is only 2 wires to shift.2. Put a 3v3, 5v switch on the board. When I want to flash ROM, slow the clock, drop to 3.3V and work away. When done turn it back up again.3. Find and learn a new 5V MCU. The CHxx STM-like MCUs, the thing that scares me about those is, well STM32 is hell enough and their documentation is GOOD!4. Partial asymmetric level shifting/transceiving to get to just in-circuit programmer only.5. Full bus mastering with dual supply shifters across the board.While I am drawn towards 5, I may regret it later. Played with the schematic last night. The control lines are awkward. Lots of combinations of Input and Output when I only have (with the 74LVC16T245) 2 8 bit banks each to switch direction. Creates quite the little matrix and truth table to go through. The immediately requirement is an example. I need to pull BUSRQ low, hold it low and wait for BUSACK to go low. So immediately I need at least one Input and one output bank. 2 whole banks are address bus, so.... there is nowhere left for the data bus in I or O. Thus it is now growing to 3x 74LVC16T245 to make the combinations easy and not have to mutliplex control lines.I am trying to fit all this including full sized DIP chips into 100mmx100mmAnd yes. Folding it all up into an FPGA is on my radar, but I feel that would overload my concurrent learning abilities. I have been using it for hardware simulation and virtual breadboarding gates etc. It's not synthesizable though. Spend a few hours trying and couldn't even get a soft core Z80 running on an ICE40. It was also far too slow for ROM software dev. Even initialising a 256 entry vector table took 15 minutes in sim mode.I just accelerated the PCB test harness design and sent it for print as fast as possible. The hand soldered protoboard went the same way. It's sitting 60% complete, I just got bored with it the more fiddly it becomes the shorter my paitence for it becomes.

author: woofy
author_rank: Frequent Contributor
timestamp: June 25, 2025, 01:10:21 pm
content: Paul, if you're anywhere near Cambridge, there is the "Bring 'n' Byte Sale" on Sunday at the Centre for Computing History.

author: paulca
author_rank: Super Contributor
timestamp: June 25, 2025, 03:01:43 pm
content: God this gets weird fast.Those transceivers have 4 control pins each. I was going to need a bigger boat (bigger package) but ... the MCU is 2000s tech, it can run serial faster than the Z80 can do parallel. So shift registers.But shift registers need 4 pins! ... or do they?So now I gotta find out if this works as I expect it will. An auto latch and clear 8 bit shift register. 2 pins. I think. Looks awfully familiar to me.... looking at UART. Maybe I will learn why the stop bit has polarity and isn't just discarded.

author: paulca
author_rank: Super Contributor
timestamp: June 26, 2025, 09:11:17 am
content: Quote from: brucehoult on June 24, 2025, 02:47:23 pmYours was the first answer and after going around and around the houses I came back to it.I found two very important letters in the STM32F411 datasheet."FT".Nearly all of the pins are "FT", "Five volt tolerant".As long as I use those pins I don't need any level shifting at all. I even believe (seen while looking for something else), they even state CMOS and TTL compatibilty for 3.3 and 5.0V.I do still need 2 power rails and keep them apart, but that's a lot simpler than keeping 38 digital lines apart.For an MCU pin to be 5V "tolerant", isn't that just putting some form of damage limitation resistor on the clamp diodes? So it can safely sink the extra couple of volts to ground without burning anything out?

author: Psi
author_rank: Super Contributor
timestamp: June 26, 2025, 09:16:09 am
content: Yes, FT pins can handle 5V input without damage. With a few conditions.I suspect they have a zener doing the clamping to VCC, but have not actually looked into it.The FT pins are really just tolerant up to a fixed voltage above VCC. Not tolerate of 5V in all case. Eg if you short VCC to 0V I don't think you can put 5V into FT pins without causing damage. It's limited to something like ~3.3V above VCC.They are usually not FT when put into output mode too. Since output high is shorting the pin to VCC. Not that that's usually a problem, but something to be aware of.

author: brucehoult
author_rank: Super Contributor
timestamp: June 26, 2025, 09:28:06 am
content: Quote from: paulca on June 26, 2025, 09:11:17 amIf you actually need 100 32-bit MHz, an FPU, 128k RAM then that might indeed be your best option.But you were talking about AVRs as filling the need.QuoteYou have been pointed at a number of 32 bit MCUs running at 48-96 MHz (but no FPU and less than 128k RAM) that really truly no ifs and buts run on 5V.

author: woofy
author_rank: Frequent Contributor
timestamp: June 26, 2025, 10:26:26 am
content: Quote from: paulca on June 26, 2025, 09:11:17 amNo, 5v tolerant pins don't work like that.It's also a bad idea for non-tolerant pins. I would never allow the protection diodes to be forward biased like that. It can cause a latchup condition in the input structure which will not clear with a reset, only a power cycle. It will also really mess up any analogue functions on the chip (on PIC's at least).Pins which are 5v tolerant will most likely have something like an avalanche FET clamp which behaves like a zener diode clamping at around 6.3v.

author: paulca
author_rank: Super Contributor
timestamp: June 26, 2025, 10:35:14 am
content: Quote from: brucehoult on June 26, 2025, 09:28:06 amPossibly my mental process or lack of, but I demote options based not just on their technical merit, but on their "distance" from where I am now, if that makes sense.A new MCU platform like the CH32 series is quite far away. So it gets demoted. Not ignored, maybe just for another time place and project.I am familiar with the F411 in particular. I have had success with it. I have had success with many flavours of AVR with or without Arduino. Even going to an H750 or H743 is a completely different theme park let alone ride. Everything is at least one layer more complex. Going the other way down to the F1xx and F0xx, well, then I feel "home sick" for features and end up going, "Wait, what? That isn't available, damn." and upgrading to an F411 anyway.An medium package F411 bought in 1s and 2s is like $7. The big AVR is twice that, when you can find them! It would price my "Z80 retro board" computer right out of the market but I'm not selling it. So that's fine. If I added up all the R&D time, components, tooling this stupidly useless little device has cost me 100s of dollars already and I expect it will cost that again before I finally get bored of it. It's better than spending a few evenings in the pub and spending that.So options which include things I am already familiar with get promoted. I think I even have a bare metal F411 in a little box somewhere if I can find it.

author: paulca
author_rank: Super Contributor
timestamp: June 26, 2025, 10:41:48 am
content: Quote from: woofy on June 26, 2025, 10:26:26 amAnalog capable pins where mentions in the "top" of the datasheet. I haven't delved into the pin schematic section, though I suppose I have to.There's a question. When faced with running umpteen IO lines, say a bus, from an MCU do you:a) Pick large blocks of IO logically. ie. put the entire 16bit address bus on a single 16bit GPIO port. Then you can literally just use a C assign with a 16bit int (in most mcus).b) Look at the package and the PCB routing and put all 16 IO lines down the same side or same corner? Then in the code you use a bit->port:pin mapping function?To date I have tended towards "a" and then hated myself later when I come to routing the PCB. However, if you do get it neat and working, it somehow feels justified when you come to write the code.

author: Siwastaja
author_rank: Super Contributor
timestamp: June 26, 2025, 06:37:15 pm
content: Quote from: paulca on June 26, 2025, 09:11:17 amThat would be a ghetto level "5V tolerant", and there's no point because you can do that externally on any non-5V-tolerant pin anyway - just add enough series resistance to prevent killing the clamp diodes - andalso rememberto shunt regulate the Vdd to maximum rating (e.g. 3.6V) unless you can prove that your load on Vdd always (under all conditions, including start-up and sleep mode) exceeds the current injected through the IO pins - otherwise your Vcc rail voltage just starts rising.No, 5V tolerant pins are better - they behave like normal CMOS inputs (extremely high input impedance, not sinking current) up to the maximum rated voltage. On internal construction, that means the input stage itself can handle that voltage, but also a different type of ESD protection - something resembling of a TVS (maybe a shared one, with per-pin diodes leading to it) which starts conducting significantly above 5V.This allows you to also use them as open-drain outputs for 5V. Just pull up to 5V with external resistor, and the low-side switch will happily pull that to ground when turned on in "open-drain" mode. If open-drain is good enough for your purposes (slower rise time, more power consumption during '0'), then you can interface with 5V parts in both directions with these FT pins.

author: uer166
author_rank: Super Contributor
timestamp: June 26, 2025, 06:58:15 pm
content: Quote from: Siwastaja on June 26, 2025, 06:37:15 pmFT pins are nice, but watch out for gotchas as attached. For all FT pins other than FT_c, you can only apply 4V above the power rail. That means that if your MCU is off, and a external circuit is applying 5V to the pins, you're exceeding the rating. I had this dilemma for a 4.2V power-on switch with pullup that would exceed the rating by a small amount.The same is true for 3.3V inputs to a regular pin, but with more than one power domain (such as 3.3 AND 5V), crossing issues are morel likely.