This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF51822 "target folder" in mbed? (Really, how to live with the mbed API)

Folks,

Newbie here with mbed, using nRF51-DK, but old hand with nRF51822, S110, SDK, J-Link, Keil MDK, etc. Trying to figure out how the mbed SDK API maps down onto the nRF51288 hardware.

For example, the standard mbed "Blinky" app contains the line:

DigitalOut myled(LED1);

Where is LED1 defined? If I click on it, I get four(!) suggestions:

image description

Looks like the last one is the correct one (from the platform page for the nRF51-DK on the mbed site, which shows LED 1 on P21. But where is the source for anon519? And how would I know it's the correct one without additional info?

Searching through the mbed forum for "gpio", "pinout", etc., came across a message for another vendor's platform that referred to a pinouts.h file in "the target folder" for their platform. Where's the "target folder" when I select the nRF51-DK as my "mbed target". How would I go about finding it?

Since my ultimate target is a variation on the nRF51-DK, I'd like to deal with a number of other hardware configuration issues. Is it possible to deal with them by modifying the existing implementation of the nRF51-DK as an "mbed platform", or am I essentially required to do a full "port" of the mbed platform for my modified board?

For example, the following issues come up when trying to use the standard mbed SDK with the nRF51822:

  • The chip GPIO lines have lots of configuration settings: low or high drive, pull up or down resistors, interrupt capability., etc. How do I configure that with (or in spite of) the mbed GPIO API?
  • One of the neat features of the nRF51822 is the GPIO crossbar. But the mbed platform page shows peripherals like the UART assigned to fixed GPIO ports. How to change this?
  • Heaven forbid I try to use shortcuts, GPIOTE and PPI with mbed. Any hope here?
  • Similar questions about the S110 vs. mbed BLE APIs abound. Is there any way to take advantage of the mbed API and make small additions without having to do everything directly in S110?

So I guess the basic questions are: How do I find out how the "standard" mbed APIs are implemented on the nRF51-DK and how do I make modifications without throwing the related mbed APIs out?

Hoping the answers to this lengthy series of questions helps others as well. (Even willing to help in solving/documenting issues in this area :-)

Mike

  • Hi Mike,

    If you hover over the "A" in the multiple popups, one of them includes "TARGET_NRF51_DK".

    In the program workspace pane (left side of the screen) select the "mbed" library in your project.

    On the right side of the screen, the "Library Build Details" pane should show up. Click on the "Open Build Page". Find "TARGET_NRF51_DK" , and click on it, followed by "TARGET_NORDIC", "TARGET_MCU_NRF51822" , "TARGET_NRF51_DK", and finally "PinNames.h"

    (all of which was shown when you hovered over the "A" that had TARGET_NRF51_DK in the path)

    At line 100 (also shown while hovering over the "A") is the definition for LED1 for the DK board. And all the other pin definitions for _DK.

    If you instead navigate to /TARGET_NRF51_DK/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nrf-sdk/app_common

    you will find the Nordic headers that you should be familiar with in the Keil environment.

    Sounds like you are doing development with the DK board, but are planning to use a different board later. I think the following might be a way to support both:

    // change next line to 0 for Mikes target board
    
    #define TESTING_WITH_DK    (1)
    
    #if TESTING_WITH_DK
    #define MIKES_LED1             LED1
    #else
    #define MIKES_LED1             P25
    #endif
    

    I haven't actually tested the above snippet, I leave that for you.

    I don't have answers for the rest of your questions.

  • Philip, thanks for being a trail blazer with the mbed environment. I'll undoubtedly have more mbed IDE questions for you :-) Mike

Related