This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Custom Pin NULL pointer and address issue

I adding custom pins declarations through overlay file as in first image with corresponding yaml file ( see attachment) with path .. /dts/bindings/gpio/custom.yaml. The project creation and build is successful, but at run time, it is observed that the pointer to custom pin is NULL and it;s addres also is NULL as shown in scond image. The code to initialize the custom pins is in attached file. This problem is with one pin only ... all previous pins are properly assgned the pointer and address.

6557.bms-pins.yaml

#define BMS_RESET_NODE DT_ALIAS(bmsreset)

#if !DT_NODE_HAS_STATUS(BMS_RESET_NODE, okay) 
    #error "Unsupported board: BMS RESET PIN devicetree alias is not defined"
#endif

static  struct gpio_dt_spec bms_reset_pin =   GPIO_DT_SPEC_GET_OR(BMS_RESET_NODE, bmsios,{0});

if (bms_reset_pin.port && !device_is_ready(bms_reset_pin.port)) {
                             printk("Error %d: BMS RESET device %s is not ready; ignoring it\n",
                            ret, bms_reset_pin.port->name);
                            bms_reset_pin.port = NULL;
}
if (bms_reset_pin.port) {
ret = gpio_pin_configure_dt(&bms_reset_pin, GPIO_OUTPUT_LOW);
if (ret != 0)
 {
    printk("Error %d: failed to configure BMS RESET device %s pin %d\n",
    ret, bms_reset_pin.port->name, bms_reset_pin.pin);
    bms_reset_pin.port = NULL;
  } else
 {
    printk("Set up BMS RESET at %s pin %d\n", bms_reset_pin.port->name, bms_reset_pin.pin);
  }
}

Parents
  • Hi Gulzar,

    There is a typo in your code

    static  struct gpio_dt_spec bms_reset_pin =   GPIO_DT_SPEC_GET_OR(BMS_RESET_NODE, bmsios,{0});


    This line should be changed to

    static  struct gpio_dt_spec bms_reset_pin =   GPIO_DT_SPEC_GET_OR(BMS_RESET_NODE, bmsgpios,{0});


    Best regards,
    Dejan

Reply
  • Hi Gulzar,

    There is a typo in your code

    static  struct gpio_dt_spec bms_reset_pin =   GPIO_DT_SPEC_GET_OR(BMS_RESET_NODE, bmsios,{0});


    This line should be changed to

    static  struct gpio_dt_spec bms_reset_pin =   GPIO_DT_SPEC_GET_OR(BMS_RESET_NODE, bmsgpios,{0});


    Best regards,
    Dejan

Children
No Data
Related