Difference between revisions of "BLE Gateway Shield"

From LinkSprite Playgound
Jump to: navigation, search
(Firmware flash)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
  
Bluetooth 4.0 BLE Gateway Shield is an addon that can turn pcDuino8 Uno into a Bluetooth 4.0 BLE gateway. It is using Nordic nRF51422 chipset and Arduino compatible. User have the flexibility to what serial ports (soft serial port or hard serial port on pcDuino) can be used to talk to the gateway by installing jumpers. User can also reflash the firmware of the nRF51422 chipset using the on-board debug headers. For example, user can choose to flash the chipset with [http://linksprite.com/wiki/index.php5?title=Mbed_BLE_Sensors_Tag  MBED BLE and S110 protocol].
+
Bluetooth 4.0 BLE Gateway Shield is an addon that can turn pcDuino8 Uno into a Bluetooth 4.0 BLE gateway. It is using Nordic nRF51422 chipset and Arduino compatible. User have the flexibility to what serial ports (soft serial port or hard serial port on pcDuino) can be used to talk to the gateway by installing jumpers. User can also reflash the firmware of the nRF51422 chipset using the on-board debug headers. For example, user can choose to flash the chipset with [http://linksprite.com/wiki/index.php5?title=Mbed_BLE_Sensors_Tag  MBED BLE and S110 protocol].
  
  
  
[[File:1-225.png]]
+
[[File:1-266.jpg| 640px]]
 +
 
 +
[[File:1-267.jpg| 640px]]
  
 
== Features ==
 
== Features ==
  
*1、NRF51822 Bluetooth Low Energy & 2.4GHz Wireless SOC
+
*NRF51822 Bluetooth Low Energy & 2.4GHz Wireless SOC
*2、MBED program compatible  
+
*MBED program compatible  
*3、4 x Debug PIN
+
*Debug headers
*4、arduino and PCduino compatible,serial port communication
+
*Arduino and pcDuino compatible serial port communication
*5、Soft serial-port and Hard serial portis available.
+
*Soft serial-port and Hard serial port available.
  
 +
== Firmware flash ==
  
== Firmware burning ==
+
All BLE gateway shield comes with a gateway firmware pre-installed.
  
We need to burn a Bluetooth communication firmware into the BLE Gateway to communicating Arduino. We use Jlink to burn the firmware. Specific steps as follows:
+
If we need to reinstall the firmware to the bluetooth shield. Please follow the following steps:
  
(1)Preparation Tool
+
To flash the firmware the bluetooth chipset, we use Jlink to burn the firmware.
 +
 
 +
1)Preparation Tool
  
 
*Jlink JTAG x 1
 
*Jlink JTAG x 1
*DuPont line x 4
+
*Jumper wires x 4
 
*BLE Gateway Shield x 1
 
*BLE Gateway Shield x 1
  
(2)Firmware burning  
+
2)Firmware burning
  
Jlink pin figure
+
Jlink pins definition:
  
 
[[File:1-226.png]]
 
[[File:1-226.png]]
Line 34: Line 39:
 
[[File:1-227.png]]
 
[[File:1-227.png]]
  
The VCC, GND, SWIO, SWCLK of jlink were connected with Connecting Jlink JTAG’s VCC, GND, SWIO, SWCLK to corresponding pins of BLE Gateway Shield (some jlink JTAG DOESN’T have power output, we need provide power separately) .
+
Connecting Jlink JTAG’s VCC, GND, SWIO, SWCLK to corresponding pins of BLE Gateway Shield (some jlink JTAG DOESN’T have power output, we need provide power separately) .
  
Open J-Flash software->Option->Project settings->CPU->Device->Nordic Semi
+
Open J-Flash software->Option->Project settings->CPU->Device->Nordic Semi nRF51422_xxAA
nRF51422_xxAA
 
  
 
[[File:1-228.png]]
 
[[File:1-228.png]]
Line 43: Line 47:
 
Project settings->Target Interface->SWD
 
Project settings->Target Interface->SWD
  
[[File:1-229,png]]
 
  
 
File->Open data file->nRF51822_SimpleChat_NRF51_DK.hex
 
File->Open data file->nRF51822_SimpleChat_NRF51_DK.hex
Line 49: Line 52:
 
[[File:1-230.png]]
 
[[File:1-230.png]]
  
The resulting configuration is complete , After configuration completed, press F5 to download , waiting for the download to complete . As shown below:
+
The resulting configuration is complete. After configuration completed, press F5 to download , waiting for the download to complete . As shown below:
  
 
[[File:1-231.png]]
 
[[File:1-231.png]]
  
== Module Testing ==
+
Gateway Testing
  
 
(1)Preparation Tool
 
(1)Preparation Tool
  
*Arduino UNO x 1
+
Arduino UNO x 1
*BLE Gateway Shield x 1
+
 
*iphone/Android phone x 1
+
BLE Gateway Shield x 1
  
 +
iphone/Android phone x 1
  
 
(2)program
 
(2)program
Line 66: Line 70:
 
The BLE Gateway Shield connected to the Arduino UNO, Connecting BLE Gateway Shield to Arduino then burn the program.
 
The BLE Gateway Shield connected to the Arduino UNO, Connecting BLE Gateway Shield to Arduino then burn the program.
  
  byte inbuff[100];
+
byte inbuff[100];
  byte outbuff[100];
+
byte outbuff[100];
  // Baud Rate
+
// Baud Rate
  #define BaudRate 9600
+
#define BaudRate 9600
  //#if defined SOFTUART
+
//#if defined SOFTUART
  #include <SoftwareSerial.h>
+
#include <SoftwareSerial.h>
  SoftwareSerial mySerial(2, 3); // UNO RX=D5, TX=D6
+
SoftwareSerial mySerial(2, 3); // UNO RX=D5, TX=D6
  //SoftwareSerial mySerial(10, 6); // MEGA RX=D10, TX=D6
+
//SoftwareSerial mySerial(10, 6); // MEGA RX=D10, TX=D6
  //#endif
+
//#endif
  void setup() {
+
void setup() {
  Serial.begin(BaudRate);
+
Serial.begin(BaudRate);
  while (!Serial) ;   // Leonardo
+
while (!Serial) ;   // Leonardo
  //#if defined SOFTUART
+
//#if defined SOFTUART
    mySerial.begin(BaudRate);
+
  mySerial.begin(BaudRate);
  //#endif
+
//#endif
 +
}
 +
void loop() {
 +
  int i=0,x=0;
 +
  while (Serial.available()) {
 +
    inbuff[i]=Serial.read();
 +
    i++;
 +
  }
 +
  for(x=0;x<i;x++){
 +
    mySerial.write(inbuff[x]);
 +
  }
 +
int j=0;
 +
while (mySerial.available()) {
 +
outbuff[j]=mySerial.read();
 +
    j++;
 
   }
 
   }
   void loop() {
+
   for(x=0;x<j;x++){
    int i=0,x=0;
+
    Serial.write(outbuff[x]);  
    while (Serial.available()) {
 
      inbuff[i]=Serial.read();
 
      i++;
 
    }
 
    for(x=0;x<i;x++){
 
      mySerial.write(inbuff[x]); 
 
    }
 
  int j=0;
 
  while (mySerial.available()) {
 
  outbuff[j]=mySerial.read();
 
    j++;
 
  }
 
  for(x=0;x<j;x++){
 
    Serial.write(outbuff[x]); 
 
  }
 
 
   }
 
   }
 +
}
 +
( 3 ) Steps and results
  
( 3 ) experimental phenomena and results
+
After we finished the firmware burn, open serial tool of Arduino IDE.
  
After we finished the firmware burn, open serial tool of Arduino IDE, for Android phone need download BLE Controller, iPhone need download Light Blue.
+
Install BLE controller APP on Android phone. User Light Blue on iPhone.
Android phone for example, open BLE Controller, choose Simple Chat, then connect the gateway, we can send data now.
+
 
 +
In this tutorial, we will use Android phone for example, open BLE Controller, choose Simple Chat, then connect the gateway, we can send data now.
  
 
[[File:1-232.png]]
 
[[File:1-232.png]]
  
 
[[File:1-233.png]]
 
[[File:1-233.png]]
 
  
 
== Documents ==
 
== Documents ==
  
 
[https://s3.amazonaws.com/linksprite/nRF51822_SimpleChat_NRF51_DK/nRF51822_SimpleChat_NRF51_DK(1).hex nRF51822_SimpleChat_NRF51_DK]
 
[https://s3.amazonaws.com/linksprite/nRF51822_SimpleChat_NRF51_DK/nRF51822_SimpleChat_NRF51_DK(1).hex nRF51822_SimpleChat_NRF51_DK]

Latest revision as of 07:37, 13 June 2017

Introduction

Bluetooth 4.0 BLE Gateway Shield is an addon that can turn pcDuino8 Uno into a Bluetooth 4.0 BLE gateway. It is using Nordic nRF51422 chipset and Arduino compatible. User have the flexibility to what serial ports (soft serial port or hard serial port on pcDuino) can be used to talk to the gateway by installing jumpers. User can also reflash the firmware of the nRF51422 chipset using the on-board debug headers. For example, user can choose to flash the chipset with MBED BLE and S110 protocol.


1-266.jpg

1-267.jpg

Features

  • NRF51822 Bluetooth Low Energy & 2.4GHz Wireless SOC
  • MBED program compatible
  • Debug headers
  • Arduino and pcDuino compatible serial port communication
  • Soft serial-port and Hard serial port available.

Firmware flash

All BLE gateway shield comes with a gateway firmware pre-installed.

If we need to reinstall the firmware to the bluetooth shield. Please follow the following steps:

To flash the firmware the bluetooth chipset, we use Jlink to burn the firmware.

1)Preparation Tool

  • Jlink JTAG x 1
  • Jumper wires x 4
  • BLE Gateway Shield x 1

2)Firmware burning

Jlink pins definition:

1-226.png

1-227.png

Connecting Jlink JTAG’s VCC, GND, SWIO, SWCLK to corresponding pins of BLE Gateway Shield (some jlink JTAG DOESN’T have power output, we need provide power separately) .

Open J-Flash software->Option->Project settings->CPU->Device->Nordic Semi nRF51422_xxAA

1-228.png

Project settings->Target Interface->SWD


File->Open data file->nRF51822_SimpleChat_NRF51_DK.hex

1-230.png

The resulting configuration is complete. After configuration completed, press F5 to download , waiting for the download to complete . As shown below:

1-231.png

Gateway Testing

(1)Preparation Tool

Arduino UNO x 1

BLE Gateway Shield x 1

iphone/Android phone x 1

(2)program

The BLE Gateway Shield connected to the Arduino UNO, Connecting BLE Gateway Shield to Arduino then burn the program.

byte inbuff[100];
byte outbuff[100];
// Baud Rate
#define BaudRate 9600
//#if defined SOFTUART
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // UNO RX=D5, TX=D6
//SoftwareSerial mySerial(10, 6); // MEGA RX=D10, TX=D6
//#endif
void setup() {
Serial.begin(BaudRate);
while (!Serial) ;   // Leonardo
//#if defined SOFTUART
  mySerial.begin(BaudRate);
//#endif
}
void loop() {
  int i=0,x=0;
  while (Serial.available()) {
    inbuff[i]=Serial.read();
    i++;
  }
  for(x=0;x<i;x++){
    mySerial.write(inbuff[x]); 
  }
int j=0;
while (mySerial.available()) {
outbuff[j]=mySerial.read();
   j++;
 }
 for(x=0;x<j;x++){
   Serial.write(outbuff[x]); 
 }
}

( 3 ) Steps and results

After we finished the firmware burn, open serial tool of Arduino IDE.

Install BLE controller APP on Android phone. User Light Blue on iPhone.

In this tutorial, we will use Android phone for example, open BLE Controller, choose Simple Chat, then connect the gateway, we can send data now.

1-232.png

1-233.png

Documents

nRF51822_SimpleChat_NRF51_DK