{"id":16608598,"url":"https://github.com/arsdever/at25f512","last_synced_at":"2026-04-23T10:32:44.861Z","repository":{"id":135994926,"uuid":"97802671","full_name":"arsdever/AT25F512","owner":"arsdever","description":"Arduino library for external flash memory AT25F512 (tested on Arduino UNO R3)","archived":false,"fork":false,"pushed_at":"2017-07-20T10:34:27.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-17T16:01:33.824Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arsdever.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-20T07:10:58.000Z","updated_at":"2022-03-20T00:35:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"9c908dde-b744-4530-adae-1194d582b053","html_url":"https://github.com/arsdever/AT25F512","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arsdever/AT25F512","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arsdever%2FAT25F512","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arsdever%2FAT25F512/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arsdever%2FAT25F512/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arsdever%2FAT25F512/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arsdever","download_url":"https://codeload.github.com/arsdever/AT25F512/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arsdever%2FAT25F512/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32176568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T02:19:40.750Z","status":"ssl_error","status_checked_at":"2026-04-23T02:17:55.737Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T01:26:44.242Z","updated_at":"2026-04-23T10:32:44.830Z","avatar_url":"https://github.com/arsdever.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a library for Arduino, that makes easy to use AT25F512 external flash memory chips.\n\n\u003e## \\! Warning - Library tested only on Arduino Uno R3 boards \\!\n\nThe fundamental functions are\n```arduino\nAT25F512(const byte\u0026 cs,const byte\u0026 wp); // Constructor. Arguments are $CS$ pin number and $WP$ pin number\nvoid clearSector(const unsigned long\u0026 addr); // Clearing sector at address addr\nvoid clearChip(); // Clearing chip\nvoid program(const unsigned long\u0026 addr,const byte* buf,const byte\u0026 size); // Writing buffer buf with length size at address addr\nvoid statusSet(const byte\u0026 status); // Sets status register by value status (!Note! with mask 0b10001100)\nbyte read(const unsigned long\u0026 addr); // Returns byte at address addr\nbyte status(); // Returns status register value\nint info(); // Returns device IDs\n```\n\nFor use, connect AT25F512 to your Arduino board as showing below\n```\nAT25F512  /^\\  Arduino\n     VCC  \u003c-\u003e  3.3V\n     SCK  \u003c-\u003e  Pin 13\n     SO   \u003c-\u003e  Pin 12\n     SI   \u003c-\u003e  Pin 11\n  $HOLD$  \u003c-\u003e  3.3V\n    $WP$  \u003c-\u003e  Set by Arduino\n    $CS$  \u003c-\u003e  Set by Arduino\n```\nNow let's code.\nThis program sample demonstrates working with flash memory.\n\n```arduino\n#include \u003cAT25F512.h\u003e\n#include \u003cSoftwareSerial.h\u003e\n#include \u003chex.h\u003e\n\nAT25F512 mem(10,9);\nString command;\n\nvoid setup(){\n  Serial.begin(57600);\n  Serial.println(\"Device ID is |\\t\"+hex(mem.info()));\n  Serial.print(\"\u003e\");\n}\n\nvoid loop() {\n  if(Serial.available()){\n    byte ch = Serial.read();\n    if(ch==8)command.remove(command.length()-1);\n    else command+=char(ch);\n  }\n  if(command.indexOf(char(13))\u003e-1){\n    Serial.println(\"Command string | \"+command);\n    command.toLowerCase();\n    if(command.indexOf(\"write\")\u003e-1){\n      int addr = command.substring(command.indexOf(\"(\")+1,command.indexOf(\",\")).toInt();\n      byte val[256];\n      byte i=0;\n      command = command.substring(command.indexOf(\",\")+1);\n      while(command.indexOf(\",\")\u003e-1){\n        val[i++] = command.substring(0,command.indexOf(\",\")).toInt();\n        command = command.substring(command.indexOf(\",\")+1);\n      }\n      val[i++] = command.substring(0,command.indexOf(\")\")).toInt();\n      Serial.print(\"Got byte array [\");\n      for(int j=0;j\u003ci;++j)\n        if(j)\n          Serial.print(\",\"+hex(val[j]));\n        else\n          Serial.print(hex(val[j]));\n      Serial.println(\"]\");\n      Serial.print(\"Programming...\\t\");\n      mem.program(addr,val,i);\n      Serial.println(\"Done.\");\n    }else if(command.indexOf(\"read\")\u003e-1){\n      int addr = command.substring(command.indexOf(\"(\")+1,command.indexOf(\")\")).toInt();\n      Serial.println(\"Byte form address 0x\"+hex(addr)+\" |\\t\"+hex(mem.read(addr)));\n    }else if(command.indexOf(\"info\")\u003e-1)\n      Serial.println(\"Device ID is |\\t\"+hex(mem.info()));\n    else if(command.indexOf(\"statusset\")\u003e-1){\n      byte st = command.substring(command.indexOf('(')+1,command.indexOf(')')).toInt();\n      Serial.println(\"Writing register state |\\t\"+bin(st));\n      mem.statusSet(st);\n    }else if(command.indexOf(\"status\")\u003e-1)\n      Serial.println(\"Status register |\\t\"+bin(mem.status()));\n    else if(command.indexOf(\"clearsector\")\u003e-1){\n      int addr = command.substring(command.indexOf(\"(\")+1,command.indexOf(\")\")).toInt();\n      Serial.print(\"Clearing sector 0x\"+hex(addr)+\"...\\t\");\n      mem.clearSector(addr);\n      Serial.println(\"Clear.\");\n    }else if(command.indexOf(\"clear\")\u003e-1){\n      Serial.print(\"Clearing chip...\\t\");\n      mem.clearChip();\n      Serial.println(\"Clear.\");\n    }else if(command.indexOf(\"printstr\")\u003e-1){\n      Serial.println(\"Printing chip memory...\\t\");\n      Serial.println(\"Press any key to stop...\\t\");\n      Serial.println();\n      Serial.print(\"         | \");\n      for(byte i=0;i\u003c32;++i)\n        Serial.print(hex(i)+\" \");\n      Serial.println();\n      Serial.print(\"---------+\");\n      for(byte i=0;i\u003c32;++i)\n        Serial.print(\"---\");\n      for(unsigned long i=0;i\u003c0xFFFF;++i){\n        if(i%32==0){\n          Serial.println();\n          Serial.print(hex(i)+\" | \");\n        }\n        Serial.print(\" \"+String((char)mem.read(i))+\" \");\n        if(Serial.available())break;\n      }\n      Serial.println();\n      if(Serial.available())\n        Serial.println(\"Print process was terminated.\");\n      else\n        Serial.println(\"That's all.\");\n      Serial.println();\n    }else if(command.indexOf(\"print\")\u003e-1){\n      Serial.println(\"Printing chip memory...\\t\");\n      Serial.println(\"Press any key to stop...\\t\");\n      Serial.println();\n      Serial.print(\"         | \");\n      for(byte i=0;i\u003c32;++i)\n        Serial.print(hex(i)+\" \");\n      Serial.println();\n      Serial.print(\"---------+\");\n      for(byte i=0;i\u003c32;++i)\n        Serial.print(\"---\");\n      for(unsigned long i=0;i\u003c0xFFFF;++i){\n        if(i%32==0){\n          Serial.println();\n          Serial.print(hex(i)+\" | \");\n        }\n        Serial.print(hex(mem.read(i))+\" \");\n        if(Serial.available())break;\n      }\n      Serial.println();\n      if(Serial.available())\n        Serial.println(\"Print process was terminated.\");\n      else\n        Serial.println(\"That's all.\");\n      Serial.println();\n    }\n    command = \"\";\n    Serial.print(\"\u003e\");\n  }  \n}\n```\n\u003e #### This code needs library \u003chex.h\u003e, that you can find at [here](https://github.com/arsdever/HEX)\u003c/br\u003e\n\u003e #### But \u003cAT25F512.h\u003e not requires \u003chex.h\u003e library\nWhen we run code, the first output will be:\n\n```\nDevice ID is |FFFF\n\u003e\n```\nThen console waiting for commands. The commands are:\n```arduino\nwrite(address,bytes[1..255]) // Number of bytes recommended maximum 128. Witing bytes at address\n:: OUTPUT\n  Got array [#{bytes}]\n  Programming... #{delay_programming_time}Done.\n  \u003e #{wayting for new command}\nread(address)                // Prints byte from address\n:: OUTPUT\n  Byte form address 0x#{address_in_hex_format} | #{readed_byte_in_hex_format}\n  \u003e #{wayting for new command}\ninfo                         // Prints device's manufacturerID + deviceID in hex format\n:: OUTPUT\n  Device ID is | #{device_id_in_hex_format}\n  \u003e #{wayting for new command}\nstatus                       // Prints device's status register in binary format\n:: OUTPUT\n  Status register | #{status_register_in_bin_format}\n  \u003e #{wayting for new command}\nstatusSet                    // Sets device's status register (!NOTE! with mask 0b10001100)\n:: OUTPUT\n  Writing register state | #{required_status_in_bin_format}\n  \u003e #{wayting for new command}\nclearSector(address)         // Clear sector from address\n:: OUTPUT\n  Clearing sector 0x#{address_in_hex_format}... #{delay_clearing_time}Clear.\n  \u003e #{wayting for new command}\nclear                        // Clears whole device\n:: OUTPUT\n  Clearing chip... #{delay_clearing_time}Clear.\n  \u003e #{wayting for new command}\nprintStr                     // Prints contain of device as string. Terminates if another command entered\n:: OUTPUT\n  Printing chip memory...\n  Press any key to stop...\n  \n         | 00 01 02 03 04 05 .. .. 1F\n  -------+---------------------------\n  000000 | ** ** ** ** ** ** .. .. **\n  000020 | ** ** ** ** ** ** .. .. **\n  000040 | ** ** ** ** ** ** .. .. **\n  000060 | ** ** ** ** ** ** .. .. **\n  .. .. .. .. .. .. .. .. .. .. .. ..\n  00FFF0 | ** ** ** ** ** ** .. .. **\n  \n  #{if_terminated}Print process was terminated.\n  #{else}That's all.\n  \u003e\n  // !Note! the ** are bytes readed from address (column_value + row_value) converted to char\nprint                        // Prints every byte of device in hex format\n:: OUTPUT\n  #{same_as_printStr}\n  // !Note! difference is here ** are bytes are printed in hex format\n```\nIf my code isn't working please contact to me to fix any error in that. Email: arsen.gharagyozyn.96@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farsdever%2Fat25f512","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farsdever%2Fat25f512","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farsdever%2Fat25f512/lists"}