{"id":579,"date":"2018-12-24T02:45:51","date_gmt":"2018-12-23T17:45:51","guid":{"rendered":"http:\/\/tamatoyaku.com\/b\/?p=579"},"modified":"2018-12-24T02:45:51","modified_gmt":"2018-12-23T17:45:51","slug":"579","status":"publish","type":"post","link":"https:\/\/p-0.me\/b\/p\/579\/","title":{"rendered":"PIC32MX\u3067NVM\u3092\u4f7f\u3063\u3066\u307f\u305f\u30e1\u30e2"},"content":{"rendered":"<p>\u516c\u5f0f\u306e\u8cc7\u6599\u3092\u8aad\u3093\u3067\u3082\u5206\u304b\u308a\u306b\u304f\u3044\u3068\u3053\u308d\u304c\u3042\u3063\u305f\u304b\u3089\u30e1\u30e2\uff0e<br \/>\n\u9593\u9055\u3063\u3066\u308b\u3068\u3053\u308d\u304c\u591a\u3005\u3042\u308a\u305d\u3046\uff0e<br \/>\n<!--more--><br \/>\n&nbsp;<\/p>\n<h4>\u74b0\u5883<\/h4>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\uff1aPIC32MX270F256B<br \/>\n\u30b3\u30f3\u30d1\u30a4\u30e9\uff1axc32-gcc(v2.10)<br \/>\n\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\uff1aMPLAB Harmony(v2.06)<br \/>\n\u56de\u8def\u69cb\u6210\uff1a<a href=\"http:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/PIC32MX1XX2XX-28-36-44-PIN-DS60001168K.pdf\">\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8<\/a>\u306eFIGURE 2-1: RECOMMENDED\u3000MINIMUM CONNECTION\u306bUSB\u95a2\u4fc2\u3092\u52a0\u3048\u305f\u3082\u306e\uff0e\u30af\u30ed\u30c3\u30af\u306f\u5916\u90e8\u306e\u30bb\u30e9\u30ed\u30c3\u30af\uff0e<br \/>\n&nbsp;<\/p>\n<h4>Harmony Configurator<\/h4>\n<p>NVM\u3092\u4f7f\u3046\u8a2d\u5b9a\u3092\u3059\u308b\u305f\u3081\u306bConfigurator\u3092\u4f7f\u3046\uff0e<br \/>\n[Harmony Framework Configuration]-&gt;[Drivers]-&gt;[NVM]\u304b\u3089Use NVM\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u308b\uff0e<br \/>\nDriver Implementation\u306fSTATIC\u306b\u3057\u3066\u304a\u304f\uff0e\u8efd\u304f\u4f7f\u3046\u5206\u306b\u306f\u9759\u7684\u306e\u307b\u3046\u304c\u826f\u3055\u305d\u3046\u306a\u6c17\u304c\u3059\u308b\uff0e<br \/>\nNVM Media Start Address\u306fNVM\u306e\u4e2d\u3067\u8aad\u307f\u66f8\u304d\u306b\u4f7f\u3044\u59cb\u3081\u308b\u30a2\u30c9\u30ec\u30b9\uff0e<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f0x9D010000\u3068\u306a\u3063\u3066\u3044\u308b\u304c\uff0c\u30d7\u30ed\u30b0\u30e9\u30e0\u81ea\u4f53\u3092\u66f8\u304d\u63db\u3048\u308b\u306e\u3067\u306a\u3051\u308c\u3070\uff0c\u30d7\u30ed\u30b0\u30e9\u30e0\u306eend address\u3088\u308a\u5927\u304d\u306a\u756a\u5730\u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\uff0e<br \/>\n\u5177\u4f53\u7684\u306a\u30e1\u30e2\u30ea\u30de\u30c3\u30d7\u306f<a href=\"http:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/PIC32MX1XX2XX-28-36-44-PIN-DS60001168K.pdf\">\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8<\/a>\u306eFIGURE 4-5: MEMORY MAP ON RESET FOR PIC32MX170\/270 DEVICES (64 KB RAM, 256 KB FLASH)\u3092\u53c2\u7167\uff0e<br \/>\nNVM Media Size\u306f\u4f55KB\u306e\u9818\u57df\u3092\u4f7f\u7528\u3059\u308b\u304b\u3092\u8868\u3059\uff0e\u4f8b\u3048\u30705\u306b\u3059\u308b\u3068\uff0cNVM Media Start Address\u304b\u30895KB\u3092\u6271\u3046\u3053\u3068\u306b\u306a\u308b\uff0e<br \/>\n\u5fd8\u308c\u304c\u3061\u306a\u306e\u304cConfiguration Bit\u306e\u8a2d\u5b9a\u3067\uff0cProgram Frash Write Protect(PWP)\u3084Code Protect(CP)\u3042\u305f\u308a\u3092OFF\u306b\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u52d5\u304b\u306a\u3044\u6c17\u304c\u3059\u308b\uff0e<br \/>\n&nbsp;<\/p>\n<h4>\u30dd\u30fc\u30ea\u30f3\u30b0\u306e\u3042\u305f\u308a<\/h4>\n<p>SYS_Initialize\u95a2\u6570\u306e\u4e2d\u306b<br \/>\n\/* Initialize the NVM Driver *\/<br \/>\nsysObj.drvNvm = DRV_NVM_Initialize(DRV_NVM_INDEX_0, (SYS_MODULE_INIT *)NULL);<br \/>\n\u304c\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\uff0e\u307e\u305f\uff0cSYS_Task\u95a2\u6570\u306e\u4e2d\u306b<br \/>\n\/* Maintain Device Drivers *\/<br \/>\nDRV_NVM_Tasks (sysObj.drvNvm);<br \/>\n\u304c\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\uff0e<br \/>\n&nbsp;<\/p>\n<h4>\u8aad\u307f\u66f8\u304d<\/h4>\n<p><a href=\"http:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/PIC32MX1XX2XX-28-36-44-PIN-DS60001168K.pdf\">\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8<\/a>\u306e5.0 FLASH PROGRAM MEMORY\u306eNote\u306b\u201dThe Flash page size on PIC32MX1XX\/2XX 28\/36\/44-pin Family devices is 1KB and the row size is 128 bytes (256 IW and 32 IW, respectively).&#8221;\u3068\u3042\u308b\u306e\u3067\uff0c1\u30da\u30fc\u30b8\u306f1KB,1\u884c\u306f128\u30d0\u30a4\u30c8\u3068\u5206\u304b\u308b\uff0e\u307e\u305f\uff0c<a href=\"http:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/Driver%20Libraries%20Help%20v2.06.pdf\">NVM\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306eAddressing in NVM Driver\u306e\u3042\u305f\u308a\u304b\u3089\uff0cRead block size = 1 byte\uff0cWrite block size = ROW Size\uff0cErase block size = PAGE Size\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308b\uff0e\u3053\u306e\u30d6\u30ed\u30c3\u30af\u30b5\u30a4\u30ba\u304c\u8aad\u307f\u66f8\u304d\u306e\u6700\u5c0f\u5358\u4f4d\u3068\u306a\u308b\uff0e<br \/>\nDRV_NVM_Open\u95a2\u6570\u3067\u306f\uff0cioIntent\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\uff0e\u8aad\u307f\u66f8\u304d\u3059\u308b\u306a\u3089DRV_IO_INTENT_READWRITE \u304c\u5fc5\u8981\uff0e<br \/>\nDRV_NVM_Read\u95a2\u6570\u3067\u306fblockStart\u3068nBlock\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\uff0e\u8aad\u307f\u8fbc\u307f\u3067\u306f1\u30d6\u30ed\u30c3\u30af\u304c1\u30d0\u30a4\u30c8\u3068\u306a\u3063\u3066\u3044\u308b\uff0e\u305d\u306e\u305f\u3081\uff0cblockStart\u306fNVM Media Start Address\u304b\u3089\u4f55\u30d0\u30a4\u30c8\u76ee\u304b\u3092\u6307\u5b9a\u3059\u308b\uff0e\u3064\u307e\u308a\uff0c\u5b9f\u969b\u306b\u30a2\u30af\u30bb\u30b9\u3055\u308c\u308b\u4eee\u60f3\u30e1\u30e2\u30ea\u306fNVM Media Start Address+blockStart\u3068\u306a\u308b\uff0e\u307e\u305f\uff0cnBlock\u3082\u540c\u69d8\u306b\u4f55\u30d0\u30a4\u30c8\u8aad\u307f\u8fbc\u3080\u304b\u3092\u6307\u5b9a\u3059\u308b\uff0e<br \/>\nDRV_NVM_Write\u95a2\u6570\u3067\u306f1\u30d6\u30ed\u30c3\u30af\u304c1\u884c\uff0c\u3064\u307e\u308a128\u30d0\u30a4\u30c8\u3068\u306a\u308b\uff0e\u3088\u3063\u3066\u4eee\u60f3\u30e1\u30e2\u30ea\u4e0a\u306e\u30a2\u30af\u30bb\u30b9\u5148\u306fNVM Media Start Address+(128*blockStart)\u3068\u306a\u308b\uff0e\u307e\u305f\uff0c\u66f8\u304d\u8fbc\u3080\u30d0\u30a4\u30c8\u6570\u306f(128*nBlock)\u3068\u306a\u308b\uff0e\u306a\u304a\uff0cNVM\u306fEEPROM\u306a\u306e\u3067\u66f8\u304d\u8fbc\u3080\u524d\u306bErase\u3092\u304b\u3051\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\uff0eEEPROM\u3067\u306f\u66f8\u304d\u8fbc\u307f\u306f&#8217;1&#8217;=&gt;&#8217;0&#8217;\u3068\u3044\u3046\u64cd\u4f5c\u306e\u307f\u3067\uff0cErase\u306b\u3088\u308a\u3059\u3079\u3066\u3092&#8217;1&#8217;\u306b\u3059\u308b\uff0e\u3088\u3063\u3066\uff0cErase\u3092\u304b\u3051\u305a\u306bWrite\u3092\u304b\u3051\u308b\u3068&#8221;\u524d\u306e\u72b6\u614b&amp;\u66f8\u304d\u8fbc\u3080\u5185\u5bb9&#8221;\u3068\u306a\u308a\uff0c\u8981\u3059\u308b\u306b\u5fc5\u8981\u4ee5\u4e0a\u306b&#8217;0&#8217;\u304c\u5897\u3048\u308b\uff0e\u3088\u3063\u3066\uff0cWrite\u3092\u304b\u3051\u308b\u524d\u306bErase\u304c\u5fc5\u8981\u304b\u3069\u3046\u304b\u691c\u8a0e\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308b\uff0e<br \/>\nDRV_NVM_EraseWrite\u95a2\u6570\u306f\u4e0a\u8a18\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\uff0c\u305d\u306e\u540d\u306e\u901a\u308aErase\u3092\u304b\u3051\u3066\u304b\u3089Write\u3092\u3057\u3066\u304f\u308c\u308b\uff0e\u666e\u901a\u306f\u3053\u3063\u3061\u3092\u4f7f\u3046\u6c17\u304c\u3059\u308b\uff0e<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u516c\u5f0f\u306e\u8cc7\u6599\u3092\u8aad\u3093\u3067\u3082\u5206\u304b\u308a\u306b\u304f\u3044\u3068\u3053\u308d\u304c\u3042\u3063\u305f\u304b\u3089\u30e1\u30e2\uff0e \u9593\u9055\u3063\u3066\u308b\u3068\u3053\u308d\u304c\u591a\u3005\u3042\u308a\u305d\u3046\uff0e<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-579","post","type-post","status-publish","format-standard","hentry","category-4","category-tech"],"_links":{"self":[{"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/posts\/579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/comments?post=579"}],"version-history":[{"count":0,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/posts\/579\/revisions"}],"wp:attachment":[{"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/media?parent=579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/categories?post=579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-0.me\/b\/wp-json\/wp\/v2\/tags?post=579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}