background image

NRF52840 Eval Kit User Manual 

   

 

Vision: V1.0.1 Date: 2019.01.19 

 

 

12

  / 

72

 

 

 

Then click Flash Download, check the options as below and confirm by clicking 

OK. 

Summary of Contents for NRF52840

Page 1: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 1 72 NRF52840 Eval Kit User Manual...

Page 2: ...ded Studio for ARM 4 10a 7 Serial driver install 7 Install Jlink driver 8 Install nRFx Command Line Tools 9 Install APP 9 Peripherals demo 10 Hardware connection 10 Download samples without Softdevice...

Page 3: ...r 7 I2C 33 Scanning Slave devices 33 Read data from BME280 33 Read data from MPU6050 37 Hardware 38 Chapter 8 NFC 41 Codes 41 Hardware 43 Chapter 9 Bluetooth 44 Preparation 44 Install softdevice 44 Bl...

Page 4: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 4 72 Bluetooth Master Cardiotachometer 56 Master Slaver BLE Relay 58 Chapter 10 MESH 62...

Page 5: ...e up to 2Mbps the transfer distance is quadruple Based on the ARM Cortex M4F architecture the CPU frequency achieves up to 64MHz Bluetooth MESH1 and 2 4GHz radio are also available that means higher p...

Page 6: ...core module 8 CP2102 USB TO UART converter 9 Buzzer 10 RT9193 33 3 3V voltage regulator 11 Optical sensor 12 Keys RESET and USER KEY 13 LEDs PWR power indicator RXD TXD nRF52840 UART RX TX indicator...

Page 7: ...d also install related Packs The NRF52840 pack was already included in resources2 run NordicSemiconductor nRF_DeviceFamilyPack 8 17 0 to install it INSTALL SEGGER EMBEDDED STUDIO FOR ARM 4 10A This to...

Page 8: ...on board to PC INSTALL JLINK DRIVER JLink programmer is used to programming NRF52840 It can also be used to erase NRF52840Flash and upload Bluetooth Softdevices3 with nRF5x Command Line Tools We recom...

Page 9: ...successfully INSTALL APP App should be installed in mobile phones for debugging nRF Connect Common debugging tool of mobile phone With this APP use can get the original data nRF Connect can display RS...

Page 10: ...two kinds one of them can run without Softdevice and another are based on Softdevice The demo which does not need Softdevice generally located in nRF5_SDK_15 2 0_9412b96 examples peripheral HARDWARE...

Page 11: ...arn how to use peripherals examples of SDK Click blinky pca10056 blank arm5_no_packs blink_pca10056 uvoptx to open the project Compiling it Generally it can be compiled successfully without error or w...

Page 12: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 12 72 Then click Flash Download check the options as below and confirm by clicking OK...

Page 13: ...ples like the blinky you should first download softdevices which Bluetooth demo codes are based on Herein we take app_uart as example to show you how to program such demos First we need to erase NRF52...

Page 14: ...s below Download Softdevice Click nRF5_SDK_15 2 0_9412b96 examples ble_peripheral ble_app_uart pca10056 s140 arm5_no_packs ble_app_uart_pca10056_s140 uvprojx to open the project Choose flash_s140_nrf5...

Page 15: ...there is also template for reference nRF5_SDK_15 2 0_9412b96 examples ble_peripheral ble_app_template pca10056 s140 arm5_no_packs ble_app_template_pca10056_s140 uvprojx PROJECT TEMPLATE Generally the...

Page 16: ...integration and modules contains the new drivers TEMP Intermediate files generated while compiling The files in this folder can be deleted USER User files Generally files in folders SDK DRIVER and TE...

Page 17: ...2019 01 19 17 72 The drivers of user peripherals should be saved in DRIVER folder The projects created should be saved under USER and please notice the project name The application files are usually s...

Page 18: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 18 72 The Keil project file is saved in IDE folder Save OBJ files to TEMP folder...

Page 19: ...ual Vision V1 0 1 Date 2019 01 19 19 72 You had better set the project tree same as official projects Notice the PACK version you use make sure it is same as official examples For more details please...

Page 20: ...include nrf_gpio h define LED0 NRF_GPIO_PIN_MAP 0 13 define LED1 NRF_GPIO_PIN_MAP 0 14 define LED2 NRF_GPIO_PIN_MAP 0 19 define LED3 NRF_GPIO_PIN_MAP 0 16 void LED_On uint32_t led_number void LED_Off...

Page 21: ...nrf_delay_ms 500 LED_Off LED0 LED_Off LED1 LED_Off LED2 LED_Off LED3 nrf_delay_ms 500 HARDWARE CONNECTION According to the codes above we know that the four LEDs controlled should be connected to P0 1...

Page 22: ...anual Vision V1 0 1 Date 2019 01 19 22 72 The schematic of Eval board is as below Header 4x2 are jumpers on board If you use official SDK don t forget to pull L3 jumper and wire it to P0 15 Do not req...

Page 23: ...face CODES uart h ifndef _UART_H_ define _UART_H_ include nrf h include nrf_gpio h include app_uart h include nrf_uart h define RX_PIN_NUMBER NRF_GPIO_PIN_MAP 0 8 define TX_PIN_NUMBER NRF_GPIO_PIN_MAP...

Page 24: ...t if p_event evt_type APP_UART_COMMUNICATION_ERROR APP_ERROR_HANDLER p_event data error_communication else if p_event evt_type APP_UART_FIFO_ERROR APP_ERROR_HANDLER p_event data error_code main c incl...

Page 25: ...RROR_CHECK err_code printf r nUART example started r n while true uint8_t cr Get Data from the port while app_uart_get cr NRF_SUCCESS Then put data to the port while app_uart_put cr NRF_SUCCESS switch...

Page 26: ...n LED2 break case 6 printf r n LED2 OFF r n LED_Off LED2 break case 7 printf r n LED3 ON r n LED_On LED3 break case 8 printf r n LED3 OFF r n LED_Off LED3 break case q printf r n Exit r n while true c...

Page 27: ...ving data and if corresponding data are received LEDs will behavior according to it When 1 is received LED1 is on and turned off if receiving 2 Turn LED2 on if 3 and turn off if 4 similarly HARDWARE T...

Page 28: ...l Kit User Manual Vision V1 0 1 Date 2019 01 19 28 72 Note In official SDK CPRTS is defined as P0 05 however CPRTS is connected to P0 25 on NRF52840 Eval kit You need to modify the definition to P0 25...

Page 29: ...ude app_error h include string h include nrf_log h include nrf_log_ctrl h include nrf_log_default_backends h include spi h int main void APP_ERROR_CHECK NRF_LOG_INIT NULL NRF_LOG_DEFAULT_BACKENDS_INIT...

Page 30: ...ve OLED via SPI interface you should notice that 1 Do not use interrupt callback function when initializing SPI Doesn t print what to send or what received in SPI APP_ERROR_CHECK nrf_drv_spi_init spi...

Page 31: ...ngle_Command unsigned char cmd nrf_gpio_pin_clear DC if SPI is busy Frequently delay here nrf_delay_us 30 spi_write cmd sizeof cmd read void Single_Data unsigned char dt nrf_gpio_pin_set DC if SPI is...

Page 32: ...rein are different with official SDK if you use official SDK with NRF52840 Eval Kit don t forget to modify the pins SPI GPIO SPI_CS P1 12 SPI_MOSI P1 13 SPI_MISO P1 14 SPI_SCK P1 15 Loopback testing D...

Page 33: ...dress TWI_ADDRESSES address err_code nrf_drv_twi_rx m_twi address sample_data sizeof sample_data if err_code NRF_SUCCESS detected_device true device_address address NRF_LOG_INFO TWI device detected at...

Page 34: ...ction Data Start Write reg_addr Stop Start Read reg_data 0 Read Read reg_data len 1 Stop return rslt int8_t user_i2c_write uint8_t dev_id uint8_t reg_addr uint8_t reg_data uint16_t len int8_t rslt 0 R...

Page 35: ...false APP_ERROR_CHECK err_code err_code nrf_drv_twi_rx m_twi dev_id reg_data len APP_ERROR_CHECK err_code return err_code define MAX_WRITE_LENGTH 200 int8_t user_i2c_write u8 dev_id u8 reg_addr u8 re...

Page 36: ...lt bme280_crc_selftest dev if rslt 0 NRF_LOG_INFO BME280 self test pass r n NRF_LOG_FLUSH rslt bme280_init dev if rslt 0 NRF_LOG_INFO Init Success r n NRF_LOG_FLUSH else NRF_LOG_INFO Init Fail Please...

Page 37: ...IIC_Read_1Byte u8 SlaveAddress u8 REG_Address u8 REG_data ret_code_t err_code user_i2c_read SlaveAddress REG_Address REG_data 1 return err_code u8 IIC_Write_nByte u8 SlaveAddress u8 REG_Address u8 len...

Page 38: ...PIO SCL_PIN P0 27 SDA_PIN P0 26 The I2C pins can be re configured to others by modifying the codes define SDA_PIN NRF_GPIO_PIN_MAP 0 26 define SCL_PIN NRF_GPIO_PIN_MAP 0 27 Note Don t forget to change...

Page 39: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 39 72 Downloading 007_I2C BME280 codes data will be printed to OLED as below...

Page 40: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 40 72 Downloading 008_I2C MPU6050 3D COUBE Data will be printed as below The 3D figure display is not stable...

Page 41: ...P static const uint8_t m_windows_application_id e 1 2 d 2 d a 7 4 8 8 5 4 0 0 f b c d 4 6 c b d 5 b 8 c f 6 2 c Initializing callback function which will be execute when NFC objects are detected to tu...

Page 42: ...t2t_setup nfc_callback NULL APP_ERROR_CHECK err_code provide available buffer size for encoding function len sizeof m_ndef_msg_buf Encode launchapp message into buffer err_code nfc_launchapp_msg_encod...

Page 43: ...mpatible with official6 SDK NFC GPIO NFC_1_PIN P0 09 NFC_2_PIN P0 10 Testing Install nRF Toolbox APP in your phone Connect NFC coils and download the codes to eval board LED1 will be on if you close N...

Page 44: ...d MDK5 25 Jlink driver nRFx Command Line Tools nRF Toolbox mobile APPP Mobile phone which supports BLE INSTALL SOFTDEVICE To run the examples you need to first install Softdevice Erase Flash Install S...

Page 45: ...0 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 45 72 Open nRFToolbox software in your phone and enter UART Connect Nodic_UART device After connecting LED1 is on You can edit the figures and try...

Page 46: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 46 72 You can also send data directly on Show log...

Page 47: ...AGAINST LOSING Download Open the project SlaveDevice Bluetooth Proximity APP which located in Part 2 Bluetooth Slave Device USER Compile and download to eval board Expected result LED1 is lighted in...

Page 48: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 48 72 Open nRF Toolbox and clock UART Connect Nordic_UART device After connecting LED1 will light on The Toolbox will display as below...

Page 49: ...device Press button S1 of Eval Kit board music will be played in your phone and stopped if S1 is pressed again The software also prompt if you take the phone away from the Eval Kit board BLUETOOTH BE...

Page 50: ...xample is different with official examples line 74 77 APP_COMPANY_IDENTIFER change to 0X004c APP_MAJOR_VALUE change to 0x00 0x0A APP_MINOR_VALUE change to 0x00 0x07 APP_BEACON_UUID change to 0xFD 0xA5...

Page 51: ...shake Note The Web page detected is configurable for more details about it you can refer to official guide of WeChat https zb weixin qq com intro xhtml The testing ID used in the example is the open...

Page 52: ...basic protocol GATT of BLE to release interaction between HID host and Device Download Open the project SlaveDevice_bluetooth HIDS_MOUSE APP Compile and download to Eval Kit board Expected result Eval...

Page 53: ...for 5 pixels If your PC support BLE you can also used to control cursor on PC If you want to use the joystick of Arduino Accessory Shield you need to modify the definition of keys in pca10056 h WIREL...

Page 54: ...Expected result Eval Kit board broadcast and LED1 is blinking Open Bluetooth of your Phone search and connect Nordic_keyboard device After connecting LED1 is on Then you can try to input text Press KE...

Page 55: ...by software simulated which is based on Cycling Speed and Cadence profile Download Open the project Bluetooth CSCS APP Compile and download to Eval Kit board Expected result Eval Kit board is broadcas...

Page 56: ...t for this example one is used as master and another is slaver Download Open project Master Link To Slave By HRS Master compile and download it to one Eval Kit board Open project Master Link To Slave...

Page 57: ...7 72 Expected result The communication between two Eval Kit boards is as below After downloading the master will auto link to slaver LED1 are on if they connect successfully Slaver will send data to M...

Page 58: ...Kit board will connect to phone when work as slaver With BLE Relay example Eval Kit can receiver data from RSCS slaver and send it to mobile phone as below To complete this example you require two Ev...

Page 59: ...board it begin to broadcast and LED1 is blinking LED1 stay on if Sensor board connected to Master successfully Indicators of Relay Board Indicators Description LED1 On Master is scanning it keeps scan...

Page 60: ...19 60 72 Indicator of Sensor board Indicator Description LED1 Blinking Broadcasting On Connected Open nRF Toolbox on phone click RSC and Connect to nRF Relay device After connecting LED2 of Relay boar...

Page 61: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 61 72...

Page 62: ...ate of LED1 on the board Light Switch Client A minimalistic client that implements four instances of a Generic OnOff client model When a user presses any of the buttons an OnOff Set message is sent ou...

Page 63: ...tate is 1 true LED OFF Value of the OnOff state is 0 false Client During provisioning process LED3 and 4 blinking Device identification active LED1 to 4 Blink four times to indicate provisioning proce...

Page 64: ...rovisioning of the node is in progress LED OFF No ongoing provisioning process LED2 Reflects the state of the configuration LED ON Configuration of the node is in process LED OFF No ongoing configurat...

Page 65: ...it board for server One Eval Kit board for client One Eval Kit board for provisioner Software requirement 1 nRF Mesh SDK nrf5_SDK_for_Mesh_v2 2 0_src download and extract the SDK 2 BLE SDK nRF5_SDK_15...

Page 66: ...oard you want to use as client and which one as provisioner Open projects with SEGGER Embedded Studio for ARM 4 10a Provisioner MESH nrf5_SDK_for_Mesh_v2 2 0_src examples light_switch provisioner ligh...

Page 67: ...NRF52840 Eval Kit User Manual Vision V1 0 1 Date 2019 01 19 67 72 Compile projects Download projects You can also try to debug...

Page 68: ...nstances of the OnOff client models are instantiated on separate secondary elements For this reason they get consecutive addresses starting with 0x101 c Finally the provisioner picks up the available...

Page 69: ...LED1 on all servers with EVEN address iv Press Button4 on the client board to turn OFF LED1 on all servers with EVEN address g Press Button1 on the servers to locally change the state of LED1 and obs...

Page 70: ...ct to client and server 4 Configure client and server 5 Press Button1 on client board turns ON LED1 of server 6 Press Button2 on client board turns OFF LED1 of server Provisioner The provisioner confi...

Page 71: ...nt Together with light switch server and mesh provisioner it is part of the light switch example network demonstration in which it has a provisioner role Server The light switch server is a Generic On...

Page 72: ...Vision V1 0 1 Date 2019 01 19 72 72 client and mesh provisioner There can be one or more servers in this network for example light bulbs The provisioner configures this server model instance to commu...

Reviews: