7 years, 3 months ago.

How can I change pin definitions for nRF51-DK mbed kit ?

I have checked the source code of https://developer.mbed.org/teams/Bluetooth-Low-Energy/, most of the code used default pin definitions. How can I change different pins for RX/TX/ADC/SPI?

2 Answers

7 years, 3 months ago.

Pin definitions are in PinNames.h for your specific board. E.g. for nRF51-DK they are here.

To edit PinNames.h you'll need to be using either mbed OS 5 or you'll need to use mbed-dev if you're using mbed OS 2.

7 years, 3 months ago.

Hi Kai,
please refer follows.
/questions/78934/How-to-use-both-UART-in-nrf52840-dev-Kit/
/users/kenjiArai/code/BLE_I2C_pin_assign/
/users/kenjiArai/code/BLE_UART_pin_assign/
nRF51822 has Programmable Peripheral Interconnect function.
I have confirmed (at least) that UART and I2C can change the pin assign.

Hi Jan,
you looks like the arm team member.
Could you confirm this issue together with team members as official comment?

Hi Kenji, thanks for your comments in both questions. Didn't realize this just worked out of the box. Where do you want to put this as an official comment? On the nRF51/nRF52 platform pages?

posted by Jan Jongboom 05 Sep 2017

Really awesome. Thanks Kenji!

posted by Kai Liu 05 Sep 2017

Hi Jan,
I only confirmed UART and I2C.
I would like to know whether SPI and ADC has a same way to change a pin assign or not.
Because I tried to change an ADC pin but a compiler made caution message "pinmap not found for peripheral".
I think most of nRF5x Mbed user does not know "Programmable Peripheral Interconnect function" is officall suppurted by both Mbed-OS5 & clasic Mbed.
Please explain on the nRF5x related board pages.

Hi Kai,
Enjoy this function.

posted by Kenji Arai 05 Sep 2017

@Kenji, what pin are you using for ADC? I was looking through the code and the pinmap's seem aware of this feature already. However, ADC is only available on analog pins P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_26, P0_27.

posted by Jan Jongboom 06 Sep 2017

Hi Jan,
I have read the manual and confirmed that ADC pin selection range is restricted ADC 0 to ADC7 which you described above.
This means I cannot assign ADC P0_0 and/or P0_7 and so on.

posted by Kenji Arai 06 Sep 2017