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

Cannot control GPIOs on custom board when using SoftDevice

Hi everyone,

my problem is pretty simple: we developed a custom board for the NRF52840 to work using a custom protocol or BLE. A few sensors are connected to the NRF using

I2C, and a few GPIOs are connected to LEDs for debugging. I created a custom board.h file with the pin numbers of my board.

When I use the custom protocol, everything works fine: I can periodically read the sensors, I can switch on, off and toggle the LEDs whenever I need to and there is no issue.

When using the BLE (softdevice S140 V6.0), on the other hand, I cannot switch on/off the LEDs on any of the GPIOs. I tried both the nrf_gpio_pin_set/clear functions and the nrf_gpio_write

functions (which is essentially the same). What puzzles me even more is that the I2C communication works fine with the SoftDevice active, so it seems that my board.h file is accepted either with the SD active.

Is by chance the SD blocking access to GPIOs configurations when active? Do you have any suggestion on what could be wrong?

Thanks for your help.

Lorenzo

Parents
  • I add a new information that may be useful to propose solutions....

    Apparently, I have the same problem with other signals which are on the port P1....so essentially when I use the SoftDevice, it seems that the NRF_GPIO_PIN_MAP function does not work correctly when it needs to configure Port 1.....As said before, when I don't use the SD, there is no problem at all.

    Is there a known issue with NRF_GPIO_PIN_MAP on port 1 when using a softdevice?

  • For those who are interested, I found the problem and a workaround. I am working on SDK 15.0.0, soI am not sure if this was fixed in successive releases, but apparently the macro NRF_GPIO_PIN_MAP does not work properly for mapping Port 1 pins (all pins from P1.00 to P1.15) when the softdevice is used.

    I was able to switch on and off my pins by configuring the port directly, so for my custom board I configured all the P1.xx pins as outputs with the instruction

    NRF_P1 -> DIRSET = 0xFFFF

    and I switch off all the pins with

    NRF_P1 -> OUTSET = 0x0000

    Then by writing individual bits, I can control the desired pin.

Reply
  • For those who are interested, I found the problem and a workaround. I am working on SDK 15.0.0, soI am not sure if this was fixed in successive releases, but apparently the macro NRF_GPIO_PIN_MAP does not work properly for mapping Port 1 pins (all pins from P1.00 to P1.15) when the softdevice is used.

    I was able to switch on and off my pins by configuring the port directly, so for my custom board I configured all the P1.xx pins as outputs with the instruction

    NRF_P1 -> DIRSET = 0xFFFF

    and I switch off all the pins with

    NRF_P1 -> OUTSET = 0x0000

    Then by writing individual bits, I can control the desired pin.

Children
No Data
Related