{"id":241,"date":"2017-05-27T13:22:34","date_gmt":"2017-05-27T18:22:34","guid":{"rendered":"http:\/\/www.millamilla.com\/?p=241"},"modified":"2017-05-27T17:01:07","modified_gmt":"2017-05-27T22:01:07","slug":"testing-mb85rs64v-with-bus-pirate","status":"publish","type":"post","link":"https:\/\/www.millamilla.com:443\/?p=241","title":{"rendered":"Testing MB85RS64V with Bus Pirate"},"content":{"rendered":"<p>As part of the <a href=\"https:\/\/contextualelectronics.com\/courses\/micro-breakout-header\/\">CE Header<\/a> project from the <a href=\"http:\/\/skills.contextualelectronics.com\/\">CE Skills<\/a> course , I decided to add an IC that used SPI to the SensorBoard. I chose the <a href=\"http:\/\/www.fujitsu.com\/downloads\/MICRO\/fsa\/pdf\/products\/memory\/fram\/MB85RS64V-DS501-00015-4v0-E.pdf\">MB85RS64V<\/a> chip. This is a Ferroelectric Random Access Memory (<a href=\"http:\/\/www.eeherald.com\/section\/design-guide\/FRAM-MRAM-PRAM-nonvolatile-flash-replacement-memories.html\">FRAM<\/a>) integrated circuit. \u00a0It is similar to FLASH, but with some added benefits. The idea is to be able to write data to it and the data will persist between power off and power on cycles. I used a Bus Pirate (Dangerous Prototypes) and probes, from Seeed Studio, to iteratively poke at it until I understood how to talk to it via SPI.<\/p>\n<p>Once I soldered the MB85RS64V to a small carrier board from Adafruit, I placed it on a breadboard and wired it up to the Bus Pirate. Please note, the cable and connectors in the image below are from the Seeed probe cable. Some of the other probe cables have the colors in a different order on the connectors.<\/p>\n<p>I used <a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/latest.html\">putty<\/a> to connect to the Bus Pirate via a mini usb cable.<\/p>\n<table style=\"width: 391px;\" border=\"1\" cellspacing=\"2\" cellpadding=\"0\">\n<thead>\n<tr>\n<td style=\"width: 86px;\">Command<\/td>\n<td style=\"width: 295px;\">What it does<\/td>\n<\/tr>\n<\/thead>\n<caption>Initalize the Bus Pirate<\/caption>\n<tbody>\n<tr>\n<td align=\"left\">M 5 1 1 2 1 2 2<\/td>\n<td>\n<ul>\n<li>Mode SPI<\/li>\n<li>Speed 30khz<\/li>\n<li>Clock: Idle low *default<\/li>\n<li>Output clock edge: Active to idle *default<\/li>\n<li>Input sample phase: Middle *default<\/li>\n<li>CS: \/CS *default, Output Type: Normal (H=3.3V, L=GND)<\/li>\n<\/ul>\n<p>Make sure the mode number you use is for SPI<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 86px;\">W<\/td>\n<td style=\"width: 295px;\">Turn on power, don&#8217;t forget this. \u00a0If you try to access the FRAM chip before this, you will likely hang the Bus Pirate and have to unplug\/plug,setup.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table style=\"width: 504px;\" border=\"1\" cellspacing=\"2\" cellpadding=\"0\">\n<thead>\n<tr style=\"height: 25px;\">\n<td style=\"width: 147px; height: 25px;\">Command<\/td>\n<td style=\"width: 133px; height: 25px;\">What it does<\/td>\n<td style=\"width: 220px; height: 25px;\">Output<\/td>\n<\/tr>\n<\/thead>\n<caption>Read the ID<\/caption>\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 147px; height: 24px;\">[ 0b10011111 r:4 ]<\/td>\n<td style=\"width: 133px; height: 24px;\">Read Chip ID<\/td>\n<td style=\"width: 220px; height: 24px;\">0x04 0x7F 0x03 0x02<\/p>\n<table>\n<tbody>\n<tr>\n<td>Manufacturer<\/td>\n<td>0x04<\/td>\n<td>Fujitsu<\/td>\n<\/tr>\n<tr>\n<td>Continuation Code<\/td>\n<td>0x7F<\/td>\n<td>?<\/td>\n<\/tr>\n<tr>\n<td>Product ID &#8211; byte 1<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0 Proprietary (3 left bits)<\/td>\n<td>0b000<\/td>\n<td>?<\/td>\n<\/tr>\n<tr>\n<td>\u00a0 Density (5 right bits)<\/td>\n<td>0b0011<\/td>\n<td>64kbit<\/td>\n<\/tr>\n<tr>\n<td>Product ID &#8211; byte 2<\/td>\n<td>0x02<\/td>\n<td>2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table style=\"width: 617.352px;\" border=\"1\" cellspacing=\"2\" cellpadding=\"0\">\n<thead>\n<tr style=\"height: 25px;\">\n<td style=\"width: 320px; height: 25px;\">Command<\/td>\n<td style=\"width: 137px; height: 25px;\">What it does<\/td>\n<td style=\"width: 214.352px; height: 25px;\">Output<\/td>\n<\/tr>\n<\/thead>\n<caption>Read the status register<\/caption>\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 320px; height: 24px;\">[ 0b00000101 r:1 ]<\/td>\n<td style=\"width: 137px; height: 24px;\">Read the register<\/td>\n<td style=\"width: 214.352px; height: 24px;\">0x00 (default)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table style=\"width: 615px;\" border=\"1\" cellspacing=\"2\" cellpadding=\"0\">\n<thead>\n<tr style=\"height: 25px;\">\n<td style=\"width: 190px; height: 25px; text-align: left; vertical-align: top;\">Command<\/td>\n<td style=\"width: 214px; height: 25px; text-align: left; vertical-align: top;\">What it does<\/td>\n<td style=\"width: 195px; height: 25px; text-align: left; vertical-align: top;\">Output<\/td>\n<\/tr>\n<\/thead>\n<caption>Read memory<\/caption>\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000011 0 0 r:5 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Read 5 bytes starting at address 0x00 0x00 (msb first)<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\">0x00 0x00 0x00 0x00 0x00<\/p>\n<p>Bytes are initialized to 0 from the manufacturer<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000011 0 0 r:8192 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Read all of the bytes from the chip<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\">&#8230;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table style=\"width: 615px;\" border=\"1\" cellspacing=\"2\" cellpadding=\"0\">\n<caption>Write 1 byte to memory<\/caption>\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">Command<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">What it does<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\">Output<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000110 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Write Enable<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\"><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000010 0x1F 0xFF 0x11 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Write 5 bytes starting at address 0x1F 0xFF (msb first)<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\">\u00a0Note: the very last byte is at address 0x1F 0xFF<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000100 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Write Disable<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\"><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000011 0x1F 0xFF r:1 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Read the data back from address 0x1F 0xFF<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\">0x11<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table style=\"width: 615px;\" border=\"1\" cellspacing=\"2\" cellpadding=\"0\">\n<caption>Write 5 bytes to memory<\/caption>\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">Command<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">What it does<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\">Output<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000110 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Write Enable<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\"><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000010 0x00 0x00 0x01 0x02 0x03 0x04 0x05]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Write 5 bytes starting at address 0x00 0x00 (msb first)<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\">\u00a0Note: the very first byte is at address 0x00 0x00<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000100 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Write Disable<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\"><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 190px; height: 24px; text-align: left; vertical-align: top;\">[ 0b00000011 0x00 0x00 r:5 ]<\/td>\n<td style=\"width: 214px; height: 24px; text-align: left; vertical-align: top;\">Read the data back from address 0x00 0x00<\/td>\n<td style=\"width: 195px; height: 24px; text-align: left; vertical-align: top;\">0x01\u00a00x02 0x03 0x04 0x05<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Go ahead and power off with the w command, unplug the USB from the Bus Pirate, plug it back in. \u00a0Go through the set up steps and re-read the data, it should still be there!<\/p>\n<p><a href=\"http:\/\/ostrich.hedrickfam.com:8081\/wp-content\/uploads\/2017\/05\/connect_bus_pirate_to_MB85RS64V-DS501-00015-4v0-E_2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-239\" src=\"http:\/\/ostrich.hedrickfam.com:8081\/wp-content\/uploads\/2017\/05\/connect_bus_pirate_to_MB85RS64V-DS501-00015-4v0-E_2-300x225.jpg\" alt=\"\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/connect_bus_pirate_to_MB85RS64V-DS501-00015-4v0-E_2-300x225.jpg 300w, https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/connect_bus_pirate_to_MB85RS64V-DS501-00015-4v0-E_2-768x576.jpg 768w, https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/connect_bus_pirate_to_MB85RS64V-DS501-00015-4v0-E_2-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>It turns out that Adafruit sells this chip ready to go on a <a href=\"https:\/\/www.adafruit.com\/product\/1897\">breakout\u00a0board<\/a> along with an <a href=\"https:\/\/learn.adafruit.com\/adafruit-spi-fram-breakout\/wiring-and-test\">Arduino library<\/a>!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As part of the CE Header project from the CE Skills course , I decided to add an IC that used SPI to the SensorBoard. I chose the MB85RS64V chip. This is a Ferroelectric Random Access Memory (FRAM) integrated circuit. \u00a0It is similar to FLASH, but with some added benefits. The idea is to be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-241","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=241"}],"version-history":[{"count":5,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":259,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions\/259"}],"wp:attachment":[{"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}