BLE gateway HAT for Raspberry pi

From LinkSprite Playgound
Jump to: navigation, search

Introduction

This is a Bluetooth module for raspberry pi, which uses the chip nRF51422, the factory firmware is set to transmit transparently mode. The module comes up with the download port, and you can re-burn the firmware. NRF51422 is a single chip solution which support multi-protocol. It is widely used in PC peripherals, Internet TV remote control, sports / fitness / health sensors, toys and automation applications.

Ble gateway HAT 2a.jpg

Ble gateway HAT 3a.jpg

Ble gateway HAT 4a.jpg

Ble gateway HAT 5a.jpg

Ble gateway HAT 6a.jpg

Features

  • Single chip, highly flexible, 2.4 GHz multi-protocol device
  • 32-bit ARM Cortex M0 CPU core
  • 256kB/128kB flash and 32kB/16KB RAM
  • Supports Bluetooth low energy protocol stacks
  • Thread safe and run-time protected
  • Event driven API
  • On air compatible with nRF24L series
  • 3 data rates (2Mbps/1Mbps/250kbps)
  • +4dBm output power
  • -93dBm sensitivity, Bluetooth low energy
  • PPI system for maximum power-efficient applications and code simplification
  • Flexible power management system with automatic power management of each periphera

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

Ble gateway HAT 7a.jpg

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

Raspberry pi transmit transparently testing

1. Insert the module on the UART port of raspberry pi, and note the insertion position.

Ble gateway HAT 1a.jpg

2.Steps and results :

Run the python program on Raspberry Pi, we will use Android phone for example, open BLE Controller, choose Simple Chat, then connect the gateway, we can send/receive data now.

Ble gateway HAT 8.png

Ble gateway HAT 9.png

Code:

import serial

port = "/dev/ttyAMA0"
usart = serial.Serial(port,9600)
usart.flushInput()
print ("serial test: BaudRate = 9600")
usart.write("please enter the character\n\r")
while True:
   if (usart.inWaiting()>0):
        s = usart.readline()
        print s

Documents

SimpleChat_NRF51_DK.hex