{"id":1135,"date":"2016-01-04T01:57:20","date_gmt":"2016-01-04T01:57:20","guid":{"rendered":"http:\/\/www.kernelcrash.com\/blog\/?p=1135"},"modified":"2016-01-04T02:52:16","modified_gmt":"2016-01-04T02:52:16","slug":"using-an-arduino-to-read-write-a-static-ram","status":"publish","type":"post","link":"https:\/\/www.kernelcrash.com\/blog\/using-an-arduino-to-read-write-a-static-ram\/2016\/01\/04\/","title":{"rendered":"Using an Arduino to read\/write a static RAM"},"content":{"rendered":"<p>So I&#8217;ve been busy lately making some homebrew microprocessor systems. When you make a system from scratch you have to figure out how to get it to boot some code. There is no built in flash or ISP mode in these old school microprocessors, so you need to figure out how to get some code and a RESET vector into some kind of ROM. There are lots of different approaches to this problem. I think you end up using what suits you based on the tools\/chips you have available.<\/p>\n<p><!--more-->One approach I&#8217;ve been using lately is to program a battery backed\u00a0 static RAM (one of the Dallas Semi chips. Mine is a 128Kx8 DS1245AB) on a breadboard and transfer it to a target system. I ended up just hacking the Arduino\u00a0 <a href=\"http:\/\/www.ichbinzustaendig.de\/dev\/meeprommer-en\">meeprommer<\/a> code so that it used a 4040 counter instead of the two 74HC595 registers, and instead of needing a dedicated client programmer, I&#8217;ve added in simple XMODEM transfers so that I can use minicom (in linux) to transfer the binary content to the SRAM.<\/p>\n<p>The wiring is pretty straight forward. It should be able to write up to 32K of data (so for me with my 128KB SRAM, I just need to tie the high address lines high or low to load 32K at a time). You should be able to use most of the common old school SRAMs; 6116, 6264, 62256 etc.<\/p>\n<p><a href=\"http:\/\/www.kernelcrash.com\/blog\/wp-content\/Screen-Shot-2016-01-04-at-1.15.53-pm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-1136\" src=\"http:\/\/www.kernelcrash.com\/blog\/wp-content\/Screen-Shot-2016-01-04-at-1.15.53-pm-300x230.png\" alt=\"Screen Shot 2016-01-04 at 1.15.53 pm\" width=\"300\" height=\"230\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.kernelcrash.com\/blog\/wp-content\/IMG_0247.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1142 alignright\" src=\"http:\/\/www.kernelcrash.com\/blog\/wp-content\/IMG_0247-300x224.jpg\" alt=\"IMG_0247\" width=\"300\" height=\"224\" srcset=\"https:\/\/www.kernelcrash.com\/blog\/wp-content\/IMG_0247-300x224.jpg 300w, https:\/\/www.kernelcrash.com\/blog\/wp-content\/IMG_0247.jpg 639w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>The Arduino sketch is <a href=\"\/blog\/wp-content\/meeprommer-4040-0.01.tar.gz\">here<\/a>.<\/p>\n<p>I had a heap of trouble getting the xmodem serial buffering working with the Arduino and to resolve it I just changed the Arduino IDE hardware config to use 256byte serial buffers (instead of 128byte). There are some (older) details on the <a href=\"http:\/\/www.hobbytronics.co.uk\/arduino-serial-buffer-size\">hobbytronics<\/a> site how to do this. I think the details have changed slightly for the newer Arduino IDEs but you should be able to figure it out.<\/p>\n<p>Basically, load the sketch then shut down the Arduino IDE and fire up a serial terminal like minicom. Use 115200 8N1 and hit ENTER a few times. You should get a &#8216;%&#8217; prompt.<\/p>\n<p>Hitting &#8216;v&#8217; should print out some version info.<\/p>\n<p>You can read from the attached SRAM with r XXXX YYYY where XXXX is the start hex address into the SRAM and YYYY is how many bytes to show on screen. eg<\/p>\n<pre>% r 0000 0080\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n0x0000 : C0 00 00 2F 00 C2 80 80 00 FA C0 00 40 00 E5 C1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n0x0010 : 80 28 00 E5 C3 90 08 00 0E C3 00 40 00 F0 D7 00\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\r\n0x0020 : 0C 00 08 D7 20 08 00 FF 00 F0 0D 20 47 B9 20 34\r\n...\r\n0x0070 : 20 A3 B7 A9 20 A2 C3 20 1F FE 4C 5C B2 A5 3B F0<\/pre>\n<p>&nbsp;<\/p>\n<p>The main other command is w XXXX which will write to the SRAM at hex offset XXXX using an XMODEM transfer. For me using minicom, this is something like<\/p>\n<pre>% w 0000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\r\nPlease start an xmodem transfer in your terminal ...\r\nC<\/pre>\n<p>Then ctrl-a s , choose XMODEM and then choose a file to transfer and it should chug away for a little bit transferring some data. I think it should be good for &#8216;up to 32K transfers&#8217;. You can double check everything transferred by using the &#8216;r&#8217; command again to read the SRAM.<\/p>\n<p>Once you have it programmed, I\u00a0 just power it down, pop out the battery backed SRAM and transfer it to the target system. If you don&#8217;t have a battery backed SRAM, you can solder some pullup resistors (eg 4k7&#8217;s) directly to your SRAM and some long wires to GND and +5 on the SRAM. I use two pullups. One from WE* to +5, and another from CE* to +5. Then have a long wire from GND on the SRAM to GND on your target system (making sure that the GND of your target system and your arduino are tied together), then the other long wire is from the SRAM +5 to +5 in your target system. Make sure the +5 of your Arduino and the +5 of your target system are NOT connected together (also, the +5 Vcc pin of your SRAM should only go to one +5V source). You will have wires dangling all over the place and you will need to be very careful you don&#8217;t short anything when levering the chip out, but it does the job.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I&#8217;ve been busy lately making some homebrew microprocessor systems. When you make a system from scratch you have to figure out how to get it to boot some code. There is no built in flash or ISP mode in these old school microprocessors, so you need to figure out how to get some code [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,17],"tags":[],"class_list":["post-1135","post","type-post","status-publish","format-standard","hentry","category-arduino","category-retrocomputing"],"_links":{"self":[{"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/posts\/1135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/comments?post=1135"}],"version-history":[{"count":13,"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/posts\/1135\/revisions"}],"predecessor-version":[{"id":1977,"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/posts\/1135\/revisions\/1977"}],"wp:attachment":[{"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/media?parent=1135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/categories?post=1135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kernelcrash.com\/blog\/wp-json\/wp\/v2\/tags?post=1135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}