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

How do I make a BSP file for nRF52832 breakout?

Hi Everyone!

  I really need some help. So I'm new to Nordic semiconductors and Segger Embedded Studio IDE. I purchased myself an nRF52832 breakout from sparksfun and nRF52832 DK and I have downloaded Segger Embedded Studio IDE for the programming purpose. I have experience with Arduino MSP430 MCUs and this is the first time I'm trying your new board. I don't know much about modularization and layering programming. Where can I learn this since I realized the examples in the SDK are using this .. application layer, pheriparal layer, hal layer, lower layer?.

So this is what I want to do, I want to integrate  an LIS331HH accelerometer with the breakout and develop a wearable for a very important project. So I got started with the NRF52 DK looked through the examples given in the SDK on Blinky,I have only gone through the blinky example and already there are many files on the program like board.h board.c nRF_().c etc...How do I understand these. Is there any tutorial for this to understand?

..and I also realized there is s BSP file which is relevant for the DK, can someone tell me a way to intergrate the accelerometer.. do I need to create a separate BSP file if I were to program with the break out(of course the breakout doesn't have a programmer and I can use the nRF52 DK programmer)? How to build a BSP file ? Are there any tutorials on how to do it ? any easy methods?

how do I get it stated with SPI communication with the accelerometer? How do I build the configurations? and Once I program I want to see the acceleration on a display like serial monitor on Arduino.. are there any software to see this..?

I have an algorithm on how my application should work the techniques of getting the values from the accelerometer and decision making ect.. where should I write the algorithm files algo.c and algo.h .. should they be under main.c?

and this is sort of my strategy to build and finish this project . If you have any suggestion please feel free to give me some.. 

1. Develop the algo.h and algo.c

2. work on intergration of  the accelerometer using the SPI interface.

3. Triggering the decision made with thresholds and send via BLE to the mobile phone.

P.S : I went through your 7 videos on You Tube and those are the only start up tutorials available and those are the only availbale tutorials for this whole thing  and I don't know exactly how to use the documentation API infocenter.nordicsemi.com/index.jsp provided for this board.

I really like to learn this. Someone Pleeease Help!! I'm in a helpless position. 

Thank U!!

Parents
  • Hi,

    How do I understand these. Is there any tutorial for this to understand?

    The SDK includes the BSP library since it makes it easier to support a lot of different boards with the same example applications. The main part is the board files, which specifies which pins are used for buttons and LED's on the specific board. It also includes more advanced functionality, such as blinking LED's in specific patterns to signal different states. There is no need for using the BSP, so you can simply remove it from the example application that you are using. If the BSP confuses you, I suggest you simply do not use it (it is usually as simple as searching for anything BSP related in the example you are using and just removing it).

    However, if you want to use the BSP then you can look at the BSP documentation, and Adding support for a custom board.

    ..and I also realized there is s BSP file which is relevant for the DK, can someone tell me a way to intergrate the accelerometer.. do I need to create a separate BSP file if I were to program with the break out(of course the breakout doesn't have a programmer and I can use the nRF52 DK programmer)?

    The BSP is independent of the accelerometer. You just need to know which pins you have connected to the accelerometer and configure the TWI (I2C) or SPI driver accordingly (depending on which interface you want to use).

    how do I get it stated with SPI communication with the accelerometer? How do I build the configurations?

    You need to use the API's of the nRF5 SDK TWI or SPI driver to implement your own LIS331HH driver based on its datasheet.

    and Once I program I want to see the acceleration on a display like serial monitor on Arduino.. are there any software to see this..?

    I suggest you use the logger module, which is used extensively in most SDK examples.

    I have an algorithm on how my application should work the techniques of getting the values from the accelerometer and decision making ect.. where should I write the algorithm files algo.c and algo.h .. should they be under main.c?

    That is all up to you, and how you prefer to organize your code. However, I suggest you get the basics working first. That means:

    1. Familiarize yourself with the chip and SDK
    2. Implement SPI communication with the sensor, and test that it works. You can refer to the SPI Master Example.
    3. Test basic SPI communication.
    4. Implement a driver for the sensor, or integrate and existing driver if you have or can find one.
    5. Test
    6. Then you can move on to implementing your algorithm etc.
    P.S : I went through your 7 videos on You Tube and those are the only start up tutorials available and those are the only availbale tutorials for this whole thing  and I don't know exactly how to use the documentation API infocenter.nordicsemi.com/index.jsp provided for this board.

    I think the best way to learn is by learning by doing, so I suggest you test and modify examples. Then you will understand the documentation better, and it will be easier to move forward. There are also more text tutorials here on DevZone.

  • Hi

    Thank you for your response!

    So like you said I can neglect about the BSP part, is it necessary for me to create a new BSP  for the nrf52832 breakout board from Sparkfun (which is coded via the nRF52 DK since it doesn't have a built in programmer ) to communicate with the GPIO pins I'll be using to assign external LEDS(# 3 Leds) and a Button? Cus I have only experience assigning the LEDS and Buttons via GPIO by PIN and PORT numbers at the beginning of the main.c file for MSP430 . So is there any similar method to assign pins to the nrf52832 breakout board from Sparkfun?

    This was what I was meaning in the second quote of your answer.

    and If I were to do the following tasks for my applications which exact example reference from the SDK will be useful for me to catch up fast. Can you please direct me.

    1. Integration of LEDS and BUTTONS (Additionally assigned to the GPIO) to the  nrf52832 breakout board from Sparkfun

    2. Integration of the accelerometer LIS331HH via SPI (I have my reasons to choose SPI even though it can support I2C) with the  nrf52832 breakout board from Sparkfun

    3. Accessing interrupts of the accelerometer for my algo.. how do I interface that 

    4. Transfer  of data From the nrf52832 breakout board from Sparkfun to a raspberrypi via BLE.

    I really like this board I want to catch up faster. 

    It'll be great if you answer this too 

    Thank You!

    Please Help

  • Is there anyone who can help me with this!!

    I want to learn this..

  • Hi,

    christine_dev said:
    is it necessary for me to create a new BSP  for the nrf52832 breakout board from Sparkfun (which is coded via the nRF52 DK since it doesn't have a built in programmer ) to communicate with the GPIO pins I'll be using to assign external LEDS(# 3 Leds) and a Button?

    No, it is not necessary. If you want to do it, you can. Then you just take an existing board file (e.g. pca10040.h) and adapt it to your needs, and add it to boards.h.

    christine_dev said:
    Cus I have only experience assigning the LEDS and Buttons via GPIO by PIN and PORT numbers at the beginning of the main.c file for MSP430 .

    Then I suggest you continue to do it like that with the nRF5 SDK as well, by simply not using the BSP. The BSP is esnetially just a mapping of pins to button and LED numbers, with some additional functionality on top. Since you don't want or need it, you can skip it.

    christine_dev said:
    1. Integration of LEDS and BUTTONS (Additionally assigned to the GPIO) to the  nrf52832 breakout board from Sparkfun

    For LED's, you can simply configure the spesific GPIO pins as outputs, and write to them using nrf_gpio_cfg_output() and nrf_gpio_pin_set()/nrf_gpio_pin_clear(). For buttons, you can do something similar, but you probably want it interrupt-driven. Then you can look at the pin change interrupt example, or possibly also the button handling library (if you want debouncing handled for you).

    christine_dev said:
    2. Integration of the accelerometer LIS331HH via SPI (I have my reasons to choose SPI even though it can support I2C) with the  nrf52832 breakout board from Sparkfun

    Then you should refer to the SPIM documentation in the PS, and the SPIM driver documentation and example in the SDK. This will show you how to operate the SPIM master so that you can interface with the SPI slave device (which happens to be a LIS331HH).

    christine_dev said:
    3. Accessing interrupts of the accelerometer for my algo.. how do I interface that 

    You will probably want to use a separate GPIO pin for receiving the interrupts and have that trigger an interrupt. The pin change interrupt example demonstrates this.

    christine_dev said:
    4. Transfer  of data From the nrf52832 breakout board from Sparkfun to a raspberrypi via BLE.

    Please refer to the BLE examples. You can, for instance, start with the NUS peripheral example.

  • Thank You very much for your help!

    I really like your products! A lot to learn though! But you get a lot of experience.

Reply Children
No Data
Related