Skip to content

Commit aa036df

Browse files
committed
Update readme.md
1 parent 76492f8 commit aa036df

File tree

1 file changed

+48
-18
lines changed

1 file changed

+48
-18
lines changed

documentation/libraries/BLE/readme.md

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
#BLE Library
22

3-
This library enables communication between Nordic Semiconductor's nRF8001 <em>Bluetooth</em>&#174; low energy (BLE) chip and an Arduino board.
4-
The functionality of the library is based on the ACI commands and Events of nRF8001 as described in the nRF8001 Product Specification(http://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF8001).
3+
This library enables communication between Nordic Semiconductor's nRF8001 <em>Bluetooth</em>&#174; low energy (BLE) chip and an Arduino board.The functionality of the library is based on the ACI commands and Events of nRF8001 as described in the nRF8001 Product Specification(http://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF8001).
54

6-
All Arduino boards have a SPI master interface with SS, MISO, MOSI, and SCK.
7-
The board communicates with nRF8001 through SS, MISO, MOSI, SCK, Pin 3, and Pin 4.
8-
* SS is connected to the REQN of the nRF8001 device.
9-
* Pin 3 is connected to the RDYN of the nRF8001 device.
10-
* Pin 4 is connected to the RESET of the nRF8001 device.
11-
* MISO, MOSI, and SCK are connected to MOSI, MISO, and SCK of the nRF8001 device.
5+
The SPI master interface of the Arduino is used to communicate to the nRF8001 SPI slave. The library allows you to set the pins that are connected to the nRF8001. The optional nRF8001 pins that are not connected should be set to UNUSED. The library also allows you to set the clock divider for the SPI master. The nRF8001 supports a maximum SPI clock of
6+
3 MHz. The library does not check for this limit and the user of the library must ensure that this is set correctly.
127

13-
The RDYN line of the nRF8001 device is an interrupt from nRF8001, when nRF8001 has information for the Arduino.
8+
The libray can be used in polled mode or in interrupt mode.
149

15-
If you use this library you cannot use Pins 3, 4 and 10 for digital input or output. Pins 11, 12, 13 can be shared with other SPI slave devices. The Arduino can use only one of the SPI slave devices at any given time. The Arduino should select the slave device by using the SS line of the slave device. The SS line of the nRF8001 device is the REQN line.
10+
The Arduino pin connected to the RDYN line can be set a wakeup source for the Arduino. This is useful when the Arduino goes to sleep to save power. This should be done by the user of the library, as the library itself does not support this feature.
11+
12+
The RDYN line of the nRF8001 device is an signal from the nRF8001, when nRF8001 has information for the Arduino.
13+
14+
If you use this library you cannot use the pins used for REQN, RDYN and ACTIVE for other devices/actions. The SPI pins can be shared with other SPI slave devices. The Arduino can use only one of the SPI slave devices at any given time. The Arduino should select the slave device by using the SS line of the slave device. The SS line of the nRF8001 device is the REQN line.
15+
16+
The library includes workarounds for the Redbearlab v1.1 and v2012.07 Arduino shields (REDBEARLAB_SHIELD_V1_1) as these did not use the Reset line of the nRF8001. The Redbearlab v2.0 Arduino shield addresses this issue and does not require the work arounds. The work arounds are turned on by looking at the board_name.
1617

1718
##Set up
1819

@@ -32,23 +33,52 @@ The set up parameters are in the services.h.
3233

3334
3435
Example call:
36+
37+
// services_pipe_type_mapping pipes and type of pipes from services.h / services_lock.h
38+
aci_state.aci_setup_info.services_pipe_type_mapping = &services_pipe_type_mapping[0];
39+
40+
// NUMBER_OF_PIPES in the setup created from services.h / services_lock.h
41+
aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES;
42+
43+
// pointer to set up messages from services.h / serivices_lock.h
44+
aci_state.aci_setup_info.setup_msgs = setup_msgs;
45+
46+
// Number of Setup messages from services.h / services_lock.h
47+
aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES;
48+
49+
//Tell the ACI library, the MCU to nRF8001 pin connections
50+
51+
aci_state.aci_pins.board_name = REDBEARLAB_SHIELD_V1_1; //Use BOARD_DEFAULT for other boards; //See board.h
52+
aci_state.aci_pins.reqn_pin = 9;
53+
aci_state.aci_pins.rdyn_pin = 8;
54+
aci_state.aci_pins.mosi_pin = MOSI;
55+
aci_state.aci_pins.miso_pin = MISO;
56+
aci_state.aci_pins.sck_pin = SCK;
57+
58+
aci_state.aci_pins.spi_clock_divider = SPI_CLOCK_DIV8;
59+
60+
aci_state.aci_pins.reset_pin = 4;
61+
aci_state.aci_pins.active_pin = UNUSED;
62+
aci_state.aci_pins.optional_chip_sel_pin = UNUSED;
63+
64+
aci_state.aci_pins.interface_is_interrupt = false;
65+
aci_state.aci_pins.interrupt_number = UNUSED;
3566
36-
aci_state.aci_setup_info.services_pipe_type_mapping = &services_pipe_type_mapping[0]; // services_pipe_type_mapping pipes and type of pipes from services.h
37-
aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES; // NUMBER_OF_PIPES in the setup created from services.h
38-
aci_state.aci_setup_info.setup_msgs = setup_msgs; // pointer to set up messages from services.h
39-
aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES; // Number of Setup messages from services.h
4067

41-
/** nRF8001 is reset here by toggling the RESET line connected to the nRF8001 device. // Pin 4 of Arduino is connected to RESET on the nRF8001 device
68+
/** nRF8001 is reset here by toggling the RESET line connected to the nRF8001 device.
69+
// Pin 4 of Arduino is connected to RESET on the nRF8001 device
4270
* and initializes the data structures required to set up the nRF8001 device.
4371
*/
4472
lib_aci_init(&aci_state);
4573
46-
The services_pipe_type_mapping, number_of_pipes, setup_msgs and num_setup_msgs must be set using the services.h generated from the XML file.
47-
The functions for the BLE library is defined in lib_aci.h.
74+
The services_pipe_type_mapping, number_of_pipes, setup_msgs and num_setup_msgs must be set using the services.h or services_lock.h generated
75+
from the nRFgo Studio. The services.h places the nRF8001 Setup in the RAM (volatile memoery) of the nRF8001 and the services_lock.h
76+
places the nRF8001 Setup in the NVRAM (non-volatile memory) of the nRF8001.
77+
The functions for the BLE library are defined in lib_aci.h.
4878
Documentation for the functions in the BLE library can be found [here](in_progress).
4979

5080

5181
##Troubleshooting:
5282

5383
The messages sent and received between the nRF8001 device can be printed on the serial port of the Arduino and monitored using the Serial Monitor in the Arduino IDE.
54-
Use utility function <<To be done>> to enable printing on the serial port.
84+
Use utility function lib_aci_debug_print to enable printing on the serial port of the Arduino.

0 commit comments

Comments
 (0)