
{"id":14534,"date":"2022-04-18T16:29:51","date_gmt":"2022-04-18T07:29:51","guid":{"rendered":"https:\/\/okiraku-camera.tokyo\/blog\/?p=14534"},"modified":"2022-04-18T17:44:15","modified_gmt":"2022-04-18T08:44:15","slug":"hobonicola%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa-uhs%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ae%e4%bf%ae%e6%ad%a3","status":"publish","type":"post","link":"https:\/\/okiraku-camera.tokyo\/blog\/?p=14534","title":{"rendered":"hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4fee\u6b63"},"content":{"rendered":"<figure id=\"attachment_13137\" aria-describedby=\"caption-attachment-13137\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2021\/08\/34640f7795ba5d1207a64e05e37670cf.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-13137\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2021\/08\/34640f7795ba5d1207a64e05e37670cf-552x414.jpg\" alt=\"\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-13137\" class=\"wp-caption-text\">ISP1807Micro + miniUHS<\/figcaption><\/figure>\n<h1>\u6982\u8981<\/h1>\n<p><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=14381\" target=\"_blank\" rel=\"noopener\">hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea1.6.1<\/a>\u3067\u306f\u3001AVR(ATmega32U4)\u306e\u307b\u304b\u306b\u3001SAMD21\u3068ISP1807(nRF52840)\u3092\u4f7f\u3063\u305f\u30de\u30a4\u30b3\u30f3\u30dc\u30fc\u30c9\u306b\u5bfe\u5fdc\u3057\u305f (USB\u30a2\u30c0\u30d7\u30bf\u30fc\u7248)\u3002\u5bfe\u5fdc\u306b\u3042\u305f\u3063\u3066\u3001\u30de\u30a4\u30b3\u30f3\u81ea\u4f53\u3084\u30de\u30a4\u30b3\u30f3\u30dc\u30fc\u30c9\u3054\u3068\u306e\u76f8\u9055\u3092\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u3067\u5207\u308a\u5206\u3051\u3066\u5438\u53ce\u3057\u3001\u5168\u4f53\u3068\u3057\u3066\u5404\u30dc\u30fc\u30c9\u3092\u540c\u3058\u3088\u3046\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n<p>\u4e2d\u8eab\u3092\u5fd8\u308c\u306a\u3044\u3046\u3061\u306b\u66f8\u3044\u3066\u304a\u3053\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u3001<a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=14493\" target=\"_blank\" rel=\"noopener\">\u524d\u56de\u306e\u6295\u7a3f\u3067\u7701\u96fb\u6d41\u306b\u3064\u3044\u3066<\/a>\u3001\u4eca\u56de\u306f<strong>mini USB Host Shield (\u4ee5\u4e0bminiUHS) = MAX3421E<\/strong>\u3068\u306e\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u305f\u3002<\/p>\n<h1>miniUHS\u3068\u306e\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9<\/h1>\n<h2>\u63a5\u7d9a\u3001\u914d\u7dda\u306b\u3064\u3044\u3066<\/h2>\n<p><strong>SparkFun Pro Micro<\/strong> \u3068\u306e\u63a5\u7d9a\u306b\u3064\u3044\u3066\u306f\u3001\u6700\u521d\u306b\u4f5c\u3063\u305f\u3068\u304d\u306e <a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=8092\" target=\"_blank\" rel=\"noopener\">https:\/\/okiraku-camera.tokyo\/blog\/?p=8092\u00a0<\/a> \u304a\u3088\u3073\u3001\u73fe\u5728\u306e2\u968e\u5efa\u3066\u69cb\u6210\u306e<a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=8193\" target=\"_blank\" rel=\"noopener\">\u00a0https:\/\/okiraku-camera.tokyo\/blog\/?p=8193<\/a> \u3092\u53c2\u7167\u3002<\/p>\n<p><strong>ISP1807(nRF52840)<\/strong>\u3092\u4f7f\u3063\u305fPro Micro\u30d4\u30f3\u4e92\u63db\u306e<a href=\"https:\/\/www.switch-science.com\/catalog\/6939\/\" target=\"_blank\" rel=\"noopener\"><strong>\u30b9\u30a4\u30c3\u30c1\u30b5\u30a4\u30a8\u30f3\u30b9\u88fdISP1807Micro\u30dc\u30fc\u30c9<\/strong><\/a> \u306b\u3064\u3044\u3066\u306f\u3001Pro Micro\u7528\u306b\u4f5c\u3063\u305f2\u968e\u5efa\u3066\u30a2\u30c0\u30d7\u30bf\u30fc\u306e2\u968e\u90e8\u5206(\u30de\u30a4\u30b3\u30f3\u30dc\u30fc\u30c9)\u3068\u3057\u3066ISP1807 MB\u3092\u305d\u306e\u307e\u307e\u63a5\u7d9a\u3059\u308b\u3002 <a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=13128\" target=\"_blank\" rel=\"noopener\">https:\/\/okiraku-camera.tokyo\/blog\/?p=13128<\/a> \u3092\u53c2\u7167\u3002<br \/>\n\u30ea\u30f3\u30af\u5148\u306e\u6295\u7a3f\u3067\u306f\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u306e <strong>USB Host Shield Library 2.0<\/strong> (\u4ee5\u4e0b\u3001<strong>UHS\u30e9\u30a4\u30d6\u30e9\u30ea<\/strong>)\u3067ISP1807MB\u3092\u6271\u3046\u305f\u3081\u306e\u4fee\u6b63\u65b9\u6cd5\u3082\u8a18\u8f09\u3057\u3066\u3042\u308b(\u4ee5\u4e0b\u306e\u5185\u5bb9\u3068\u91cd\u8907\u3059\u308b\u90e8\u5206\u3082\u591a\u3044\u304c)\u3002<\/p>\n<p><strong>SAMD21 (Seeeduino XIAO-m0\u3068Adafruit QT Py SAMD21)<\/strong> \u3068\u306e\u63a5\u7d9a\u306b\u3064\u3044\u3066\u306f\u3001Pro Micro\u306e\u4ee3\u308f\u308a\u306b\u3053\u308c\u3089\u3092\u5dee\u305b\u308b\u3088\u3046\u306b\u914d\u7dda\u3057\u305f\u57fa\u677f\u3092\u4f5c\u3063\u305f <a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=14346\" target=\"_blank\" rel=\"noopener\">https:\/\/okiraku-camera.tokyo\/blog\/?p=14346<\/a> \u3092\u53c2\u7167\u3002<\/p>\n<h2>UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u6539\u9020<\/h2>\n<p>hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea 1.6.1 \u304b\u3089\u306f\u3001UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30af\u30e9\u30b9\u540d\u3084\u69cb\u9020\u4f53\u540d\u306a\u3069\u3092\u82e5\u5e72\u5909\u66f4\u3057\u305f\u90fd\u5408\u3082\u3042\u3063\u3066\u3001UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u81ea\u4f53\u3092hoboNicola\u306e\u30bd\u30fc\u30b9\u30c4\u30ea\u30fc\u306b\u5305\u542b\u3059\u308b\u3088\u3046\u306b\u3057\u305f(\u305d\u306e\u3042\u305f\u308a\u306e\u7406\u7531\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=14493#hobonicola_include_uhslib\" target=\"_blank\" rel=\"noopener\">\u524d\u56de\u306e\u6295\u7a3f<\/a>\u3092\u53c2\u7167)\u3002\u4ee5\u4e0b\u3001hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea\u306e<strong> src\/UHSLib2.0<\/strong> \u5185 \u306e\u3044\u304f\u3064\u304b\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u5bfe\u3057\u3066\u884c\u3063\u305f\u4fee\u6b63\u3084\u691c\u8a0e\u306a\u3069\u306b\u3064\u3044\u3066\u3002<\/p>\n<h3>\u30dc\u30fc\u30c9\u3054\u3068\u306e\u76f8\u9055\u306e\u5438\u53ce<\/h3>\n<p>UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u3001SPI\u901a\u4fe1\u306b\u95a2\u4fc2\u3059\u308b\u30dd\u30fc\u30c8\u64cd\u4f5c\u306e\u65b9\u6cd5\u3092(UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u3067)\u4e00\u822c\u5316\u3059\u308b\u305f\u3081\u3001<strong>avrpins.h<\/strong>\u5185\u3067\u30de\u30a4\u30b3\u30f3\u3084\u30dc\u30fc\u30c9\u3054\u3068\u306b\u30dd\u30fc\u30c8\u3084\u30dd\u30fc\u30c8\u64cd\u4f5c\u65b9\u6cd5\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3002\u305d\u3057\u3066<strong>usbhost.h<\/strong>\u3084<strong>UsbCore.h<\/strong>\u3067\u3001avrpins.h\u3067\u306e\u5b9a\u7fa9\u3092\u7528\u3044\u3066SPI\u8ee2\u9001\u306b\u7279\u5316\u3057\u305f\u30d4\u30f3(SS\u3084INT\u306a\u3069)\u306e\u64cd\u4f5c\u65b9\u6cd5\u3092\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u3063\u3066\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3002<\/p>\n<h4>avrpins.h<\/h4>\n<h5>nRF52(ISP1807MB)\u7528\u306e\u5b9a\u7fa9<\/h5>\n<p>\u4ee5\u524d\u306e\u6295\u7a3f\u3068\u540c\u69d8\u306b\u3001nrf_gpio_pin_xxxx() \u3092\u4f7f\u3063\u3066GPIO\u30dd\u30fc\u30c8\u306e\u64cd\u4f5c\u3092\u884c\u3063\u3066\u304a\u308a\u3001Pro Micro\u3068\u540c\u3058\u4f4d\u7f6e\u306e\u30d4\u30f3\u3092\u4f7f\u3063\u3066miniUHS\u3068\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u3057\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">#elif defined(ARDUINO_SSCI_ISP1807_MICRO_BOARD)\t\/\/ ISP1807 MB\r\n#define MAKE_PIN(className, pin) \\\r\nclass className { \\\r\npublic: \\\r\n    static void Set() { \\\r\n        nrf_gpio_pin_set(pin); \\\r\n    } \\\r\n    static void Clear() { \\\r\n        nrf_gpio_pin_clear(pin); \\\r\n    } \\\r\n    static void SetDirRead() { \\\r\n        nrf_gpio_cfg_input(pin, NRF_GPIO_PIN_NOPULL); \\\r\n    } \\\r\n    static void SetDirWrite() { \\\r\n        nrf_gpio_cfg_output(pin); \\\r\n    } \\\r\n    static uint8_t IsSet() { \\\r\n        return (uint8_t)nrf_gpio_pin_read(pin); \\\r\n    } \\\r\n};\r\nMAKE_PIN(P15, (6)); \/\/ SCK \r\nMAKE_PIN(P14, (8)); \/\/ MISO \r\nMAKE_PIN(P9, (26));\t\/\/ INT(D9)\r\nMAKE_PIN(P10, (17)); \/\/ SS(D10)\r\nMAKE_PIN(P16, (10)); \/\/ MOSI \r\n#undef MAKE_PIN\r\n#elif ...\r\n<\/pre>\n<h5>SAMD21\u7528<\/h5>\n<p>SAMD21\u7528\u306b\u3064\u3044\u3066\u306f\u3001QT Py SAMD21\u3068 XIAO-m0\u3068\u3067GPIO\u30dd\u30fc\u30c8\u304c\u7570\u306a\u308b\u306e\u3067\u304a\u306e\u304a\u306e\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3002\u30dd\u30fc\u30c8\u64cd\u4f5c\u306e\u305f\u3081\u306b\u7528\u3044\u308b\u65b9\u6cd5\u306f\u4e00\u7dd2\u3002<\/p>\n<pre class=\"lang:default decode:true\">#elif defined(ADAFRUIT_QTPY_M0) || defined(SEEED_XIAO_M0)\r\n#define MAKE_PIN(className, port, pin) \\\r\nclass className { \\\r\npublic: \\\r\n  static void Set() { \\\r\n    PORT-&gt;Group[port].OUTSET.reg = (1ul &lt;&lt; pin); \\\r\n  } \\\r\n  static void Clear() { \\\r\n    PORT-&gt;Group[port].OUTCLR.reg = (1ul &lt;&lt; pin); \\\r\n  } \\\r\n  static void SetDirRead() { \\\r\n    PORT-&gt;Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN) ; \\\r\n    PORT-&gt;Group[port].DIRCLR.reg = (1ul &lt;&lt; pin); \\\r\n  } \\\r\n  static void SetDirWrite() { \\\r\n    PORT-&gt;Group[port].PINCFG[pin].reg=(uint8_t)(PORT_PINCFG_INEN) ; \\\r\n    PORT-&gt;Group[port].DIRSET.reg = (1ul &lt;&lt; pin); \\\r\n  } \\\r\n  static uint8_t IsSet() { \\\r\n    return PORT-&gt;Group[port].IN.reg &amp; (1ul &lt;&lt; pin); \\\r\n  } \\\r\n};\r\n\/\/ Pxx \u306e\u6570\u5b57\u306fisp1807\u306b\u5408\u308f\u305b\u305f\u3002\r\n#if defined(ADAFRUIT_QTPY_M0)\r\n MAKE_PIN(P15, 0, 11); \/\/ SCK(SCK \/ D8 \/ PA11)\r\n MAKE_PIN(P14, 0, 9); \/\/ MISO(MI \/ D9 \/ PA09)\r\n MAKE_PIN(P16, 0, 10); \/\/ MOSI(MO \/ D10 \/ PA10)\r\n MAKE_PIN(P9,  0, 17); \/\/ INT (SCL \/ D5 \/ PA17)\r\n MAKE_PIN(P10, 0, 16); \/\/ SS (SDA \/ D4 \/ PA16)\r\n#elif defined(SEEED_XIAO_M0)\r\n MAKE_PIN(P15, 0, 7); \/\/ SCK(SCK \/ D8 \/ PA07)\r\n MAKE_PIN(P14, 0, 5); \/\/ MISO(MI \/ D9 \/ PA05)\r\n MAKE_PIN(P16, 0, 6); \/\/ MOSI(MO \/ D10 \/ PA06)\r\n MAKE_PIN(P9,  0, 9); \/\/ INT (SCL \/ D5 \/ PA09)\r\n MAKE_PIN(P10, 0, 8); \/\/ SS (SDA \/ D4 \/ PA08)\r\n#endif\r\n#undef MAKE_PIN\r\n#else ...<\/pre>\n<p>(1.6.1\u7248\u306b\u542b\u307e\u308c\u308b\u30bd\u30fc\u30b9\u3068\u7570\u306a\u308b\u304c\u3001\u30b3\u30e1\u30f3\u30c8\u306e\u8aa4\u308a\u306a\u3069\u3092\u4fee\u6b63\u3057\u305f\u3053\u3061\u3089\u304c\u6b63\u3057\u3044)\u3002<\/p>\n<p>SAMD21\u3092\u4f7f\u3063\u305f\u5225\u306e\u30dc\u30fc\u30c9\u306b\u5bfe\u5fdc\u3059\u308b\u306a\u3089\u3070\u3001\u4e0a\u8a18\u30b3\u30fc\u30c9\u306b\u3042\u308b5\u884c\u306e<em>MAKE_PIN();<\/em> \u3092\u30dc\u30fc\u30c9\u306b\u5408\u308f\u305b\u3066\u8ffd\u52a0\u3057\u3066\u3044\u3051\u3070\u3044\u3044\u3060\u308d\u3046\u3002\u73fe\u5728\u306e\u914d\u7dda\u3067\u306f\u3001<em>PORT-&gt;Group[port]<\/em> \u306eport\u306f\u3059\u3079\u30660 (PA)\u306a\u306e\u3067\u7701\u7565\u53ef\u80fd\u306a\u306e\u3060\u304c\u3001port == 1 (PB)\u3092\u4f7f\u3046\u5834\u5408\u3092\u8003\u616e\u3057\u3066\u3053\u306e\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n<p>\u5225\u306e\u66f8\u304d\u65b9\u3068\u3057\u3066\u3001Arduino\u6d41\u306e\u30dd\u30fc\u30c8\u30d4\u30f3\u756a\u53f7\u3068<em>digitalWrite()<\/em> \u3084 <em>digitalRead()<\/em> \u3092\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u308b\u3002\u3053\u306e\u65b9\u304c\u8aad\u307f\u3084\u3059\u304f\u306a\u308b\u3057\u6c4e\u7528\u6027\u3082\u9ad8\u304f\u306a\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">#elif defined(ADAFRUIT_QTPY_M0) || defined(SEEED_XIAO_M0)\r\n#define MAKE_PIN(className, pin) \\\r\nclass className { \\\r\npublic: \\\r\n  static void Set() {   digitalWrite(pin, 1); } \\\r\n  static void Clear() { digitalWrite(pin, 0); } \\\r\n  static void SetDirRead()  { pinMode(pin, INPUT); } \\\r\n  static void SetDirWrite() { pinMode(pin, OUTPUT); } \\\r\n  static uint8_t IsSet() { return digitalRead(pin); } \\\r\n};\r\nMAKE_PIN(P15, 8); \/\/ SCK(SCK \/ D8)\r\nMAKE_PIN(P14, 9); \/\/ MISO(MI \/ D9)\r\nMAKE_PIN(P16, 10); \/\/ MOSI(MO \/ D10)\r\nMAKE_PIN(P9,  5); \/\/ INT (SCL \/ D5)\r\nMAKE_PIN(P10, 4); \/\/ SS (SDA \/ D4)\r\n#undef MAKE_PIN\r\n#else\r\n<\/pre>\n<p>SAMD\u306eI\/O\u30d4\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9(PORT) \u3092\u64cd\u4f5c\u3059\u308b\u5834\u5408\u3068\u3001Arduino\u306e\u6a19\u6e96\u95a2\u6570\u3092\u4f7f\u3046\u5834\u5408\u306e\u901f\u5ea6\u306e\u76f8\u9055\u306b\u3064\u3044\u3066\u306f\u5f8c\u8ff0\u3057\u3066\u3044\u308b\u3002<\/p>\n<h4>usbhost.h<\/h4>\n<p><strong>usbhost.h<\/strong>\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306bISP1807MB\u3068SAMD21\u30dc\u30fc\u30c9\u7528\u306e\u5b9a\u7fa9\u3092\u8a18\u8ff0\u3057\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true\">#elif defined(ARDUINO_SSCI_ISP1807_MICRO_BOARD) \r\ntypedef SPi&lt; P15, P16, P14, P10 &gt; spi;\r\n#elif defined(ADAFRUIT_QTPY_M0) || defined(SEEED_XIAO_M0)\r\ntypedef SPi&lt; P15, P16, P14, P10 &gt; spi;\r\n#else\r\n...<\/pre>\n<p>avrpins,h\u3067\u3001Pxx \u30af\u30e9\u30b9\u3092\u5b9a\u7fa9\u3059\u308b\u3068\u304d\u3001SAMD21\u7528\u306e\u5404\u30d4\u30f3\u304cISP1807MB\u3068\u540c\u3058\u540d\u524d\u306b\u306a\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306b\u540c\u3058\u5185\u5bb9\u3067\u554f\u984c\u306a\u3044\u3002\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 SPi\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">template&lt; typename SPI_CLK, typename SPI_MOSI, typename SPI_MISO, typename SPI_SS &gt; class SPi { ... };<\/pre>\n<p>hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u30de\u30a4\u30b3\u30f3\u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2SPI \u3092\u4f7f\u3063\u305fSPI\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b (<em>SPI_HAS_TRANSACTION<\/em> \u304cdefine\u3055\u308c\u3066\u3044\u308b) \u306e\u3067\u3001\u7d50\u5c40\u306e\u3068\u3053\u308dSPI_SS (Slave Select\u64cd\u4f5c\u7528\u30af\u30e9\u30b9)\u3057\u304b\u5229\u7528\u3055\u308c\u306a\u3044\u3002<\/p>\n<h5>UsbCore.h<\/h5>\n<p><strong>UsbCore.h<\/strong>\u3067\u306f\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<em> MAX3421e<\/em>\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066SS\u30d4\u30f3\u3068INT\u30d4\u30f3\u306e\u64cd\u4f5c\u30af\u30e9\u30b9\u540d\u3092\u4e0e\u3048\u305f\u30dc\u30fc\u30c9\u3054\u3068\u306e\u00a0<em>MAX3421E<\/em> \u3092\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3002<em>MAX3421e<\/em>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f usbhost.h\u3067\u5ba3\u8a00\u3055\u308c\u3066\u3044\u3066\u3001<em>MAX3421E<\/em>\u306fUsbCore.h \u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u306a\u3093\u3068\u3082\u5206\u304b\u308a\u3065\u3089\u3044\u306e\u3060\u304c\u3001\u3082\u3068\u3082\u3068\u305d\u3046\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\u304c\u306a\u3044\u3002<\/p>\n<p>hoboNicola\u7528\u306b\u8ffd\u52a0\u3057\u305f\u30dc\u30fc\u30c9\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u6a19\u6e96Arduino\u30dc\u30fc\u30c9\u7528\u306e\u5b9a\u7fa9\u3068\u540c\u3058\u306b\u306a\u308b\u3088\u3046\u306b\u3001avrpins.h\u3067P10\u3068P9\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">...\r\n#else\r\ntypedef MAX3421e&lt;P10, P9&gt; MAX3421E; \/\/ Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.x\r\n#endif\r\n<\/pre>\n<p>\u3057\u305f\u304c\u3063\u3066\u7279\u306b\u8ffd\u52a0\u3092\u4fee\u6b63\u306e\u5fc5\u8981\u306f\u306a\u304b\u3063\u305f\u3002<\/p>\n<h3>SPI\u30af\u30ed\u30c3\u30af\u306b\u3064\u3044\u3066(usbhost.h)<\/h3>\n<p>UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3088\u308bSPI\u30af\u30ed\u30c3\u30af\u8a2d\u5b9a\u306b\u554f\u984c\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u4fee\u6b63\u3092\u5165\u308c\u305f\u3002<\/p>\n<h5>\u30aa\u30ea\u30b8\u30ca\u30eb\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u52d5\u4f5c<\/h5>\n<p>UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u3001MAX3421E\u3068\u306eSPI\u901a\u4fe1\u306e\u901f\u5ea6(\u30af\u30ed\u30c3\u30af)\u3068\u3057\u3066\u3001<strong>MAX3421E\u306e\u30b9\u30da\u30c3\u30af\u4e0a\u306e\u6700\u5927\u5024(26MHz)<\/strong>\u3092\u4f7f\u3046\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3067SPI\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306e\u521d\u671f\u5316\u3092\u884c\u3063\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); \/\/ The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0\r\n<\/pre>\n<p>\u5404\u30de\u30a4\u30b3\u30f3\u7528\u306eSPI\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b SPISettings \u30af\u30e9\u30b9\u3067\u306f\u3001\u30de\u30a4\u30b3\u30f3\u306e\u7a2e\u985e\u3084\u52d5\u4f5c\u30af\u30ed\u30c3\u30af\u306a\u3069\u306b\u5fdc\u3058\u3066\u300126MHz\u4ee5\u4e0b\u306e\u3001\u306a\u308b\u3079\u304f\u9ad8\u901f\u3067\u52d5\u4f5c\u53ef\u80fd\u306a\u30af\u30ed\u30c3\u30af\u5024\u3092\u63a1\u7528\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u524d\u63d0\u306a\u306e\u3060\u304c\u3001hoboNicola\u3067\u5bfe\u5fdc\u3057\u305f\u5404\u30de\u30a4\u30b3\u30f3\u30dc\u30fc\u30c9\u3067\u306f\u4ee5\u4e0b\u306e\u5024\u306b\u306a\u308b\u3002<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 33.3333%;\">\u30dc\u30fc\u30c9<\/td>\n<td style=\"width: 22.3628%;\">\u30b3\u30a2\u30af\u30ed\u30c3\u30af<\/td>\n<td style=\"width: 23.6288%;\">SPI\u30af\u30ed\u30c3\u30af<br \/>\n\u4fee\u6b63\u524d<\/td>\n<td style=\"width: 20.6751%;\">SPI\u30af\u30ed\u30c3\u30af<br \/>\n\u4fee\u6b63\u5f8c<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\"><strong>Pro Micro (8MHz)<\/strong><\/td>\n<td style=\"width: 22.3628%;\">8MHz<\/td>\n<td style=\"width: 23.6288%;\">4MHz<\/td>\n<td style=\"width: 20.6751%;\">4MHz<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\"><strong>ATmega32U4(16MHz)<\/strong><\/td>\n<td style=\"width: 22.3628%;\">16MHz<\/td>\n<td style=\"width: 23.6288%;\">8MHz<\/td>\n<td style=\"width: 20.6751%;\">8MHz<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\"><strong>QT Py SAMD21<br \/>\nXIAO-m0<\/strong><\/td>\n<td style=\"width: 22.3628%;\">48MHz<\/td>\n<td style=\"width: 23.6288%;\">24MHz (\u6ce81)<\/td>\n<td style=\"width: 20.6751%;\">12MHz<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\"><strong>ISP1807 MB<\/strong><\/td>\n<td style=\"width: 22.3628%;\">64MHz<\/td>\n<td style=\"width: 23.6288%;\">32MHz (\u6ce82)<\/td>\n<td style=\"width: 20.6751%;\">16MHz<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol>\n<li>Adafruit \u306eSAMD Boards BSP (1.3.9)\u3092\u4f7f\u3046\u306824MHz\u3001Arduino SAMD21 BSP(1.8.13)\u3067\u306f12MHz\u3068\u306a\u308b\u300224MHz\u306f<strong>SAMD21\u306eSPI\u30af\u30ed\u30c3\u30af\u306e\u30b9\u30da\u30c3\u30af\u3092\u8d85\u3048\u3066\u3044\u308b<\/strong>\u304c\u4e00\u5fdc\u52d5\u4f5c\u3057\u305f\u3002<\/li>\n<li><strong>MAX3421E\u306e\u30b9\u30da\u30c3\u30af\u3092\u8d85\u3048\u308b<\/strong>\u5024\u306b\u306a\u308b\u304c\u4e00\u5fdc\u52d5\u4f5c\u3057\u305f\u300232MHz\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u306f\u3001Adafruit nRF52\u306eSPI\u30e9\u30a4\u30d6\u30e9\u30ea(SPI.cpp)\u306e\u3001<span class=\"lang:default highlight:0 decode:true crayon-inline\">void SPIClass::setClockDivider(uint32_t div)<\/span> \u306e\u554f\u984c\u3068\u3044\u3046\u3088\u308a\u3001UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u5074\u306e\u914d\u616e\u306e\u306a\u3055\u306b\u3088\u308b\u3082\u306e\u3060\u308d\u3046\u3002<\/li>\n<\/ol>\n<h5>SPI\u30af\u30ed\u30c3\u30af\u306b\u3064\u3044\u3066\u306e\u4fee\u6b63<\/h5>\n<p>SAMD21\u3068ISP1807(nRF52)\u306eSPI\u30af\u30ed\u30c3\u30af\u304c\u30b9\u30da\u30c3\u30af\u3092\u5916\u308c\u3066\u3044\u308b\u306e\u306f\u56f0\u308b\u306e\u3067\u3001UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u5074\u3067\u5bfe\u5fdc\u3057\u305f\u3002<strong>src\/UHSLib2.0\/usbhost.h<\/strong> \u5185\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5b9a\u7fa9\u3092\u8ffd\u52a0\u3057\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true \">#if defined (__SAMD21G18A__) || defined(__SAMD21E18A__)\r\n\t#define SPI_CLOCK 12000000\r\n#elif defined(ARDUINO_NRF52_ADAFRUIT)\r\n\t#define SPI_CLOCK 16000000\r\n#else\r\n\t#define SPI_CLOCK 26000000\r\n#endif\r\n\r\n<\/pre>\n<p>\u305d\u3057\u3066\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u90e8\u5206\u3082SPI_CLOCK\u00a0 \u3092\u4f7f\u3046\u3088\u3046\u306b\u5909\u66f4\u3002\u3053\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u3053\u3067\u5b9a\u7fa9\u3057\u305f\u30af\u30ed\u30c3\u30af\u3067\u901a\u4fe1\u304c\u884c\u308f\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true\">#if defined(SPI_HAS_TRANSACTION)\r\n  USB_SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE0)); \/\/ The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0\r\n#endif\r\n<\/pre>\n<p>\u4eca\u56de\u5229\u7528\u3057\u305f AVR, SAMD21, nRF52\u306e\u5404SPI\u30e9\u30a4\u30d6\u30e9\u30ea (SPI.H)\u306f\u3001<span class=\"lang:default decode:true crayon-inline \">#define SPI_HAS_TRANSACTION 1 <\/span>\u00a0 \u3092\u542b\u3093\u3067\u3044\u308b\u3002<\/p>\n<h5>SAMD21 \u7528SPI\u306e\u30af\u30ed\u30c3\u30af\u306e\u30b9\u30da\u30c3\u30af\u3068\u6271\u3044\u306b\u3064\u3044\u3066<\/h5>\n<p>hoboNicola\u306eSAMD21\u5bfe\u5fdc\u3067\u306f\u3001Adafruit SAMD Boards BSP\u306b\u542b\u307e\u308c\u3066\u3044\u308bSPI\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u3002Adafruit\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f Arduino Zero\u7528\u306e\u53e4\u3081\u306eSPI\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u6d41\u7528\u3057\u3066\u3044\u308b\u3002\u30aa\u30ea\u30b8\u30ca\u30eb\u306e <a href=\"https:\/\/github.com\/arduino\/ArduinoCore-samd\/blob\/master\/libraries\/SPI\/SPI.h\" target=\"_blank\" rel=\"noopener\">ArduinoCore-samd<\/a>\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300c\u4fdd\u5b88\u7684\u306b\u300d\u4e0a\u965012MHz\u306b\u4fee\u6b63\u3055\u308c\u3066\u3044\u308b(SPI\/SPI.h)\u3002<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">#if defined(ARDUINO_ARCH_SAMD)\r\n  \/\/ The datasheet specifies a typical SPI SCK period (tSCK) of 42 ns,\r\n  \/\/ see \"Table 36-48. SPI Timing Characteristics and Requirements\",\r\n  \/\/ which translates into a maximum SPI clock of 23.8 MHz.\r\n  \/\/ Conservatively, the divider is set for a 12 MHz maximum SPI clock.\r\n  #define SPI_MIN_CLOCK_DIVIDER (uint8_t)(1 + ((F_CPU - 1) \/ 12000000))\r\n#endif<\/pre>\n<p>\u305d\u308c\u306b\u5bfe\u3057\u3066 Adafruit\u306eSPI.H\u3067\u306f\u3001\u300c\u697d\u89b3\u7684\u306b\u300d24MHz\u3092\u4e0a\u9650\u3068\u3057\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">  \/\/ The datasheet specifies a typical SPI SCK period (tSCK) of 42 ns,\r\n  \/\/ see \"Table 36-48. SPI Timing Characteristics and Requirements\",\r\n  \/\/ which translates into a maximum SPI clock of 23.8 MHz.\r\n  \/\/ We'll permit use of 24 MHz SPI even though this is slightly out\r\n  \/\/ of spec. Given how clock dividers work, the next \"sensible\"\r\n  \/\/ threshold would be a substantial drop down to 12 MHz.\r\n  #if !defined(MAX_SPI)\r\n    #define MAX_SPI 24000000\r\n  #endif\r\n  #define SPI_MIN_CLOCK_DIVIDER (uint8_t)(1 + ((F_CPU - 1) \/ MAX_SPI))<\/pre>\n<p>hoboNicola1.6.1\u3067\u306f\u3001UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u5074\u304b\u308912MHz\u3092\u4e0e\u3048\u308b\u3053\u3068\u306b\u3057\u3066Adafruit\u306eBSP\u306b\u542b\u307e\u308c\u308bSPI\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u305d\u306e\u307e\u307e\u4f7f\u3063\u3066\u6f5c\u5728\u7684\u306a\u554f\u984c\u304c\u751f\u3058\u306a\u3044\u3088\u3046\u306b\u3057\u305f\u3002\u3053\u306e\u3042\u305f\u308a\u306e\u8a71\u306f\u3001\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u3067\u8a66\u3057\u3066\u3044\u308b\u3068\u304d\u3001\u305f\u307e\u306b\u52d5\u304b\u306a\u3044\u3053\u3068\u304c\u3042\u3063\u305f\u306e\u3067\u78ba\u8a8d\u3057\u3066\u308f\u304b\u3063\u305f\u3053\u3068\u3002<\/p>\n<p>nRF52\u306e\u5834\u5408\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u3067\u30b3\u30a2\u30af\u30ed\u30c3\u30af=64M\u3068\u5b9a\u7fa9\u3055\u308c\u3066\u304a\u308a\u3001INT(64\u00f726) = 2 \u3068\u306a\u3063\u3066SPI\u30af\u30ed\u30c3\u30af\u306f32MHz\u304c\u63a1\u7528\u3055\u308c\u3066\u3057\u307e\u3046\u300216M\u3092\u4e0e\u3048\u308b\u3068\u30b3\u30a2\u30af\u30ed\u30c3\u30af\u306e1\/4\u306a\u306e\u306716MHz\u306b\u306a\u308b\u3002<\/p>\n<h3>SPI\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066<\/h3>\n<p>UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u304b\u3089\u306eMAX3421E\u306e\u30ec\u30b8\u30b9\u30bf\u64cd\u4f5c(\u66f8\u8fbc\u307f\u3001\u8aad\u51fa\u3057)\u306f\u3001\u304a\u3082\u306busbhost.h\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8MAX3421e\u306e static\u30e1\u30bd\u30c3\u30c9 <em>regWr()<\/em>\u3084<em>regRd()<\/em> \u3092\u4f7f\u3063\u3066\u884c\u308f\u308c\u3066\u304a\u308a\u3001\u3053\u308c\u3089\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u308b (hoboNicola\u3067\u4f7f\u308f\u308c\u306a\u3044\u90e8\u5206\u306f\u7701\u7565)\u3002<\/p>\n<pre class=\"lang:default decode:true\">template&lt; typename SPI_SS, typename INTR &gt;\r\nvoid MAX3421e&lt; SPI_SS, INTR &gt;::regWr(uint8_t reg, uint8_t data) {\r\n        USB_SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE0)); \/\/ \u8ee2\u9001\u8a2d\u5b9a\r\n        SPI_SS::Clear();          \/\/ \u30b9\u30ec\u30fc\u30d6\u30bb\u30ec\u30af\u30c8\r\n        uint8_t c[2];\r\n        c[0] = reg | 0x02;        \/\/ \u66f8\u8fbc\u307f\u306a\u306e\u3067bit1\u3092\u30bb\u30c3\u30c8\u3002\r\n        c[1] = data;              \/\/ \u30ec\u30b8\u30b9\u30bf\u306b\u66f8\u304f\u30c7\u30fc\u30bf\r\n        USB_SPI.transfer(c, 2);   \/\/ \u8ee2\u9001\u5b9f\u884c\r\n        SPI_SS::Set();            \/\/ \u30b9\u30ec\u30fc\u30d6\u30bb\u30ec\u30af\u30c8\u7d42\u4e86\r\n        USB_SPI.endTransaction(); \/\/ \u8ee2\u9001\u7d42\u4e86\r\n        return;\r\n};\r\n\r\ntemplate&lt; typename SPI_SS, typename INTR &gt;\r\nuint8_t MAX3421e&lt; SPI_SS, INTR &gt;::regRd(uint8_t reg) {\r\n        USB_SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE0)); \/\/ The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0\r\n        SPI_SS::Clear();                  \/\/ \u30b9\u30ec\u30fc\u30d6\u30bb\u30ec\u30af\u30c8\r\n        USB_SPI.transfer(reg);            \/\/ \u5bfe\u8c61\u30ec\u30b8\u30b9\u30bf\u3092\u66f8\u8fbc\u307f\r\n        uint8_t rv = USB_SPI.transfer(0); \/\/ \u8aad\u51fa\u3057\u6642\u306f 0 \u3092\u8ee2\u9001\u3002\r\n        SPI_SS::Set();                    \/\/ \u30b9\u30ec\u30fc\u30d6\u30bb\u30ec\u30af\u30c8\u7d42\u4e86\r\n        USB_SPI.endTransaction();\r\n        return (rv);\r\n}\r\n\r\n<\/pre>\n<p>SAMD21\u7248 (QT Py SAMD21) \u3067\u306e<em> regRd()<\/em> \u306e\u51e6\u7406\u6642\u9593\u304c\u3069\u308c\u304f\u3089\u3044\u304b\u3092\u30ed\u30b8\u30a2\u30ca\u3067\u89b3\u6e2c\u3057\u3066\u307f\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u3053\u308c\u3089\u306f<strong>\u30ec\u30b8\u30b9\u30bf#25(HIRQ)<\/strong>\u304b\u3089\u306e\u8aad\u51fa\u3057\u6642\u306e\u3082\u306e\u3067\u3001MAX3421E\u306b\u63a5\u7d9a\u3055\u308c\u305fUSB\u30d0\u30b9\u3084\u30c7\u30d0\u30a4\u30b9(\u30ad\u30fc\u30dc\u30fc\u30c9)\u306e\u72b6\u614b\u3092\u30dd\u30fc\u30ea\u30f3\u30b0\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3002<\/p>\n<figure id=\"attachment_14544\" aria-describedby=\"caption-attachment-14544\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/04\/samd_12_rd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"waku wp-image-14544 size-large\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/04\/samd_12_rd-552x368.png\" alt=\"\" width=\"552\" height=\"368\" \/><\/a><figcaption id=\"caption-attachment-14544\" class=\"wp-caption-text\">SAMD21 SPI Read1<\/figcaption><\/figure>\n<figure id=\"attachment_14545\" aria-describedby=\"caption-attachment-14545\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/04\/samd_12_rd2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"waku wp-image-14545 size-large\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/04\/samd_12_rd2-552x260.png\" alt=\"\" width=\"552\" height=\"260\" \/><\/a><figcaption id=\"caption-attachment-14545\" class=\"wp-caption-text\">SAMD21 SPI Read2<\/figcaption><\/figure>\n<p>\u6700\u521d\u304c\u524d\u306b\u66f8\u3044\u305f SAMD21\u5c02\u7528\u306e\u30dd\u30fc\u30c8\u64cd\u4f5c\u3067\u30012\u756a\u3081\u304cArduino\u306e <em>digitalWrite()<\/em> \u306a\u3069\u3092\u4f7f\u3063\u305f\u5834\u5408\u3002<\/p>\n<p>SS (Slave Select) == LOW \u306e\u671f\u9593\u304c 3.87usec\u30685.61usec\u3067\u3001\u7d041.8usec\u306e\u9055\u3044\u304c\u3042\u308b\u3002\u3053\u306e\u7a0b\u5ea6\u306e\u9055\u3044\u306a\u3089\u3070\u3001Arduino\u98a8\u306e\u66f8\u304d\u65b9\u306e\u65b9\u304c\u8aad\u307f\u3084\u3059\u304f\u3066\u826f\u3055\u305d\u3046\u3067\u3042\u308b\u3002\u306a\u304a\u30018\u30d3\u30c3\u30c8\u306e\u8ee2\u9001\u306b\u8981\u3059\u308b\u6642\u9593\u304c\u7d04660nsec\u306a\u306e\u3067\u30011\u30d3\u30c3\u30c8\u3042\u305f\u308a82.5nsec\u3001\u7d0412MHz\u30af\u30ed\u30c3\u30af\u3067\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u5206\u304b\u308b\u3002<\/p>\n<h4>nRF52\u306e\u65b9\u304c\u3082\u3063\u3068\u9045\u3044<\/h4>\n<p>SPI\u30af\u30ed\u30c3\u30af\u306fSAMD21\u304c12MHz\u3067nRF52\u304c16MHz\u306b\u8a2d\u5b9a\u3057\u305f\u3002\u3057\u304b\u3057\u306a\u304c\u3089\u3001SPI\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306b\u304b\u304b\u308b\u6642\u9593(SS=LOW\u671f\u9593)\u306fnRF52\u306e\u65b9\u304c\u9577\u3044\u3002<\/p>\n<figure id=\"attachment_14546\" aria-describedby=\"caption-attachment-14546\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/04\/isp1807_16_rd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"waku wp-image-14546 size-large\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/04\/isp1807_16_rd-552x269.png\" alt=\"\" width=\"552\" height=\"269\" \/><\/a><figcaption id=\"caption-attachment-14546\" class=\"wp-caption-text\">nRF52 SPI Read<\/figcaption><\/figure>\n<p>SAMD21\u3068\u540c\u3058\u72b6\u6cc1\u3067\u5f97\u305fSPI\u6ce2\u5f62\u3060\u304c\u3001\u3053\u3061\u3089\u306fSS=LOW\u671f\u9593\u304c 11usec\u3082\u3042\u3063\u3066\u3001SAMD21\u3067Arduino\u6d41\u306b\u66f8\u3044\u305f\u5834\u5408\u3088\u308a2\u500d\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3044\u308b\u300216MHz\u306a\u306e\u3067\u30af\u30ed\u30c3\u30af\u51fa\u529b\u671f\u9593\u306f3\/4\u7a0b\u5ea6\u306e\u6642\u9593\u3067\u53ce\u307e\u3063\u3066\u3044\u308b\u306e\u3060\u304c\u3001SS\u3092LOW\u306b\u3057\u3066\u304b\u3089\u30af\u30ed\u30c3\u30af\u51fa\u529b\u307e\u3067\u3068\u3001\u30ec\u30b8\u30b9\u30bf\u30a2\u30c9\u30ec\u30b9(0xC8)\u3092\u66f8\u3044\u3066\u8aad\u51fa\u3057\u7528\u30af\u30ed\u30c3\u30af\u51fa\u529b\u958b\u59cb\u307e\u3067\u306e\u3044\u305a\u308c\u3082\u304c\u9577\u3044\u3002<\/p>\n<p>\u4ee5\u4e0b\u306f\u3001\u540c\u3058\u30ec\u30b8\u30b9\u30bf\u306b\u5bfe\u3059\u308b<em>regWr()<\/em>\u306e\u5b9f\u884c\u6642\u3060\u304c\u3001\u3053\u3061\u3089\u306fSS=LOW\u671f\u9593\u304c6usec\u7a0b\u5ea6\u3067\u53ce\u307e\u3063\u3066\u3044\u308b\u304c\u3001\u306a\u304b\u306a\u304b\u30af\u30ed\u30c3\u30af\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u304c\u5206\u304b\u308b\u3002<\/p>\n<figure id=\"attachment_14555\" aria-describedby=\"caption-attachment-14555\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/04\/isp1807_16_wr.png\"><img loading=\"lazy\" decoding=\"async\" class=\"waku wp-image-14555 size-large\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2022\/04\/isp1807_16_wr-552x473.png\" alt=\"\" width=\"552\" height=\"473\" \/><\/a><figcaption id=\"caption-attachment-14555\" class=\"wp-caption-text\">nRF52 SPI Write<\/figcaption><\/figure>\n<p><em>regWr()<\/em>\u3067\u306f <em>USB_SPI.transfer()<\/em> \u306e\u547c\u3073\u51fa\u3057\u304c1\u56de\u3060\u3051\u306a\u306e\u306b\u5bfe\u3057\u3001<em>regRd()<\/em>\u3067\u306f2\u56de\u306b\u5206\u304b\u308c\u3066\u3044\u308b\u3002\u3069\u3046\u3084\u3089nRF52\u7528\u306eSPI\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u3001<em>USB_SPI.transfer()<\/em> \u306e\u547c\u51fa\u3057\u304b\u3089\u5b9f\u969b\u306b\u8ee2\u9001\u30af\u30ed\u30c3\u30af\u304c\u51fa\u529b\u3055\u308c\u308b\u307e\u3067\u306b\u3061\u3087\u3063\u3068\u6642\u9593\u304c\u304b\u304b\u308b\u3088\u3046\u3060\u3002\u3053\u306e\u3042\u305f\u308a\u306f\u8981\u691c\u8a0e\u9805\u76ee\u3068\u3057\u3066\u3044\u308b\u304c\u3001\u4eba\u9593\u306e\u6271\u3046\u30ad\u30fc\u30dc\u30fc\u30c9\u304c\u76f8\u624b\u306a\u306e\u3067\u9045\u3044\u3068\u304b\u3044\u3046\u30ec\u30d9\u30eb\u3067\u3082\u306a\u3044\u3060\u308d\u3046\u3002<\/p>\n<h1>\u304d\u3087\u3046\u306e\u307e\u3068\u3081<\/h1>\n<p>hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u5305\u542b\u3057\u305fUHS\u30e9\u30a4\u30d6\u30e9\u30ea (src\/UHSLib2.0) \u306f\u3001<a href=\"https:\/\/github.com\/felis\/USB_Host_Shield_2.0\" target=\"_blank\" rel=\"noopener\">USB Host Shield Library 2.0<\/a> \u306e1.6.1\u7248\u304b\u3089HID\u30ad\u30fc\u30dc\u30fc\u30c9\u7528\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u629c\u304d\u51fa\u3057\u305f\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u30b9\u30b1\u30c3\u30c1(.ino)\u304b\u3089 src\u5185\u306e uhslib2.h \u3092include\u3059\u308b\u3053\u3068\u3067\u3001Arduino IDE\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3057\u3066\u8ffd\u52a0\u3055\u308c\u305f UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u306a\u304f\u3001hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u306eUHSLib2.0\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u9078\u629e\u3055\u308c\u308b(\u306f\u305a)\u3002<\/p>\n<p>hoboNicola\u30a2\u30c0\u30d7\u30bf\u30fc\u3067\u306f\u3001\u4eca\u306e\u3068\u3053\u308dMAX3421E (\u3042\u308b\u3044\u306fMAX3421E\u304c\u8f09\u3063\u305f\u57fa\u677f\u3001\u30b7\u30fc\u30eb\u30c9)\u304c\u5fc5\u9808\u306a\u306e\u3060\u304c\u30012022\u5e744\u6708\u73fe\u5728\u3001MAX3421E\u81ea\u4f53\u304c\u54c1\u8584\u3067miniUHS\u3082\u54c1\u8584\u304b\u3064\u6d41\u901a\u5728\u5eab\u306e\u5024\u6bb5\u3082\u4e0a\u304c\u3063\u3066\u3044\u308b\u30022018\u5e74\u306b\u306f500\u5186\u304f\u3089\u3044\u3067\u8cb7\u3048\u305f\u306e\u306b\u4eca\u306f2000\u5186\u304f\u3089\u3044\u306e\u3088\u3046\u3060\u3002<\/p>\n<p>\u4e16\u306e\u4e2d\u306b\u306f\u3001<a href=\"https:\/\/github.com\/gdsports\/USB_Host_Library_SAMD\" target=\"_blank\" rel=\"noopener\">USB Host Library SAMD<\/a> \u3068\u3044\u3046 UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u3092SAMD(Cortex-m0\u30b3\u30a2)\u306b\u79fb\u690d\u3057\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u3082\u3042\u308b\u3088\u3046\u306a\u306e\u3067\u3001\u3053\u306e\u3042\u305f\u308a\u3082\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u3053\u308d\u3002\u3042\u308b\u3044\u306f\u3001\u4e2d\u56fd\u88fd\u306eCH559\u3092\u4f7f\u3063\u305fUSB\u30db\u30b9\u30c8\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3082\u3042\u308b\u3088\u3046\u3067\u3001\u3053\u3061\u3089\u306e\u65b9\u304c\u5b89\u3044\u3002\u3044\u305a\u308c\u306b\u3057\u308d\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5b89\u5b9a\u3057\u3066\u52d5\u304f\u3053\u308d\u306b\u306f MAX3421E\u3092\u4f7f\u3063\u305f\u30dc\u30fc\u30c9\uff0f\u30b7\u30fc\u30eb\u30c9\u306e\u5024\u6bb5\u304c\u5b89\u304f\u306a\u3063\u3066\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea1.6.1\u3067\u306f\u3001AVR(ATmega32U4)\u306e\u307b\u304b\u306b\u3001SAMD21\u3068ISP1807(nRF52840)\u3092\u4f7f\u3063\u305f\u30de\u30a4\u30b3\u30f3\u30dc\u30fc\u30c9\u306b\u5bfe\u5fdc\u3057\u305f (USB\u30a2\u30c0\u30d7\u30bf\u30fc\u7248)\u3002\u5bfe\u5fdc\u306b\u3042\u305f\u3063\u3066\u3001\u30de\u30a4\u30b3 &hellip; <a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=14534\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">hoboNicola\u30e9\u30a4\u30d6\u30e9\u30ea UHS\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4fee\u6b63<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[65,151,166,167,194,191],"class_list":["post-14534","post","type-post","status-publish","format-standard","hentry","category-programming","tag-arduino","tag-hobonicola","tag-miniuhs","tag-nrf52","tag-samd21","tag-spi"],"_links":{"self":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14534"}],"version-history":[{"count":0,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts\/14534\/revisions"}],"wp:attachment":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}