Adding a battery monitor to a custom N64 flashcart

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
mightydidz
Posts: 61
Joined: Wed Jan 24, 2018 12:04 pm

Adding a battery monitor to a custom N64 flashcart

Post by mightydidz » Wed Jan 06, 2021 5:37 pm

I have a custom N64 flashcart I've been working on it for quite some time.
Its using discrete logic using 74'163 counters and 74'573 latch.
Board is equipped with parallel Flash ROM and SRAM.

It is working fine, but on rare occasion I'm loosing SRAM data, even if battery voltage is good.
At first I was using NPN transistor for SRAM!CE using !RESET as base.
BAT54C was used for VCC on SRAM
10K pullup resistor on SRAM to make sure its in standby mode when console is OFF.
off course 0,1uf decoupling capacitor where there.

I had better result with a high speed switching diode (1SS319) instead of BAT54C, but once in a while SRAM data are lost.
still good voltage on SRAM.

I wanted to try with a battery monitor instead of diode+transistor.
Original hardware had a 74LV2416 but I cannot find datasheet since its obsolete.
I wanted to try with a BA6129 but since I'm using parallel SRAM I'm a bit confused on how to connect it.

/CS currently comes from NAND (A27 & !A28)
/RD & /WR are connected directly on N64 bus.

I want to keep design simple since there is limited space available on the pcb.
I was thinking using a single 1of2 decoder (74LVC1G19) with BA6129 using Y1 output.
!E would come from NAND (A27 & !A28) and A would be BA6129 !CS

Or maybe you guys have another simple idea or suggestion. (can I only use the monitor to control SRAM!CE?)
At the moment, I suspect when power is cut off, supply voltage for all chips falls slowly and at some point CPU might start executing garbage opcodes, potentially overwriting RAM cells.

User avatar
aquasnake
Posts: 191
Joined: Fri Sep 13, 2019 11:22 pm

Re: Adding a battery monitor to a custom N64 flashcart

Post by aquasnake » Tue Jan 12, 2021 12:25 am

Due to the large capacitor at the output of the regulator, when the input is powered down, the voltage will not drop to 0 immediately. A Schottky diode is connected between the output and input of the regulator to achieve fast turn off. At the same time, it also protects the mosfet inside the regulator from reverse breakdown.

If the output capacitance is relatively large, it is suggested that the diode and a resistor should be connected in series to avoid excessive impulse current at the moment of shutdown.

Related discussions can also be found in this thread:
http://forums.nesdev.com/viewtopic.php?f=9&t=21243

User avatar
aquasnake
Posts: 191
Joined: Fri Sep 13, 2019 11:22 pm

Re: Adding a battery monitor to a custom N64 flashcart

Post by aquasnake » Tue Jan 12, 2021 1:00 am

Simply reducing the filter capacitor may not work on some carts, such as the FPGA based flashcart, which usually consumes more power. For the N64 cart, if the system is directly connected to 3.3V, the total capacitance on the system path may be the factor that the voltage cannot be released quickly. Then a PMOS should be connected in series on the 3.3V power supply line, and the voltage monitor should control the grid. This may lead to the problem you raised.

Therefore, low power consumption and reducing the total capacitance of VCC path is the best design principle. From this point, the more complex the design, the less reliable.

mightydidz
Posts: 61
Joined: Wed Jan 24, 2018 12:04 pm

Re: Adding a battery monitor to a custom N64 flashcart

Post by mightydidz » Tue Jan 12, 2021 9:57 am

thanks for the reply, its really instructive.

My board isn't using FPGA. Its a discrete logic board.

Its using 4x 74'163 and 2x 74'573 and some other gates (nand, and3, not).
So it may be a high capacitance circuit with all those IC onboard.

I also betting on power down issue. That's why I want to add extra protection with a battery monitor/backup IC.
This way, as soon as the monitor detects a voltage drop when power-down occurs, it disables the SRAM and protects its cell from CPU writing garbage code with residual current.

At first I was thinking about BA6162 or BA6129 but those chips are for 5v circuits with threshold at 4.2v and 3.5v.
They dont suit my application since N64 is 3.3v.

I'm looking for a cheap PMIC with power supply switch (battery backup) and a CS output for 3.3v circuits.
Ideally SOIC8, but anything SMD and small would be OK for me.

Anyone have suggestions? What voltage threshold I should aim at?

User avatar
aquasnake
Posts: 191
Joined: Fri Sep 13, 2019 11:22 pm

Re: Adding a battery monitor to a custom N64 flashcart

Post by aquasnake » Wed Jan 13, 2021 2:17 am

for nes:
wram_write_access = m2 & ~cpu_rw & rom_sel & cpu_addr_in[14] & cpu_addr_in13] & wram_enabled;

when powered off:
These signals are Hi-Z. If 74LS is used, each input pin has a pull-up resistor and will not be gated.
If you use 74hc, if the input does not add pull resistors, there will be a problem.

wram_enabled is used by the mapper chip to protect the wram from being written incorrectly. However, only a few ASIC chips have this register, and in some cases, it is always valid without writing this flag. Using this flag can ensure that the program can protect the wram immediately after the end of the wram access process.

mightydidz
Posts: 61
Joined: Wed Jan 24, 2018 12:04 pm

Re: Adding a battery monitor to a custom N64 flashcart

Post by mightydidz » Wed Jan 13, 2021 9:50 am

thanks for the reply, really instructive. Will definitely helps with my NES board conception.

But my application is for N64. I was thinking using TI TPS3619-33 for PMIC.

What do you think of it?

Any other suggestions of PMIC cheap and compact?

Post Reply