ãã®ããŒãã¯ãã¢ã³ãããšäžå¯Ÿã®æ°Žæ¶æ¯ååãåããã¯ãã ä»ããããã§ããNRF51822ã¢ãžã¥ãŒã«ã§ã®äœ¿çšãç®çãšããŠããŸãã ããŒããšã¢ãžã¥ãŒã«ã®ãããã®ã³ã¹ãã¯çŽ20ãã«ã§ãã
BLE400ã«ã¯ãCP2102ãããã«åºã¥ãUSBããŒããšUSB-UARTã³ã³ããŒã¿ãŒãå«ãŸããRXãTXãCTSããã³RTSä¿¡å·ãããŒãäžã«åºåãããŸãã åè·¯ã¬ãã«ã§ã¯ãNordicãããã°ããŒãã§ããPCA10001ãåãããŒãã«æ¥ç¶ãããLEDã®ãã¢ã2ã€ã®ãã¿ã³ãšéšåçã«äºææ§ããããŸããLEDãç¹æ» ãããã人ã®ããã«ãããã¯ç掻ãå°ã楜ã«ããŸãã æ®å¿µãªãããããŒãã¯nRF51822ããã°ã©ããŒã®åœ¹å²ãæããæ¹æ³ãç¥ããŸããããArduinoã¿ã€ãã®ããŒãããŒããŒã§åäœãããã¡ãŒã ãŠã§ã¢ããããŸãã ããŒãã«æ£ç¢ºã«çµã¿èŸŒãŸããŠãããã®ãç°¡åã«ãªã¹ãããŸããäžéšã¯ã ããããã®ããã¥ã¡ã³ãã®ç¿»èš³ã«ãªããŸã ã
- NRF51822ã¢ãžã¥ãŒã«ã®åº§åžãããŒã¯ãããŸãããã¢ãžã¥ãŒã«ã誀ã£ãŠæ¿å ¥ã§ããŸãããããããªãŒãéããããã¢ã³ãããéã«ãªããŸãã
- NRF51822ã¢ãžã¥ãŒã«ã®ãã³ãè€è£œãããããã¿ã€ãã³ã°ã«äŸ¿å©
- æ¥ç¶ã容æã«ããããã«ç«ã¡äžããããI2Cã€ã³ã¿ãŒãã§ã€ã¹ã¯ãSDAã³ã ããã®å¯Ÿå¿ããä¿¡å·ãè€è£œããŸã-P0.00 SCL-P0.01 SMBA-P0.02ããã³é»æºãWaveshareã®æ¢è£œã¢ãžã¥ãŒã«ã䜿çšã§ããŸã
- SPIã€ã³ã¿ãŒãã§ãŒã¹ãä¿¡å·MISO-P0.23 MOSI-P0.24 SCK-P0.25 NSS-P0.30
- é»æºã¯ãUSBçµç±ã§æ¥ç¶ããå Žåã5ãã«ãã®é»åã䜿çšã§ããŸããããããªãŒãšããã°ã©ããŒããã¯3.3ã®ã¿ãå©çšå¯èœã«ãªããŸãã é»æºã¯RT9193ã§æ倧é»æµ300mAã§äœæãããã¢ãžã¥ãŒã«èªäœã¯æ倧2mAãæ¶è²»ããæ倧5mAã®3ãã³ãŸãã¯15mAã®é»æµã§1ãã³ãè² è·ã«äŸçµŠããæºåãã§ããŠããŸãã åšåº«ã®åšèŸºãžã®åèš250 mA
- é»æºãæ¥ç¶ããããPCã«æ¥ç¶ãããããããã®ããUSBãžã£ãã¯ã 5ãã«ãã®ããŒãã¯é»æºã³ãŒã ã«çŽæ¥æ¥ç¶ãããŠããŸã
- ç°¡çŽ åãããSWDããã°ã©ãã³ã°ã€ã³ã¿ãŒãã§ã€ã¹ã 3.3vãSWDIOããã³SWCLKãæèŒ
- è€è£œãããUARTã¯ãCP2102ã«ãæ¥ç¶ãããŠãããä»®æ³COMããŒããä»ããŠPCã§ç£èŠã§ããŸãã RX-P0.05 TX-P0.06 CTS-P0.07 RTS-P0.12
- ã¹ã¿ã³ãã¢ãã³ãã¹ãã«åœ¹ç«ã€ããããªãŒãµã€ãºCR1225
- P0.18 P0.19 P0.20 P0.21 P0.22ã«æ¥ç¶ãããäžé£ã®LED è«çãŠããããç¹ç¯ããŠãããšãã«ç¹ç¯ããŸãã ããã§ã¯ãRXãTXãããã³SPDä¿¡å·ã®ã¢ã¯ãã£ããã£ã確èªã§ããŸã
- ããŒãP0.16ããã³P0.17ã«æ¥ç¶ããã2ã€ã®ãã¿ã³ã æŒããããšãè«ççãŒããäžãã
- ãªã»ãããã¿ã³ã SWDIOä¿¡å·ããŒãã«ããããšã«ããCP2102ããã³NRF51822ããªã»ããããŸã
- CP2102ã®ä»®æ³COMããŒãã³ã³ãããŒã©ãŒãDTRããã³DSRã¯ã¯ãã ä»ããããŠããŸãã
- CP2102ããUARTã€ã³ã¿ãŒãã§ã€ã¹ãç¡å¹ã«ãããžã£ã³ããŒ
- LEDããã³ãã¿ã³ãç¡å¹ã«ãããžã£ã³ããŒ
åœåããã®ã¢ãžã¥ãŒã«ã¯Nordic Semiconductorã®nRF Toolbox for BLEã䜿çšããããã®ã³ãŒãããã©ãã·ã¥ããŸãããããã¯æ©èœããã¹ãããã®ã«ååã§ãã ããŒããPCã«æ¥ç¶ããCP2102ã®ãã©ã€ããŒãã€ã³ã¹ããŒã«ããã¿ãŒããã«ã䜿çšããŠããŒãã«æ¥ç¶ããŸãã ç§ã¯ãPuTTYãããŒããã©ã¡ãŒã¿ã䜿çšããŸãããé床38400ã®æ¥ä»ããã8ãã¹ãããããã1ããœãããŠã§ã¢ãããŒå¶åŸ¡ã
æ¥ç¶ãããŠãããè±èªã®æåYãŸãã¯yã§ãã©ã€ãããŠãã端æ«ã§ãå¿çãšããŠStart ...ã³ãã³ããååŸããŸã-ã³ã³ãããŒã©ãŒã¯åäœããŸãã
çŸåšãNordic_UARTãšããååã®é»è©±æ©ã®BLEäºæããã€ã¹ã®ãªã¹ãã§äœ¿çšã§ããŸãã Androidã¢ããªã±ãŒã·ã§ã³ãã€ã³ã¹ããŒã«ããåŸãä»®æ³Bluetooth端æ«ãä»ãããã£ã©ã¯ã¿ãŒã®éä¿¡ãããã£ãŠãUARTã®ãšãã¥ã¬ãŒã·ã§ã³ããã¹ãã§ããŸãã
ããã°ã©ãã³ã°ã«é²ã¿ãŸãã ããã°ã©ããŒãå¿ èŠã§ããSeggerã®ãªãªãžãã«ã¯å°ãé«äŸ¡ã§ãããèªåè»æ奜家ã®ãããã§ãJ-link ARM v8ã¯ããŒã³ã¯åžå Žã§ååã§ãããç§ãã¡ã®ç®çã«ã¯çŽ15ãã«ä»¥äžããããŸãã ããã°ã©ããŒçšã®ãã©ã€ããŒïŒããšãã°ãJ-Link Software v4.52b +ïŒãæ¢ã«ã€ã³ã¹ããŒã«ãããŠãããšæ³å®ããŠããŸãã ããã°ã©ãããã®æšæºJTAGã±ãŒãã«ãŸãã¯4æ¬ã®ã¯ã€ã€ã§ããŒãã«æ¥ç¶ããŸããVTrefãGNDãSWDIOãSWCLKãæ¥ç¶ããã ãã§ãã
æ¥ç¶ããã¹ãããã«ã¯ãJLink.exeãå®è¡ããã€ã³ã¹ããŒã«ãããŠãããããã«é¢ããæ å ±ãååŸããŸã
SEGGER J-Link Commander V4.74b ('?' for help) Compiled Aug 19 2013 23:26:57 DLL version V4.74b, compiled Aug 19 2013 23:26:44 Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46 Hardware: V8.00 S/N: 20091135 Feature(s): RDI,FlashDL,FlashBP,JFlash,GDBFull VTarget = 3.293V Info: Found SWD-DP with ID 0x0BB11477 Info: FPUnit: 4 code (BP) slots and 0 literal slots Info: Found Cortex-M0 r0p0, Little endian. Found 1 JTAG device, Total IRLen = 4: Cortex-M0 identified. JTAG speed: 100 kHz
次ã®ãœãããŠã§ã¢ãå¿ èŠã§ã
Keil MDK-ARMã®LiteããŒãžã§ã³ãååŸããã«ã¯ãç»é²ãå¿ èŠã§ããæ®ãã¯æ¬¡ã®ããã«ããŠã³ããŒãã§ããŸãã Windows 10ã§ã¯nRFgo StudioããŒãžã§ã³1.21.2ã¯èµ·åããŸããã§ããããæ°ããããŒãžã§ã³1.15.1ã¯åäœããŸãã pca10001ããŒãããµããŒãããSDKã®ææ°ããŒãžã§ã³ã¯ããŒãžã§ã³6ã§ã ãªã³ã¯ãããŠã³ããŒãããŠãã ãã ã SDKãã€ã³ã¹ããŒã«ãããšãKeilç°å¢ãã€ã³ã¹ããŒã«ãããŠãããã©ã«ããŒã«ãå¿ èŠãªãã¹ãŠã®ãã¡ã€ã«ãå«ããã£ã¬ã¯ããª
\ARM\Device\Nordic\nrf51822
ã衚瀺ãããŸãã äŸã¯KeilããŒãžã§ã³4ã䜿çšããããã«èšèšãããŠããŸãããããžã§ã¯ããã¡ã€ã«ã«ã¯ãuvprojxæ¡åŒµã®ããKeil 5ãšã¯ç°ãªããuvprojæ¡åŒµããããŸãã å®éã«ã¯ãèšå®ãã¡ã€ã«ãšãµã³ãã«ã®äºææ§ã§æ··ä¹±ããªãããã«ãKeil 4ã䜿çšããŸãã
ããŒããããã°ã©ã ããã«ã¯ãJ-Link Commanderã³ã³ãœãŒã«ã ãã§ãªããnRFgo Studioã䜿çšããããšãã§ããŸããnRFgoStudioã䜿çšãããšãããããã¯ãªã¢ããããSoftDeviceãåã蟌ãã§Bluetoothã§åäœãããã§ããŸãã ããã¯ãnRF51ããã°ã©ãã³ã°ã¡ãã¥ãŒããè¡ããŸãã BLEã¹ã¿ãã¯ã®ã³ã¢ã¯ããã§ã«ãããã«ããµããŠããŸãã ã¡ãã¥ãŒé ç®ããã¹ãŠæ¶å»ãã䜿çšããŠæ¶å»ã§ããŸãã
次ã®ã¿ã¹ã¯ã¯ãããŒãã«æ éã«ã¯ãã ä»ããããLEDãç¹æ» ãããããšã§ãã æ¢ã«è¿°ã¹ãããã«ãLEDãšãã¿ã³ã¯Nordic pca10001ããŒããšäºææ§ããããããããããäŸã䜿çšããKeil4
\ARM\Device\Nordic\nrf51822\Board\pca10001\blinky_example\arm\
ã®ãã©ã«ããŒå ã®ãããžã§ã¯ããã¡ã€ã«blinky.uvprojãéããŸãã
F7ãæŒããŠãããžã§ã¯ããã¢ã»ã³ãã«ããã¡ãã¥ãŒã®Flash-> Downloadã§ãã©ãã·ã¥ããŸãã ããã©ã«ãã®JTAGå å¡«é床ã¯2000 kHzã§ãããããããã©ã«ãã§ã¯ç¹æ» ããŸããã§ããã ã¿ãŒã²ããã®ã¡ãã¥ãŒãªãã·ã§ã³->ãããã°->èšå®ããä¿®æ£ã§ããŸãã 100 kHzã«çœ®ãæããåŸããã¹ãŠãæ£åžžã«æ©èœããŸããã LED LED0ããã³LED1ãæ£åžžã«ç¹æ» ãããã€ã¯ãã³ã³ãããŒã©ãŒãæ©èœããŠããŸãã ããã§ãããŠã³ããŒãã§ããªãå Žåã¯ãnRFgo Studioã䜿çšããŠ
_build blinky_arm.hex
ãã©ã«ããŒããããŸãã¯J-Linkããã°ã©ããŒã³ã³ãœãŒã«ããHEXããã©ãã·ã¥ããŠã¿ãŠãã ããã ãã ããæåã«ãKeilã®èšå®ã§J-Linkããã°ã©ããŒãéžæãããŠããããšã確èªããå¿ èŠããããŸãã
LEDã¯åªããŠããŸãããBluetoothãå¿ èŠã§ããäœæ¥äŸã¯ã
\ARM\Device\Nordic\nrf51822\Board\pca10001\s110\ble_app_beacon
ã ãããiBeaconã®å®è£ ã§ããç§ãã¡ã«ãšã£ãŠãNordicã®ãœãããŠã§ã¢BLEã¹ã¿ãã¯ã䜿çšããã®ã¯èå³æ·±ãããšã§ãã ãã®äŸã¯ãæ©èœã®ç¹ã§æãåçŽãªs110ã¹ã¿ãã¯ããŒãžã§ã³çšã«èšèšãããŠããŸãããæ©èœãå®èšŒããã«ã¯ããã§ååã§ãã ã«ãŒãã«ã¯åå¥ã«ããŠã³ããŒãããå¿ èŠããããå€ãã®ããŒãžã§ã³ããããŸãããããããŒã®ããŒãžã§ã³ã¯ã«ãŒãã«ã®ããŒãžã§ã³ãšçžé¢ããå¿ èŠããããŸãã SoftDevicesã»ã¯ã·ã§ã³ã®ãªã³ã¯ããã«ãŒãã«ãããŠã³ããŒãã§ããŸãã
åœåãããŒãžã§ã³7.0.0ã®ããããŒãã¡ã€ã«ã«ã¯SDKãä»å±ããŠããŸãããããã®ã«ãŒãã«ããŒãžã§ã³ã¯ç§ã«ãšã£ãŠã¯èµ·åããŸããã§ããã çè«çã«ã¯ãã¹ã¿ãã¯ã®ã©ã®ããŒãžã§ã³ã§ãåäœããã¯ãã§ããããŒãžã§ã³v6ãv7ãv8ã¯ããŠã³ããŒãå¯èœã§ãã SDKã®äŸã§ã¯ãã¹ã¿ãã¯ã®7çªç®ãš8çªç®ã®ããŒãžã§ã³ãæ©èœããªãã£ãããã6.2.1ã§åæ¢ããŸããã
ã«ãŒãã«ãããŠã³ããŒãããŠãCores
ARM\Device\Nordic\nrf51822\Cores\6.2.1
ãªã©ã®äŸ¿å©ãªãã©ã«ããŒã«è§£åããŸãã æ¢åã®ãã©ã«ããŒ
\ARM\Device\Nordic\nrf51822\Include\s110
ãã¯ãªã¢ããã¢ã³ããã¯ãããã«ãŒãã«ã®includeãã©ã«ããŒããããããŒãã¡ã€ã«ãã³ããŒããŸãã
SoftDeviceããã©ãã·ã¥ããå¿ èŠããããŸããããã«ã¯nRFgo Studioã䜿çšããDevice Managerã¡ãã¥ãŒããnRF51 Programmingãéžæããããã°ã©ããŒãèœã¡ãªãããã«ããŸãã [ããã°ã©ã SoftDevice]ã¿ãã§ãã«ãŒãã«
\ARM\Device\Nordic\nrf51822\Cores\6.2.1\s110_nrf51822_6.2.1_softdevice.hex
ã®ãã¡ã€ã«ãéžæããŸãã 䜿çšãããŠãã容éã®äžã«æ£ãã圢åŒã®ãã¡ã€ã«ã衚瀺ãããå Žåããã®ããŒãžã§ã³ã®SoftDeviceã§ã¯80kbã§ãã
[ããã°ã©ã ]ãã¿ã³ãã¯ãªãã¯ããŸãã ããã€ã¹ã®ã¡ã¢ãªã«ãŒãã¯æ¬¡ã®ããã«ãªããŸãã
RAMã¯8kbå°ãªããªããã«ãŒãã«ã¯æ°žç¶ã¡ã¢ãªã®æåã®80ãããã€ããå æããŸããã ã¿ãŒã²ãããs110ã¹ã¿ãã¯ã®ã¿ãŒã²ããã«å€æŽããã¡ãã¥ãŒããnrf51822_xxaa_s110ïŒ256KïŒãéžæããŸã
SoftCoreã®ã€ã³ã¹ããŒã«æã«LEDãç¹æ» ããäŸãäœæããã«ã¯ãã¡ã¢ãªã«ãŒãã«ä¿®æ£ãå ¥åããå¿ èŠããããŸããããã¯ã[ã¿ãŒã²ããã®ãªãã·ã§ã³]-[ã¿ãŒã²ãã]ã¡ãã¥ãŒããè¡ããŸãã ããŒã¹ã¢ãã¬ã¹ã¯
CODE_R1_BASE = 0x00014000
å€æŽããã空ãã¡ã¢ãªã¯ã¢ãã¬ã¹0x20002000ããå§ãŸããŸãã
ã¹ã±ããã«èšå ¥ããéã«ã«ãŒãã«ãäžæžãããªãããã«ãããããããã°ã©ããŒã®èšå®ãå€æŽããŸãã ããã¯ã[ã¿ãŒã²ããã®ãªãã·ã§ã³-ãããã°]ã¡ãã¥ãŒã®[èšå®]ãã¿ã³ããè¡ããŸãã
ãããžã§ã¯ããã¢ã»ã³ãã«ããŠã³ã³ãããŒã©ãŒã«å ¥åããŸããã«ãŒãã«ãæ£ããã€ã³ã¹ããŒã«ãããŠããã°ãåãç¹æ» LEDã衚瀺ãããŸãã iBeaconãã·ãã¥ã¬ãŒããããã¡ãŒã ãŠã§ã¢ãã¢ããããŒããããã©ã«ããŒ
\ARM\Device\Nordic\nrf51822\Board\pca10001\s110\ble_app_beacon
ãããããžã§ã¯ããéããŸãã ç¹æ» ããLEDãšåæ§ã«ã¡ã¢ãªã«ãŒããå€æŽããåéããŠããã€ã¹ã«æžã蟌ã¿ãŸãã
ãã¹ãŠãæ£åžžã«å®è¡ãããå ŽåãLED0ãç¹ç¯ããŸããããã¯ããã±ãããéä¿¡ãããŠããããšã瀺ããŠããŸãã iBeaconã衚瀺ã§ããã¢ããªã±ãŒã·ã§ã³ãAndroidãŸãã¯iOSããã€ã¹ã«ã€ã³ã¹ããŒã«ããããŠã³ããŒãããŸãã
ããŒã³ã³ã¹ãã£ã㌠ã ããã€ã¹ã®UUIDã¯ãœãŒã¹ã³ãŒãã®å®æ°APP_BEACON_UUIDãšäžèŽããããããããããŒã³ã³ã§ãã
ååãšããŠããã®æ å ±ã¯ãBLEãè¿ éãã€éåžžã«å®äŸ¡ã«äœ¿çšããã«ã¯ååã§ãã æ¬ ç¹ãšããŠã¯ãæ代é ãã®Keil 4ãš100 kHz以äžã®åšæ³¢æ°ã§ã®äžå®å®ãªããã°ã©ããŒæäœããµããŒãããŸãã éçºç°å¢ã§ããŠã³ããŒããšã©ãŒãçºçããå Žåã¯ãã¢ã¯ã»ã¹é床ã50 kHz以äžã«äžããŠãã ããã ããã°ã©ããŒãèœã¡ãŠãJLink.exeãå®è¡ããã ãã§å ã«æ»ãããšãã§ããå ŽåããããŸããããã¯ãããããå ã®ã¯ããŒã³ã§ããããã§ãã