Replacing SRAM IC with Flash - Page 1
Forum section: electronics / beginners

author: VEGETA
author_rank: Super Contributor
timestamp: April 24, 2024, 07:30:21 am
content: Hello,Can I replace an SRAM IC with Flash one and still get the system to work as intended?The project is for N64 memory pak which has original SRAM IC inside (LH52256) and it can be replaced easily to FRAM chips like FM18W08-SG and FM28V020-SG but these are very expensive.I have a project in mind to have multiple Flash ICs to be switched in order to have lots of memory space instead of just one memory chip like original, but I read that flash cannot be used instead of ram chips. however, flash chips are very cheap compared to fram ones.an mram\fram solution already exists which is not cheap and still has only one memory ic which means same capacity as original, just without battery and will retain save. I want to make multiple memory banks in one pak but in a cheaper way.what do you think about this?

author: BennoG
author_rank: Frequent Contributor
timestamp: April 24, 2024, 08:06:08 am
content: No you can not do this, flash is slower than normal Sram.However you mention is not flash it is ferroelectric and according to the specs comparable with your SRAM.I don't know enough of this type of storage to give you any valid adviceBenno

author: Retep
author_rank: Regular Contributor
timestamp: April 24, 2024, 09:28:22 am
content: The main reason this won't work is that the way to write data to flash is very different from writing data to SRAM (or MRAM/FRAM for that matter). Where with with SRAM one can write a single byte by putting the address on the address bus and the data on the data bus and asserting the Write pin, with flash on needs to erase a sector and rewrite the entire sector. Also a flash sector can only be written a limited number of times. I.e. it would require significant changes to the software.

author: SeanB
author_rank: Super Contributor
timestamp: April 24, 2024, 09:48:09 am
content: Use a larger FRAM device, like FM28V100, though you will need to make a small interface board to interface the 32pin SMD to DIP28. This gives you the option to add in 2 jumpers, allowing you to have 4 images in the FRAM, each totally separate.

author: VEGETA
author_rank: Super Contributor
timestamp: April 24, 2024, 04:43:37 pm
content: Quote from: SeanB on April 24, 2024, 09:48:09 ami am limited with the n64 itself, its memory is 32kx8 arrangement. i don't know if it can accept larger ones.it also requires parallel interface... too bad since spi and other interfaces are very cheap!do you know any solution i can use to maneuver this? like using a 1 mbit ic but still let it act as 4 separate 256k (32kx8) ic... or create an interface to convert the parallel ram to spi ram and vise versa.Quoteoriginal is sram and existing solution is fram... but i ask if same size flash can be used.upon checking again i only found this one:https://www.digikey.com/en/products/detail/rochester-electronics-llc/N28F256A150/12129264the rest are otp eeproms and uv eeproms.... then comes the fram ones. fram\mram are very expensive.this one is normal eeprom:https://www.digikey.com/en/products/detail/rochester-electronics-llc/TMS27PC256-17FML/12135079it is marketplace but still very cheap.

author: xvr
author_rank: Frequent Contributor
timestamp: April 24, 2024, 05:38:32 pm
content: 28F256 is a ancient FLASH. It's required 12V to write and very sophisticated write sequence (even with comparing to modern FLASH). So it is a very very far from SRAM.27PC256 is OTP ROM - One Time Programmable ROM. Effectively this is EPROM for UV (Ultra Violet) erasure, but without UV window. Much more from SRAM than previous.

author: VEGETA
author_rank: Super Contributor
timestamp: April 24, 2024, 06:17:46 pm
content: Quote from: xvr on April 24, 2024, 05:38:32 pmyeah i figured that out too.i prefer if there is a way to use bigger fram chips and make them behave the same as mentioned sram. meaning, to switch between banks for more capacity but still work fine with the console.

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 25, 2024, 12:48:28 am
content: How about using 512k×8 low-power SRAM like CY62148ESL-55ZAXI, and controlling the four highest address bits (A15, A16, A17, A18) with a 16-position absolute encoder and four pull-up resistors? With a pull-up on /CE, the stand-by current draw is just 2.5µA typical, max. 7µA, and voltage can be 2.2V–3.6V or 4.5V–5.5V. That is, you can use 2.2V – 3.6V battery backup voltage. Since LH52256C/CH uses 5V logic, the battery vs. normal operation voltage selection should be easy (higher voltage wins).You'd get sixteen banks in a single pak, selectable using an absolute rotary encoder.

author: amyk
author_rank: Super Contributor
timestamp: April 25, 2024, 03:44:27 am
content: There's been various topics on here before about replacing the Dallas NVRAMs with FRAM, is that where you got the idea?

author: VEGETA
author_rank: Super Contributor
timestamp: April 25, 2024, 02:39:50 pm
content: Quote from: Nominal Animal on April 25, 2024, 12:48:28 ami didn't understand your solution.originally i thought of having 4-5 SRAM IC compatible with original one, then put pull up on all CE pins... then use a slide switch to hook desired ic to console dedicated CE pin for activating it.Quoteno, i got the idea from seeing the n64 community

author: mariush
author_rank: Super Contributor
timestamp: April 25, 2024, 03:41:44 pm
content: He means using a larger parallel sram ic ... your original LH52256C has 15 address pins, from A0 to A14 ... simply replace it with a chip that has more address pins and by setting the high pins to different values, the read and write locations are offset by various amounts (multiples of 32k)You could also use a 16 bit / 18 bit wide chip, and simply switch the 8 data outputs between the first 8 bits or the last 8 bits.For examplehttps://www.digikey.com/en/products/detail/infineon-technologies/CY7C1021DV33-10ZSXIT/1644438- 64 K x 16 ... you have 4 x 32 K x 8 ... set the A15 pin to 0, and you read the first half of the chip, set to 1 and you read the other half ... switch between first 8 data and next 8 data to get half of the first half etc etcHow hard would be to put some analogue switches on the address and the command traces, to switch between the nes and a microcontroller of yours? your micro could set the analogue switches to redirect the chip to the micro and micro could read contents and dump (as backup) to a spi flash, and change the contents with some other data you want read from the same spi flash.If the disconnect is not possible, I imagine you could simply have a couple parallel 32k SRAM chips, and some analogue muxers/switches to switch the address and data lines between the two chips.... you can then access the unused chip and load up contents in it.

author: VEGETA
author_rank: Super Contributor
timestamp: April 25, 2024, 07:43:09 pm
content: for this IC he recommends:https://www.lcsc.com/product-detail/SRAM_Cypress-Semicon_C466893.htmlI use address 0 to 14 all the time but for a15 16 17 18 would be either 0 or 1... which gives different total address each time? 4 pins (15 to 18) would mean 4x4 = 16 banks, and the output is already 8 bits which means directly compatible.so for example, setting all these pins to 0 would give me an address, let's call it memory card 1. setting a15 to 1 and others to 0 would give me another address called memory card 2...etc?would the target device see it as it should be? a 32kx8 single pak for each address configuration?i prefer doing a solution were no MCU or programming used. a simple switch is all needed but for this i would need 16 different output values... what type of affordable switch can this be?? crazy idea but i think a dip switch can work... won't be elegant thocheapest rotary encoder i found is this:https://www.digikey.com/en/products/detail/panasonic-electronic-components/EVQ-V9C00116E/1738883still expensive and won't fit inside i guess

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 25, 2024, 08:48:43 pm
content: Quote from: Nominal Animal on April 25, 2024, 12:48:28 amActually, this is "better" than this. As usual with SRAM, the min. data retention voltage is much lower than its operating voltage range and the current is also much lower in practice.The datasheet states 1.5V min for data retention. So yes, a typical CR2032 lithium battery would last a very long time and you'll get more out of it than the typical 200mAh which is given for a cutoff voltage way above 1.5V.Add a largish cap in parallel with it, and you'll also have ample time to replace the battery when it's completely discharged, without losing any data.

author: xvr
author_rank: Frequent Contributor
timestamp: April 25, 2024, 09:00:07 pm
content: Do not forget to add series diode to battery - lithium battery do not like when someone trying to charge it. They could blow up.

author: mariush
author_rank: Super Contributor
timestamp: April 25, 2024, 09:19:58 pm
content: at the most basic, four two position slide switches would work. But would bad user experience.You could use two buttons and a up/down counter logic chip like cd4510 or cd4029 or others. Some of these counters can be configured to output binary or bcd, or decimal ... in theory you can find bcd to decimal logic chips or possibly even some seven segment led driver that accepts bcd input to show hexadecimal on a single seven-segment digitBut honestly a microcontroller would make sense as it could debounce a couple buttons (up down reset) and could also display the actual selected block on a two digit lcd screen or a couple seven segment digits or eink. ... example of raw lcd :https://www.digikey.com/en/products/detail/lumex-opto-components-inc/LCD-S2X1C50TR/469771example of microcontroller with built in lcd driver :https://www.digikey.com/en/products/detail/microchip-technology/PIC16F19155-I-SS/7801934with seven segment digits you could have the digits shown only for a few seconds after change, and then turn off digits if its an issue of power consumption. with some tiny red seven segment digits you could have 1mA per segmentThe ram chip you mention is 10$ on lcsc, but you can get similar from digikey for under 2$, for examplehttps://www.digikey.com/en/products/detail/infineon-technologies/CY62148G-45SXI/5247544... another example, 2.4$ if you get 10 :https://www.digikey.com/en/products/detail/issi-integrated-silicon-solution-inc/IS61WV5128EDBLL-10TLI/2799145this one's also on lcschttps://www.lcsc.com/search?q=IS61WV5128EDBLLIf you hurry you could get 16 mbit sram chips for under 4$ each ...https://www.digikey.com/en/products/detail/infineon-technologies/CY62167GN-45ZXI/7362593- these have up to 21 address pins (can be configured as 2M x 8 / 21 address pins or 1M x 16 / 20 address pins)

author: VEGETA
author_rank: Super Contributor
timestamp: April 25, 2024, 09:28:44 pm
content: first, is my understanding above correct?but something i was wondering about, if i control a15 to 18 this would make it a 16 bit address while original is just 15. how does this affect the operation?as for handling battery and charging... i can do it but i am now worried about the main function.i could use something like this:https://www.instructables.com/74HC393-Binary-Counter/to control the 4 address bits.i prefer using just one push button to cycle through all banks, i assume this one will be connected to "clock" input of the binary counter right?if i want to show the currently selected bank, i think using a binary to decimal decoder or so can work... either drive an LED (would need 16 LEDs) or as you said segment displays

author: mariush
author_rank: Super Contributor
timestamp: April 25, 2024, 10:05:11 pm
content: The SRAM chip takes the address value from the address pins and reads data from or puts data into the data pins.the console only manipulates those A0 to A14 signals, so you can manipulate the other address bits.If A15 is 0, the chip will serve byte range 0 to 32767If A15 is 1, the chip will serve byte range 32768 + 0 to 32767basically formula is 32768 x A15 + [ A14 ... A0 = 0..32767]If you have bigger chips .. byte read/written = 524,288 x A19 + 262,144 x A18 + 131,072 x A17 + 65,536 x A16 + 32,768 x A15 + [ A14 ... A0 = 0..32,767] or basically 219x A19 + 218x A18 + ....

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 25, 2024, 10:11:09 pm
content: Mouser sells the CY62148ESL-55ZAXI SRAM chips for5.74€ or 7.28€ apiece in singles. Mouser component search is better than LCSC's, and I started withthis search, picking the low power (LP) ones. You can find many of them at LCSC, I just didn't bother.Quote from: VEGETA on April 25, 2024, 07:43:09 pmYes. Specifically, you'd put a pull-up resistor from each of the A15, A16, A17, A18 pins to 5V, maybe as high as 1MΩ each? And also connect them to the four wiper pins of a 16-position absolute encoder likeBourns PAC18R1-33D28F, and the fifth pin to GND.This way, the other pins of the SRAM chip work exactly like LH52256, but the rotary encoder selects which one of the 16 "banks" the N16 sees.In reality, each "bank" is just a different 32k range within the 512k range the SRAM supports.Another possibility would be to use a small microcontroller, for example a dirt cheapATTiny404(that you can program with an UPDI programmer using your freestanding C/C++ code developed in the PlatformIO environment), powered from the 5V supply line, with four of the microcontroller pins connected to the SRAM A15, A16, A17, A18 pins.Quote from: VEGETA on April 25, 2024, 07:43:09 pmYes, exactly.The "trick" is that an absolute rotary encoder would let you do that directly, just by rotating the knob.Quote from: VEGETA on April 25, 2024, 07:43:09 pmYes.The other option would be to use a microcontroller with at least 4 output pins and 1 input pin. The output pins would be connected to the A15..A18 pins on the SRAM, but also to gates of four N-channel MOSFETS (like BSS138, NX138AKR, etc.). Each MOSFET source is to ground, and drain is connected to the cathode of a LED. Each LED anode is connected to a suitable current-limiting resistor, say 1kΩ, and that to the 5V. The input pin is connected to a tiny tactile button, the other side of the button connected to ground (or 5V). The internal pull-up (or pull-down) is enabled for that pin.The microcontroller would be programmed to switch to the next bank when the button is pressed, rotating through the 16 banks. The four LEDs would show the currently selected bank as a binary pattern. (You might wish to add a fifth LED and a resistor between 5V and ground, so that it lights up whenever the pak has power.)If you use a binary counter like 74HC393 instead of a microcontroller, make sure you have a low-pass (debouncing) filter on the button connected to the clock input. Otherwise a single press may jump multiple banks.As to the battery, I haven't thought about exactly what kind of circuit is needed. A simple (Schottky) diode would protect the battery from being backfed by 5V whenever it is connected and powered on; but something like a MOSFET that would disconnect the 5V line when no 5V power is present, and disconnect the battery when 5V is present, would reduce the load on the battery through the pull-up/pull-down resistors, and ensure the battery would not try to power the microcontroller/counter if one is used.Quote from: VEGETA on April 25, 2024, 07:43:09 pmExpensive? I count less than 10€ in parts, either way. If you or a friend has a 3D printer, you could print a custom enclosure, too.

author: VEGETA
author_rank: Super Contributor
timestamp: April 25, 2024, 11:24:37 pm
content: Quotei thought of pulldown the 4 pins to have initial address bank of 0, please check attached initial rough drawing for the whole suggested system.also instead of encoder I tried counter IC idea with one push button, gonna be a lot cheaper and smaller.Quotegoing MCU is a no-go for me since i won't be getting the production boards here to my country (Jordan) due to excessive customs charging and the complicated stuff I need to do. All my other products which are being sold now come from PCBway directly to my shipment and fulfillment company (Next Smart Ship) which is linked to my store... then I ship with press of a button.having MCU will need PCBway to program them which is something i never tried and will for sure get some problems.I also thought of using pi pico MCU and put the complied code on my website for the end user to download and program himself using his own computer. will work but prefer without MCU if possible.Quotea 1nF ceramic would do i guess. could go up to 100nF if needed.QuoteI would need to open the OEM memory card and check voltages and continuity...etc to have an idea what is there.I made this:https://thundertronics.net/product/dreamcast-advanced-controller-board/which is more complicated and I maneuvered around it by using 5v rail as input then bypassed entire old battery to have it to work, and it did.designing a simple rechargeable solution which uses small LIR2032 battery should be no problem.having a parallel fram\mram non-volatile 512kx8 would be around 30$ for the ic, it is a no go!Quotebest price to sell these would be 50$, not too little and not greedy.I guess if counter ic + button works instead of 3$ encoder then this would reduce the cost nicely. pcb gonna cost too... but as you said i will go with 3d printing + shiny laminated label on top which is going to be good enough.how much bom cost do you expect after this?

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 26, 2024, 02:05:13 am
content: I noticed LCSC and JLCPCB do not have many parallel SRAM IC's in stock; currently only 7 different models, of which only two are suitable, and cost 30€+. Ouch.Quote from: VEGETA on April 25, 2024, 11:24:37 pmSure.Quote from: VEGETA on April 25, 2024, 11:24:37 pmDisplaying the bank number in anything except binary is a bit of a chore. CD4511 and similar can do 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 using 7 LEDs (7-segment display) based on the four address lines, but would be blank for the last five. Decoders like 74'138D can decode three address lines into 8 LEDs, so you'd need two of those, and one logic inverter (for the extra bit, a single MOSFET will do).Hmmm....The access time of the Sharp LH52256C/CH is 70ns, which corresponds to slightly over 9 clock cycles at 133 MHz. It seems to me you might be able to use an RP2040 (C2040 at LCSC, about 1€ at LCSC and JLCPCB) to emulate parallel SRAM using PIO via (15+8+3) 26 I/O pins, two pins for I2C (128×32 OLED display), and two pins for buttons – perhaps an I2C slave, shift register, or something. See various "PicoRAM" projects.The 26 I/O pins do need (unidirectional) level shifting between 5V (N64) and 3.3V (RP2040) – perhaps four 74LVC4245APW,118 (C6091 at LCSC).RP2040 uses an external QSPI Flash chip, up to 16 MBytes (Winbond W25Q128JVS is used in examples, C97521 at LCSC; minimum 100,000 erase cycles); some of this would be reserved for code and bootloader, but we're talking a three to five hundred "banks", easy. And since it has an USB connection, you could transfer the saved states to/from a computer, each 32k long and corresponding to a separate Pak.TheHardware Design with RP2040includes a minimal example. The power section would differ in that you'd use two diodes or a dual common-cathode diode in front of the 3.3V regulator, to select between USB and N64 5V sources. (Some '1117 series regulators fail short circuit, so I'd suggest carefully selecting which one to use.) The level translators would be powered from the N64 5V. You also need a 12 MHz crystal (Abracon ABM8-272-T3, C20625731 at LCSC). The USB D+ and D- lines need 27.4Ω resistors in series, between RP2040 and the USB connector. So, in addition to the minimal example schematic (page 25), we'd need the voltage translators, I2C pull-up resistors (two 2.2kΩ, or at least pads for two 0603 resistors), and say a TI TCA6408A (C181499 at LCSC) or TCA9555PWR (C465732 at LCSC) as an I2C expander, providing 8 or 16 additional I/O pins that you could use for buttons or LEDs.Essentially, the RP2040 would keep a single Pak (32kbytes of RAM) in memory as long as it was powered on, but whenever a button is pressed, copy it to Flash. (Another option would be to use another PIO to observe the /WR pin, to auto-trigger a save a half a second to second after the last write.)Additional buttons would be used to select which Pak is currently active. Since there are so many Paks to choose from, you probably want at least three buttons (next, previous, select), but note that additional modes like "read-only Pak, changes not saved to Flash" and auto-allocating a Pak to a new slot whenever changed, would be easy to implement in software, so at least one more button to select between configuration and Pak is needed. So, say five buttons. A TCA6408A provides eight additional I/O pins, perfect for buttons.Quote from: VEGETA on April 25, 2024, 11:24:37 pmAh, okay.Quote from: VEGETA on April 25, 2024, 11:24:37 pmI'd expect under 10€ in any case, but that assumes you could get the SRAM chip at Mouser prices (~ 6€ or less) somehow.

author: VEGETA
author_rank: Super Contributor
timestamp: April 26, 2024, 02:38:15 am
content: first time i read about picram thing, definitely weird! an mcu acting as a ram! will look into it for sure.however, i wanted it to be as simple as possible... meanwhile i got this suggestion (prices are per 100 finished unit):memory IC: 2.5-3$counter IC (74HC393): 0.3$4:16 IC (74HC154BQ): 0.6$LEDs (16 per unit) example (B1591UY--20C000112U1930): 1.8$ for 1600 pieces = 100 finished unitsaround 5$this is without PCB and enclosure.for enclosure i would go with 3d printing, here is a 3d model for the shell i found:https://grabcad.com/library/nintendo-64-controller-pak-1how much would this cost for smooth black color? can it be 1$ per unit??i read about injection molding but using a 3d printed mold... how realistic would this be to get about 1-2$ total cost per unit.?