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

GPIO setup for CUSTOM board FANSTEL remap of leds

I have created a custom board in the boards.h file.

I then created the fanstel header file and copied the PCA10056 information accross.  Everything is working as it should except im having trouble with P1.00. I looked at this post https://devzone.nordicsemi.com/f/nordic-q-a/38788/how-to-change-tx_pin_number-to-p1-00-on-the-nrf52840, but are not getting the results.

If I hardcode the following  "nrf_gpio_cfg_output(NRF_GPIO_PIN_MAP(1, 0));" the LED turns on but I  would like to use the existing drivers and just reconfigure the GPIO map. 

my fanstel.h is below but only the led on P0.11 is functioning. 

#include "nrf_gpio.h"

// LEDs definitions for FANSTEL
#define LEDS_NUMBER    2

#define LED_1          NRF_GPIO_PIN_MAP(0,11)// fanstel blue
#define LED_2          NRF_GPIO_PIN_MAP(1,00)// fanstel red

#define LED_START      LED_1
#define LED_STOP       LED_2

#define LEDS_ACTIVE_STATE 0

#define LEDS_LIST { LED_1, LED_2 }

#define LEDS_INV_MASK  LEDS_MASK

#define BSP_LED_0     11//P0.11//  blue 
#define BSP_LED_1     00//P1.00//  red

I dont see P1.00 used anywhere else but yet it is not  turning on with the P0.11 led when initialized.

Im using the Mesh3 timer_light example and this function to test the leds from simple_hal.c file

void hal_leds_init(void) 
{
    for (uint32_t i = LED_START; i <= LED_STOP; ++i)
    {
        NRF_GPIO->PIN_CNF[i] = LED_PIN_CONFIG;
        NRF_GPIO->OUTSET = 1UL << i;

     }

Is there anything else I should add somewhere?

thanks in advance

Parents
  • Looks like the hal_leds_init() will presume the LEDs are chronologically ordered from LED_START to LED_STOP, in other words it will set pins P0.11, P0.12, P0.13... P0.31, P0.32(!) as output LEDs. It also seems to only support PORT0 (=NRF_GPIO I presume). The implementation of hal_leds_init() doesn't look as it supports what you want to do. I believe you need to use bsp_board_led_on() or bsp_board_led_off(), which will select a LED from LEDS_LIST, numbered from 0 (=LED_1) to 1(=LED_2) in this case.

Reply
  • Looks like the hal_leds_init() will presume the LEDs are chronologically ordered from LED_START to LED_STOP, in other words it will set pins P0.11, P0.12, P0.13... P0.31, P0.32(!) as output LEDs. It also seems to only support PORT0 (=NRF_GPIO I presume). The implementation of hal_leds_init() doesn't look as it supports what you want to do. I believe you need to use bsp_board_led_on() or bsp_board_led_off(), which will select a LED from LEDS_LIST, numbered from 0 (=LED_1) to 1(=LED_2) in this case.

Children
Related