ããã«ã¡ã¯ã
ãã°ããã®éããã®ã¹ã¿ãã¯ããã®æ©èœãããã³nRF51822ãããã䜿çšããã¢ããªã±ãŒã·ã§ã³ã«é¢ããèšäºãæžãããšãèããŠããŸããã ãŸããæè¿ã®åºçç©ã TLE's BLE stack ãã«ãããç§ã¯åº§ã£ãŠã¢ã€ãã¢ãå ·äœçãªãã®ã«å€ããããšããŸããã
Nordic Semiconductorã¯ãç§ã®æèŠã§ã¯éåžžã«èå³æ·±ããœãªã¥ãŒã·ã§ã³ãæäŸããŸãã äžæ¹ã§ã¯ãARM Cortex-M0ã³ã¢ã«åºã¥ã匷åãªããããä»æ¹ã§ã¯ãåžžã«é²åããã¹ã¿ãã¯ã®ãœãããŠã§ã¢ãšSDKã«å«ãŸããã©ã€ãã©ãªã®ã»ããã
æ®å¿µãªããããã«ãã£ãã¯ã®BLEãããã¯ã«é¢ããHABRã«é¢ããèšäºã¯ãããŸãããä»ã®ã±ãŒã¹ã§ã¯ãRuNetã«ã¯äºå®äžãªãã®ã§ããã®èšäºãBLEã«é¢é£ããéšåã§ãã®äŒç€Ÿã®è£œåã䜿ãå§ãã人ã«åœ¹ç«ã€ããšãé¡ã£ãŠããŸãã Bluetoothãã¯ãããžãŒãç¹ã«BLEã奜ããªäººã
1.é
ã¡ã¢ãªãµã€ãºã®èŠ³ç¹ããæ€èšããŠããnRF51822ãããã¯ã3ã€ã®ããŒãžã§ã³ã§æäŸãããŠããŸãã
- 256KBãã©ãã·ã¥ããã³16KB RAMã
- 128KBãã©ãã·ã¥ãš16KBã®RAMã
- 256KBãã©ãã·ã¥ãš32KBã®RAMã
ãã®å ŽåãRAMã¯ãããã¯ã«åå²ãããåãããã¯ã«ã¯ç¬èªã®é»å管çããããŸãã ããããããã°ã©ãã³ã°ãããšããRAMã®äžååã¯åžžã«ã¢ããªã±ãŒã·ã§ã³ã«äœ¿çšãããäžååã¯åžžã«ã¹ã¿ãã¯ã«äœ¿çšãããããšãç¥ãå¿ èŠããããããããã«çŠç¹ãåœãŠãŸãã
ã¹ã¿ãã¯ã®ããŒãžã§ã³ã«ãã£ãŠã¯ãã¯ã©ã€ã¢ã³ããœãããŠã§ã¢ã®ããŠã³ããŒãã¢ãã¬ã¹ãå€ããå ŽåããããŸãã ããã«ã泚æãæãå¿ èŠããããŸãã ãœãããŠã§ã¢ã®ããŠã³ããŒãã¢ãã¬ã¹ãæ£ãããªãå Žåãããã°ã©ããŒã¯ãšã©ãŒãåºããŸããããã®èª¬æã§ã¯ãããããã©ãã·ã¥ã§ããªãã£ãçç±ãç解ã§ããŸããã ãœãããŠã§ã¢ããŠã³ããŒãã¢ãã¬ã¹ã¯ãã¹ã¿ãã¯ã®åããŒãžã§ã³ã®ä»æ§ã§æå®ãããŠããŸãã
ãããã£ãŠãNORDICã®BLEã䜿çšããå Žåã¯ããŸããããã°ãããã®1ã€ãè³Œå ¥ããå¿ èŠããããŸãã ãããã®ããã€ãã次ã«ç€ºããŸãã
-nRF51822è©äŸ¡ããã ïŒEKïŒ-nRF51822ãããã«åºã¥ãããè©äŸ¡ããã³ãããã¿ã€ãã³ã°çšã®ç¬ç«ãããã©ãããã©ãŒã ã
ãããã®å 容ïŒ
- ããããšããã¿ã³ãšLEDã®ãã¢ãåããããŒãã ããŒãã«ã¯ç¬èªã®åºæçªå·ãæã€Seggerã®ããã°ã©ããŒãããŸãããã®ããã°ã©ããŒã¯ããããããã°ã©ã ãããããã°ããç¹ã«UARTã䜿çšããŠnRF51822ãUSBçµç±ã§ã³ã³ãã¥ãŒã¿ãŒã«æ¥ç¶ã§ããŸãã
- nRF51822ããããšç¹å¥ãªNORDICãã¡ãŒã ãŠã§ã¢ãåããããŒããšã®éä¿¡ã«äœ¿çšãããSeggerããã°ã©ããŒãåããUSBãã³ã°ã«ã
-nRF51822éçºããã ïŒDKïŒ-ãã¹ã¿ãŒã¿ãŒããããã«äŸåãããã©ãããã©ãŒã ã«ãããBLEã ãã§ãªããnRF51822ãããã®ãã¹ãŠã®ãªãœãŒã¹ããã€ã¯ãã³ã³ãããŒã©ãŒãšããŠäœ¿çšããŠãæ¬æ Œçãªã¢ããªã±ãŒã·ã§ã³ãäœæã§ããŸãã
ãããã®å 容ïŒ
- nRF51822ãšPCBã¢ã³ãããåããããŒãã
- nRF51822ãšã¢ã³ããçšã³ãã¯ã¿ãåããããŒãã
- USBãã³ã°ã«ã¯EKãšåãã§ãã
- 5 nRF51822ããã;
- ããã°ã©ããŒ
ãšããã§ãã¯ãã ããŠã®äœ¿çšæ¹æ³ãç¥ã£ãŠããå ŽåããŸãã¯ãã¬ããããŒããšé ç·ãããå Žåããã¹ã¿ãŒã¿ãŒãããããžã®ãäŸåãã¯éèŠã§ã¯ãããŸããã
-nRF51822ã¹ã¿ãŒã¿ãŒããã ïŒSKïŒã¯ãEKãšDKãæ¥ç¶ããŠnRF51822ãããã®ãã¹ãŠã®æ©èœã䜿çšã§ããäžçš®ã®ããã¶ãŒããŒããã§ãã
ãããã«ã¯ãã±ãŒãã«ã»ããä»ãã®2ã€ã®ãã¶ãŒããŒããå«ãŸããŠããŸãã
æè¿ãäŒç€Ÿã¯EKãšDKã®äœ¿çšãæšå¥šããŠããŸããã æ°ãããããã°ãããã nRF51 DK ããšã nRF51ãã³ã°ã« ããç»å ŽããŸããããEKãšDKã¯åŠç¿ãšãããã¿ã€ãäœæã®ããã®éåžžã«åªããããŒã«ã§ãããšæããŸãã
çŸæç¹ã§ã¯ãç§ã®ã¿ã¹ã¯ã¯SKãªãã§nRF51822 DKã䜿çšããŠããŸãã DKããŒãã®ã³ãã¯ã¿ã®ãããã§ãæ¥ç¶ã¯ã€ã€ããã¬ããããŒãã䜿çšããŠåšèŸºæ©åšãæ¥ç¶ã§ããŸããããšãã°ãæ¥ç¶ã®æç¡ããšã©ãŒã瀺ãLEDã§ãã SKãªãã§DKã䜿çšããããšã®ç¹åŸŽã¯ãDKããŒãã«é»åãäŸçµŠããå¿ èŠãããããšã§ãããã®ããã«ã¯ãããŒãã®ã³ãã¯ã¿ã®ãã³é åãç¥ãå¿ èŠããããŸãã
ããã¥ã¡ã³ããnRF51822_Development_Kit_User_Guideãã«ãããŸãã STM32L152-DISCOVERYãããã°ã¢ãžã¥ãŒã«ãnRF51822ã®ãã¹ãŒããŒãã¹ãããšããŠäœ¿çšããŠããããããããã3.3Vã®é»åãäŸçµŠãããŸãã
ãã¥ã¢ã³ã¹ïŒã»ããã®1ã€ãè³Œå ¥ãããŸã§ãnRFgo StudioãœãããŠã§ã¢ãšãããã®ããã¥ã¡ã³ããé€ããä»æ§ãã¹ã¿ãã¯ããŸãã¯ãœãããŠã§ã¢ããµã€ãããããŠã³ããŒãã§ããŸããã
åãããã°ã»ããã«ã¯ããã®ã»ããã®ããã¯ã¹ã«æ¥çãããç¬èªã®äžæã®çªå·ïŒããŒïŒããããŸãã ããããè³Œå ¥ãããããµã€ãã«ç»é²ãããŠãŒã¶ãŒãããã¡ã€ã«ã®ããã¯ã¹ã«ç€ºãããŠããããŒãå ¥åããå¿ èŠããããŸãã ãã®åŸãå©çšå¯èœã«ãªããŸãïŒ
- 補åä»æ§;
- ãŠãŒã¶ãŒã¬ã€ãã
- ä»æ§ããã¡ãŒã ãŠã§ã¢ãAPIã¹ã¿ãã¯ã
- ãœãããŠã§ã¢
- ãåç §ã¬ã€ã¢ãŠãã;
2. NORDICãæäŸãããœãããŠã§ã¢
- SoftDevice S110ã¹ã¿ãã¯ïŒS120ãS130ïŒ-APIããããŒãã¡ã€ã«ãšãã¹ã¿ãã¯ã®ãã¡ãŒã ãŠã§ã¢ãå«ããã€ããªïŒHEXïŒãã¡ã€ã«ïŒã¹ã¿ãã¯ã®åã¿ã€ãããšã«ç¬èªã®HEXïŒãå«ãŸããŸãã ã¹ã¿ãã¯èªäœã®ãœãŒã¹ã³ãŒãã¯ãããŸããã
- nRF51 SDK-ã¹ã¿ãã¯ã®ããããŒAPIãã¡ã€ã«ãšãnRF51422ããã³nRF51822ãããã®ã¹ã¿ãã¯ããã³åšèŸºæ©åšãšã®äœæ¥ãç°¡çŽ åããããã®Cã©ã€ãã©ãªã®ãœãŒã¹ã³ãŒããå«ãŸããŠããŸãã
- ãã¹ã¿ãŒã³ã³ãããŒã«ããã«ïŒMCPïŒ-USBãã³ã°ã«ã§åäœããããã«èšèšããã32ãããããã³64ããããœãããŠã§ã¢ã§ãããã€ã¹ã®æ€çŽ¢ããµãŒãã¹ã®æ€åºããµãŒãã¹å±æ§ã®èªã¿åããBluetoothæ¥ç¶ã®ç¢ºç«ãããŒã¿ã®éåä¿¡ãå¯èœã«ããŸãã ãµãŒããŒã¢ãŒãã§ã¯ãBluetooth SIGãšç¬èªã®ãµãŒãã¹ã®äž¡æ¹ã§å®çŸ©ãããç¹æ§ãæã€ãµãŒãã¹ãäœæã§ããŸãã äžè¬ã«ãããã¯ã¯ã€ã€ã¬ã¹æ¥ç¶ã®äžæ¹ã§ãœãããŠã§ã¢ããããã°ããããã®ã¡ã€ã³ããã°ã©ã ã§ãã ãã¹ã¿ãŒã³ã³ãããŒã«ããã«ãã€ã³ã¹ããŒã«ãããšãããã¹ã¿ãŒãšãã¥ã¬ãŒã¿ãŒããšåŒã°ãããœãããŠã§ã¢ãã€ã³ã¹ããŒã«ãããŸãã ããã«ã€ããŠã¯ã»ãšãã©æžãããŠããŸããããå€ãã®éçºè ãæ°ã«å ¥ã£ãŠãããããããŸããã å®éãããã¯ãã¹ã¿ãŒããã€ã¹ã®åœ¹å²ãæã€PCçšã®.NETã¢ããªã±ãŒã·ã§ã³ãäœæã§ããAPIã§ãã
- nRFgo Studio-ã¹ã¿ãã¯ããã³ã¯ã©ã€ã¢ã³ããœãããŠã§ã¢ã®ãã©ãã·ã¥çšã«èšèšããã32ãããããã³64ããããœãããŠã§ã¢ã ãŸãããã®å©ããåããŠãSKãããã«å«ãŸãããã¶ãŒããŒãã®ãã¡ãŒã ãŠã§ã¢ãå€æŽã§ããŸãã ç¬èªã®UUIDãå«ããµãŒãã¹ãäœæããŸãã æ¥ç¶ã»ãã¥ãªãã£èšå®ã®æ§æãGAPãšåºåã®æ§æããããåšèŸºæ©åšã®æ§æããããã®ãšãã«ã®ãŒæ¶è²»éã®èšç®ãªã©ã
- nRF Sniffer-ããããã€ã¹ããå¥ã®ããã€ã¹ã«éä¿¡ããããã±ããã衚瀺ããããã®ãœãããŠã§ã¢ã
- nRF51-BLE-Driver-å®éãããã¯éåžžã®æå³ã§ã®ãã©ã€ããŒã§ã¯ãããŸããã ããã¯ãCèšèªã§ã¹ã¿ãã¯ã®APIãæäŸããDLLã§ãããããDKãŸãã¯EKã®äžéšã§ããUSBãã³ã°ã«ã«åã蟌ãããšãã§ããã¹ã¿ãã¯ãšéä¿¡ããPCã¢ããªã±ãŒã·ã§ã³ãäœæã§ããŸãã APIã¯ãããªãã§ã©ã«ããŒã«ã®ã¿ã®å®è£ ãæäŸããŸãã
- ãŸãããããã°ãããã䜿çšã§ããAndroidããã³iOSã¢ããªã±ãŒã·ã§ã³ã®ãœãŒã¹ã³ãŒããããŠã³ããŒãããããšãã§ããŸãã ã¢ããªã±ãŒã·ã§ã³èªäœã¯ãããããã®ã¢ããªã¹ãã¢ã§èŠã€ããããšãã§ããŸãã ã¢ããªã±ãŒã·ã§ã³ã䜿çšãããšãããšãã°ãç¡ç·ã«ãããã¡ãŒã ãŠã§ã¢ã®æŽæ°ïŒDFU-ããã€ã¹ãã¡ãŒã ãŠã§ã¢æŽæ°ãµãŒãã¹ïŒãŸãã¯Bluetoothçµç±ã®UARTã®åäœããã¹ãã§ããŸãã
3.éçºããŒã«
ããã°ã©ãã³ã°ã«ã¯ãææãšç¡æã®äž¡æ¹ã®éçºããŒã«ã䜿çšã§ããŸãã NORDICã¯ãKeil MDK-ARMãIARãããã³GCC ARMãšé£æºã§ããIDEã䜿çšããããšããå§ãããŸãã GCCã䜿çšããããã«ãEclipseãGCCãããã³GDBã䜿çšããéçºè åãã®ææ¡ã説æãããnAN-29 nRF51 Development with GCC and Eclipse Application Noteããšããããã¥ã¡ã³ããææ¡ãããŠããŸãã
NORDICã¯Keilã䜿çšããããšãæãŸãããšèããŠããããnRF51 SDKãã€ã³ã¹ããŒã©ãŒã§ãSDKãKeilã«çµ±åãããããã¢ããªã±ãŒã·ã§ã³ãããžã§ã¯ãã®äœæããã»ã¹ãç°¡çŽ åãããŸãã SDKã®ãã¹ãŠã®äŸã«ã¯ãKeil圢åŒã®ãããžã§ã¯ããã¡ã€ã«ããããŸãã
4. SoftDeviceãã¹ã¿ãã¯ãã
ã¹ã¿ãã¯ã«ã¯3ã€ã®ããŒãžã§ã³ããããŸãã
- S110 SoftDevice-ããã€ã¹ã«åšèŸºæ©åšïŒåšèŸºæ©åš/ãããŒããã£ã¹ã¿ãŒïŒã®åœ¹å²ãå¿ èŠãªå Žåã«äœ¿çšããããã«èšèšãããŠããŸãã
- S120 SoftDevice-ããã€ã¹ãäžå€®ããã€ã¹ïŒäžå€®/ãªãã¶ãŒããŒïŒã«ããå¿ èŠãããå Žåã«äœ¿çšããããã«èšèšãããŠããŸãã ãã®ã¹ã¿ãã¯ã¯ãåšèŸºæ©åšãšã®æ倧8ã€ã®åææ¥ç¶ããµããŒãã§ããŸãã
- S120 SoftDevice-ããã€ã¹ãåšèŸºæ©åšãšäžå€®æ©åšïŒäžå€®/åšèŸºæ©åš/æŸéå±/芳枬è ïŒã®äž¡æ¹ã§ããå Žåã«äœ¿çšããããã«èšèšãããŠããŸãã
ã¹ã¿ãã¯ãªãã·ã§ã³ã®APIã䜿çšãããšãBLEã³ã³ãããŒã©ãŒãšãã¹ãã®äž¡æ¹ãå¶åŸ¡ã§ããŸãã ãããã«å«ãŸãããã®ä»ã®åšèŸºæ©åšã ãããèšãæ¹ãæ£ç¢ºã§ããSoftDeviceã¹ã¿ãã¯ã䜿çšããå Žåãæ®ãã®åšèŸºæ©åšã¯ã¹ã¿ãã¯APIãä»ããŠå¶åŸ¡ãããäœããã€é©çšã§ããããå¶åŸ¡ããŸãã åœç¶ããããã¯éåžžã®ãã€ã¯ãã³ã³ãããŒã©ãŒã®ããã«ã¹ã¿ãã¯ãªãã§äœ¿çšã§ããŸãã
SDKã®æ¬¡ã®ããŒãžã§ã³ã®ãªãªãŒã¹æ å ±ã¯ãã¹ã¿ãã¯ã®ãµããŒããããŠããããŒãžã§ã³ãåžžã«ç€ºããŸãã ããã¯éåžžã«éèŠã§ãããªããªããããã°ã©ããæåã«çŽé¢ããã®ã¯ãSDKããŒãžã§ã³ãšSoftDeviceã®äžäžèŽãåå ã§ããã°ã©ã ããã©ãã·ã¥ã§ããªãããã§ãã ããšãã°ãSDKããŒãžã§ã³6.1.0ã¯æ¬¡ã®ã¹ã¿ãã¯ããŒãžã§ã³ã§åäœããŸããS110-7.0.0ã7.1.0ã S120-1.0.0ã
5.ãã¡ãŒã ãŠã§ã¢ã¹ã¿ãã¯ãšã¯ã©ã€ã¢ã³ãã¢ããªã±ãŒã·ã§ã³ã
ã¹ã¿ãã¯ããã€ããªãã¡ãŒã ãŠã§ã¢ãã¡ã€ã«ã®åœ¢åŒã§ã®ã¿æäŸããããšããäºå®ã«ãããåé¡ãçºçããŸããã¹ã¿ãã¯ãšããã°ã©ã ã®äž¡æ¹ãçž«ãå¿ èŠãããå Žåãããããã©ã®ããã«äœ¿çšãããïŒ
ãããã®2ã€ã®å³ãããããããã«ãã¹ã¿ãã¯ã¯ãã©ãã·ã¥ã¡ã¢ãªã®äžéšã«çž«ãä»ãããã0x2000000ããå§ãŸãRAMã®äžååã䜿çšããŸãã ã¢ããªã±ãŒã·ã§ã³ã¯ãã¢ãã¬ã¹CODE_R1_BASEãããã©ãã·ã¥ã¡ã¢ãªã«çž«ãä»ããããã¢ãã¬ã¹RAM_R1_BASEã®RAMã䜿çšããŸãã
å€æ°CODE_R1_BASEããã³RAM_R1_BASEã¯ãã¹ã¿ãã¯ã®ããŒãžã§ã³ã«ãã£ãŠç°ãªããŸãã
ã¹ã¿ãã¯ã¯ãnRFgo Studioãããã°ã©ã ã䜿çšããŠäžåºŠçž«è£œãããŸãããã®åŸãã¢ããªã±ãŒã·ã§ã³ãèšè¿°ããŠããnRFgo StudioããŸãã¯ãã䟿å©ã«Keilã䜿çšããŠçž«è£œã§ããŸãã
ã¹ã¿ãã¯HEXãã¡ã€ã«ã¯äžåºŠçž«è£œãããŸãããã®åŸãã¢ããªã±ãŒã·ã§ã³ãèšè¿°ãããnRFgo StudioããŸãã¯ãã䟿å©ãªKeilã§çž«è£œã§ããŸãã
S110 v.6.0.0ã¹ã¿ãã¯ã®Keilã®ã¡ã¢ãªæ§æã®äŸã次ã«ç€ºããŸãã
CODE_R1_BASEã¯0x16000ãRAM_R1_BASEã¯0x20002000ã§ã
次ã«ãS120 v.1.0.0ã¹ã¿ãã¯ã®Keilã¡ã¢ãªæ§æã®äŸã瀺ããŸãã
CODE_R1_BASEã¯0x18000ãRAM_R1_BASEã¯0x20002800ã§ã
6.çµè«
SDKã«ã¯ãnRF51822ãããã®äœ¿çšäŸãå€æ°ããããã€ã¯ãã³ã³ãããŒã©ãŒã ãã§ãªãã¹ã¿ãã¯ã䜿çšã§ããŸãã ãµã³ãã«ã®ãããã§ãSDKã®ãã¹ãŠã®è€éãã䞊è¡ããŠåŠç¿ããªããããããããã°ã©ãã³ã°ããã°ãããã¹ã¿ãŒã§ããŸãã
NORDICã¯ãã»ãšãã©ãã¹ãŠã®è³ªåã«å¯ŸããåçãåŸãããšãã§ããåªãããã©ãŒã©ã ãäœæããŸããã å€ãã®å ŽåãäŒç€Ÿã®åŸæ¥å¡ã¯èªåèªèº«ã§è³ªåã«ããªãæ©ãçããŸãã
æåŸãŸã§ç§ã®èšäºãèªãã§ãããŠããããšãã èå³ãããããµã³ãããã¯ã¹ã«ç®ãéãå Žåã¯ã次ã®èšäºã§ãSDKã¹ã¿ãã¯ã䜿çšããŠã¯ã©ã€ã¢ã³ããœãããŠã§ã¢ãå®è£ ããæ©èœã«ã€ããŠèª¬æããŸãã
Nordic Semiconductor補åã®éçºãšå¿çšã«ããã幞éãšæåããç¥ãããŸããç§ã¯åœŒãã®ãœãªã¥ãŒã·ã§ã³ãæ°ã«å ¥ã£ãŠããŸãã
ãæž èŽããããšãããããŸããã