BLE Gateway Shield

From LinkSprite Playgound
Revision as of 11:08, 26 April 2016 by Alvin (talk | contribs) (Module Testing)
Jump to: navigation, search

Introduction

Bluetooth 4.0 BLE Gateway Shield is based on Nordic nRF51422, Arduino compatible. User can flexible uses Serial port by jumper cap. We also can burn Mbed BLE and S110 protocol by debug port.


1-225.png

Firmware burning

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:

(1)Preparation Tool

  • Jlink JTAG x 1
  • DuPont line x 4
  • BLE Gateway Shield x 1

(2)Firmware burning

Jlink pin figure

1-226.png

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) .

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

1-228.png

Project settings->Target Interface->SWD

File:1-229,png

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

Module 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 ) experimental phenomena and results

After we finished the firmware burn, open serial tool of Arduino IDE, for Android phone need download BLE Controller, iPhone need download Light Blue. 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