4 years, 8 months ago.

nrf52_dk:can't set A5 to DigitalOut.

Hi all, When I set A5 to DigitalOut mode, upload and run, it will product error. As follow code:


#include "mbed.h"

DigitalOut led1(A5);

Serial pc(USBTX, USBRX);

int main() {
   pc.printf("Init \r\n");
   while (true) {
       led1 = !led1;
       pc.printf("Loop \r\n");

Looking forward to some help!

What do you mean 'product error'? Does it hardfault, does it output something over serial? Why are you using A5 and not D5?

posted by Jan Jongboom 05 Sep 2016

Yes,thanks your point, It printf "mbed assertation failed: (uint32_t)pin < GPIO_PIN_COUNT, file: /extras/mbed-os.lib/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/gpio_api.c, line 68 "

I found "#define GPIO_PIN_COUNT 31", but NRF52_DK has 32 pins.

posted by jixing zou 06 Sep 2016

1 Answer

4 years, 8 months ago.

Hi Jixing,

Thanks for your question, hopefully i can help.

You need mbed-os instead of the mbed library for 'thread'

Import https://github.com/ARMmbed/mbed-os into your compiler and delete "mbed"

Hope that helps,

Regards Andrea, team mbed

Hi, I import the example "mbed-os-example-blinky" and add "DigitalOut led2(A5);". Also run fail.

posted by jixing zou 05 Sep 2016