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

SPI Sensor Application Using nRF51-DK

Hi all,

First of all, I'd like to express how pleased I am using this development kit. The easiest ever to start with, well documented and most importantly I can use the 32kB version of uVision and not to worry about licensing. Thank you guys.

Here I am seeking an advise that could help me to start with my design. I have a sensor, inclinometer, with SPI interface. My aim is to use DK and transmit X,Y registers to the mobile device. I tried almost all of the examples provided in SDK peripheral and ble_peripheral. So in order to succeed I guess I will need to implement some of the examples into a single design. I think about using an internal timer and read SPI data for example every 0.1s and modify a heart beat application just to receive raw data. However I am not sure whether it is the best approach, perhaps the UART example might be also good idea to receive serial data that could be seen on both PC and mobile device. All I need is X,Y coordinates on the phone so later on I can focus on building an application.

Can you suggest how would you do that, what example to use? I built similar application using ZigBee previously but this is the first time I am using BLE.

Thanks for any ideas.

Milan

Parents
  • You can set up a repetitive timer to call your function that peforms the sensor query over SPI. If a Central is connected, then you can cook up a Notify (or Indicate) packet and ship the data off. Testing on the smartphone end of things can be easily done with LightBlue or another free app.

    There is a maximum rate of generating these asynchronous notifications/indications to the Central but it depends on the phone. 18Hz is pretty safe with an iPhone 4S but you'll have to experiment.

    Dan

  • Thank you for reply Dan. I have set the RTC to the event timer and now running the simple uart whenever the tick occurs however I have found couple of issues with this setup. Would you be able to explain please? The RTC example won't run slower than the 8Hz frequency set by RTC_FREQUENCY only faster. This is due to the 12bit prescaler reaching max value 32768/8-1=4095 Can I set the timer for slower rate?

    The HWFC set to true in simple_uart_config is causing the timer to stop when UART not connected to the terminal. Changing to false sorts out the problem however UART is then always ON. Is there a way to keep flow control ON without stopping the counter?

    Regards, Milan

Reply
  • Thank you for reply Dan. I have set the RTC to the event timer and now running the simple uart whenever the tick occurs however I have found couple of issues with this setup. Would you be able to explain please? The RTC example won't run slower than the 8Hz frequency set by RTC_FREQUENCY only faster. This is due to the 12bit prescaler reaching max value 32768/8-1=4095 Can I set the timer for slower rate?

    The HWFC set to true in simple_uart_config is causing the timer to stop when UART not connected to the terminal. Changing to false sorts out the problem however UART is then always ON. Is there a way to keep flow control ON without stopping the counter?

    Regards, Milan

Children
No Data
Related