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

NRF52840 Dongle Missing Green LED on LD2

Hello All,

I've recently run into an issue with the nRF52840 Dongle where the Green channel for LD2 is not lighting up, this is a problem that is persistent across all four nRF2840 Dongles in my possession.

Two of the dongles are dated 2018.42, and the other two are dated 2018.34.

I can see 4 traces leading into the LEDs so I am assuming all 3 channels are connected, perhaps it's a misconfiguration in the BSP?

LEDs are defined as follow in pca10059.h from nRF5 SDK 15.2.0.

// LED definitions for PCA10059
// Each LED color is considered a separate LED
#define LEDS_NUMBER    4

#define LED1_G         NRF_GPIO_PIN_MAP(0,6)
#define LED2_R         NRF_GPIO_PIN_MAP(0,8)
#define LED2_G         NRF_GPIO_PIN_MAP(1,9)
#define LED2_B         NRF_GPIO_PIN_MAP(0,12)

#define LED_1          LED1_G
#define LED_2          LED2_R
#define LED_3          LED2_G
#define LED_4          LED2_B

#define LED_START      LED_1
#define LED_STOP       LED_4

#define LEDS_ACTIVE_STATE 0

#define LEDS_LIST { LED_1, LED_2, LED_3, LED_4 }

#define LEDS_INV_MASK  LEDS_MASK

#define BSP_LED_0      LED_1
#define BSP_LED_1      LED_2
#define BSP_LED_2      LED_3
#define BSP_LED_3      LED_4

Any comments on the matter would be appreciated.

Thanks in advanced!

-jdts

Parents
  • Dear jdts,

    I have stumbled upon the same problem as you. I was trying to light the green LED by using a macro ( LEDS_ON(leds_mask) ) from boards.h.

    This works for all LEDs from PCA10056 and all LEDs from PCA10059 except the mentioned LED2_G. The first clue is that this LED2_G is the only one situated on port 1.

    #define LED2_G         NRF_GPIO_PIN_MAP(1,9)
    

    That led me to more curious observation of BSP_LED_x_MASK macros. Those masks should show the register which place to change to control the GPIO. Since nRF52840 has two registers (one for each GPIO port: 0x50000000 and 0x50000300) those masks must be used with BSP_LED_x_PORT macros to control the correct register.

    For me, the problem was that macro LEDS_ON has a fixed register:

    #define LEDS_ON(leds_mask) do {  ASSERT(sizeof(leds_mask) == 4);                     \
                           NRF_GPIO->OUTCLR = (leds_mask) & (LEDS_MASK & LEDS_INV_MASK); \
                           NRF_GPIO->OUTSET = (leds_mask) & (LEDS_MASK & ~LEDS_INV_MASK); } while (0)

    and therefore, when I tried to light the LED2_G (port 1, pin 9) using BSP_LED_2_MASK, it controlled port 0, pin 9.

    I am pretty confident that the same thing happened in your code, as no argument specifies the port (and register) to be controlled by function hal_led_blink_ms().

Reply
  • Dear jdts,

    I have stumbled upon the same problem as you. I was trying to light the green LED by using a macro ( LEDS_ON(leds_mask) ) from boards.h.

    This works for all LEDs from PCA10056 and all LEDs from PCA10059 except the mentioned LED2_G. The first clue is that this LED2_G is the only one situated on port 1.

    #define LED2_G         NRF_GPIO_PIN_MAP(1,9)
    

    That led me to more curious observation of BSP_LED_x_MASK macros. Those masks should show the register which place to change to control the GPIO. Since nRF52840 has two registers (one for each GPIO port: 0x50000000 and 0x50000300) those masks must be used with BSP_LED_x_PORT macros to control the correct register.

    For me, the problem was that macro LEDS_ON has a fixed register:

    #define LEDS_ON(leds_mask) do {  ASSERT(sizeof(leds_mask) == 4);                     \
                           NRF_GPIO->OUTCLR = (leds_mask) & (LEDS_MASK & LEDS_INV_MASK); \
                           NRF_GPIO->OUTSET = (leds_mask) & (LEDS_MASK & ~LEDS_INV_MASK); } while (0)

    and therefore, when I tried to light the LED2_G (port 1, pin 9) using BSP_LED_2_MASK, it controlled port 0, pin 9.

    I am pretty confident that the same thing happened in your code, as no argument specifies the port (and register) to be controlled by function hal_led_blink_ms().

Children
No Data
Related