This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Receive BLE beacon on TWI from nrf51422

We have a new daughter board connected via I2C to an Atmel controller. What we need to do is load the right softstack onto the NRF and then send the needed commands to tell it to start advertising and whatever we need to do to receive any beacons it detects.

Is there a simple explanation of the steps needed and are there any similar example projects available ?

Parents
  • Hello.

    Let me split my answer into two parts, programming the nRF, and running the application.

    Running the application Here you have two choices. The first one is using the nRF as a pure connectivity chip. Here the nRF will be used as a pure BLE chip, and all the logic is done on the host MCU. (The Atmel chip). The other is to create the custom firmware on the nRF, and implement some simple communication over i2c. We do have example projects in the SDK you can base your project on in both cases.

    Programming You can program the nRF chip through the SWD interface with a normal programmer/debugger unit (from a PC). You use this to first program the softdevice (BLE stack), and then the application. You can also program the nRF through your main MCU if that is needed (this is more complicated). You can do this either through the SWD interface, or other serial interfaces (SPI, I2C, uart). If you need the latter, you must first flash the nRF with a Serial bootloader.

    What kind of board is the nRF51 chip on?

    Are you going to use this both as a beacon and beacon scanner, or just the scanner?

    If you are completely new to the nRF, i recommend you to check out the getting started page, as well as our tutorial page.

Reply
  • Hello.

    Let me split my answer into two parts, programming the nRF, and running the application.

    Running the application Here you have two choices. The first one is using the nRF as a pure connectivity chip. Here the nRF will be used as a pure BLE chip, and all the logic is done on the host MCU. (The Atmel chip). The other is to create the custom firmware on the nRF, and implement some simple communication over i2c. We do have example projects in the SDK you can base your project on in both cases.

    Programming You can program the nRF chip through the SWD interface with a normal programmer/debugger unit (from a PC). You use this to first program the softdevice (BLE stack), and then the application. You can also program the nRF through your main MCU if that is needed (this is more complicated). You can do this either through the SWD interface, or other serial interfaces (SPI, I2C, uart). If you need the latter, you must first flash the nRF with a Serial bootloader.

    What kind of board is the nRF51 chip on?

    Are you going to use this both as a beacon and beacon scanner, or just the scanner?

    If you are completely new to the nRF, i recommend you to check out the getting started page, as well as our tutorial page.

Children
  • Thanks for the information.

    We are just scanner. We want to operate at reduced power by controlling when we start announcing that we are a device and then retrieve and log a beacon. The board is designed and we have samples, and it has been passed to us programmers to implement this function. Especially in the short term, we want to verify that it will work in our enclosure as quickly as we can. The nRF51 chip is on a custom board attached via I2C bus that we can read and write, we can also program it through the SWD interface. We are assuming we will run the protocol using a softdevice stack that we prgram in the factory but we should also support over the air updates.

  • You mention "announcing that we are a device". This is announcing over BLE? If yes, this is called advertising, and it is the think that makes you visible to other BLE devices. Will this device be connected to other devices over BLE?

    If you want to test if the BLE part works in the enclosure, you can take a simple example application like the NUS example. Then you can add TWI communication using the TWI example, the TWI library or the TWI driver.

  • Thanks and sorry about the imprecise terminology. Advertising is what we want to do. We'll review your suggestions. Another challenge I just discovered is that we need to use bit banging to implement TWI slave side on this part.

  • I am working with peterv on this project and I just wanted to get clarification on some things. First, we are using the nRF51 to scan for beacons only. I think this means the nRF51 will not do any "advertising" itself. From what I have read so far, it sounds like we need to implement/use a broadcasting feature "scan for"/"observer"/"detect" any beacons around our device. S110 seems to be suited for just this role, is that correct? I briefly looked through the TWI links you sent, but have not looked through any of the SDK/softdevice sources yet, so I was wondering if there was somewhere specific to look for usage of the TWI library/driver?

  • You will then be an "observer", which is a device which scans for the advertisement packets of other devices (a beacon packet is a special advertisement packet). The s110 is not suited as it cannot take the "observer" role.You should use Softdevice S130.

    On the nRF51, you can assign i2c,SPI and UART pins at runtime. This means that you do not HAVE to use i2c, if your host controller can use the pins for other serial interfaces as well.

    It seems to me that you would benefit from learning a bit about BLE in general. This will help you understand our SDK and API's later on. I have linked some resources above. You can also check out our youtube channel, and other guides like this on on adafruit. This book is also worth a read.

Related