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

undefined reference to `nrf_pwr_mgmt_shutdown'

I have added the include and src. file paths to the MAKEFILE and yet I am experiencing this error.

I tried deleting the main.c.o file too, but am still experiencing this issue.

Parents
  • Hello,

    Could you tell me some more about your development setup: Which IDE are you using, are you building with armgcc directly, or perhaps Segger Embedded Studios?
    Could you also verify for me the path you have supplied, and how you have added it to the makefile?
    In the case that you are using Segger Embedded Studios, could you detail for me how you have added the path to your project?

    Looking forward to resolving this issue together,

    Best regards,
    Karl

  • Hello Karl, Thank you for your help.I am currently using  nrf_power_system_off(); to put the nrf52840 dk to sleep.

    Could you please help me with how to wake it up in normal mode? All I am getting are putting to sleep with soft device enabled or with low power mode. I am not using any of them. I am simply calling the functions and want to wake up the device using an interrupt(using if statement to read the gpio).  

  • Hello Karl, Hope you are doing good.

    I actually want my device to go to sleep when there is an inactivity and wake up on an interrupt from a sensor, take 20 readings and then go back to sleep and wake up again on an interrupt. I do not wnat to use soft devices 

  • Also, here is the code snippet I am working on in accordance to the power management library:- 

     main(){
     bsp_board_init(BSP_INIT_LEDS);
    bsp_board_init(BSP_INIT_BUTTONS);
    
        APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
        NRF_LOG_DEFAULT_BACKENDS_INIT();
        
         nrf_pwr_mgmt_run();
         while (1)
        {
           
           NRF_LOG_INFO("MCU WAKE UP");
           NRF_LOG_FLUSH();
    
            for(int i=0;i<2;i++){
                bsp_board_led_on(1);
            
                nrf_delay_ms(500);
    
                bsp_board_led_off(1);
                nrf_delay_ms(1000);
            //bsp_board_led_on(0);
    
                NRF_LOG_INFO("THIS SHOULD BE DISPLAYED");
                NRF_LOG_FLUSH();
            }
       
            bsp_wakeup_button_enable(1);
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
    //sd_power_system_off();
        NRF_LOG_INFO("SHOULD NOT BE DISPLAYED");
        NRF_LOG_FLUSH();
    if(bsp_button_is_pressed(1)){
     NVIC_SystemReset();   
    }
        
    }    
        
        

  • Also, kindly please let me know the function(s) to put it to sleep and the function calls or the button commands to wake it up from sleep. and where to place it and what are the alternative functions to use in place of the above ones I used in the code

  • Hello,

    RJD said:
    I actually want my device to go to sleep when there is an inactivity and wake up on an interrupt from a sensor, take 20 readings and then go back to sleep and wake up again on an interrupt. I do not wnat to use soft devices 

    Ah, my apologies, I made a wrong assumption that you were using the SoftDevice.
    When you say "go to sleep", do you mean go to SYSTEM_OFF ( lowest power consumption ) - i.e the device being completely off, and waking only with a reset, or do you mean go to SYSTEM_ON( some subsystems retaining power )? 

    RJD said:
    Also, here is the code snippet I am working on in accordance to the power management library:- 

    Have you seen how the power management module is used in other examples, such as the  Proximity example? In the code snippet you shared, you are calling nrf_pwr_mgm_run outside the main loop - it is supposed to be called in a loop, to ensure that you are in the lower power state whenever nothing else is being done. This is why in most applications, the nrf_pwr_mgmt_run function is the only thing happening in the main-while loop - the rest is handled in event handlers and ISR's.
    I am not sure that it makes sense for you to call nrf_pwr_mgmt_run as you are doing right now, unless you intend on your application waking up and configuring logging, then going to a low power SYSTEM ON state, before receiving an interrupt of any kind and continuing into the while loop. I am not sure this is what you have inteded.

    RJD said:
    Also, kindly please let me know the function(s) to put it to sleep and the function calls or the button commands to wake it up from sleep.

    Please confirm for me whether you intend on the device going to SYSTEM_OFF, when you say "go to sleep". nrf_pwr_mgmt_run places the device in a low power SYSTEM ON state, not in SYSTEM OFF.
    If you are in a low power SYSTEM ON state, then the device will be wake from any interrupt. If you are in SYSTEM OFF state, then you will need an external interrupt.
    It might be beneficial to read the answers by my colleague Edvin in this ticket.

    Best regards,
    Karl

  • Hello Karl,

    Thank you for your reply.

    Yes , I confirm that I intend on the device going to SYSTEM_OFF ( lowest power consumption ), when I say "go to sleep". 

    I also called the nrf_pwr_mgmt_run() in the main loop, but now i started getting the error of the image

    I tried the solutions in this link- devzone.nordicsemi.com/.../nrf_section_iter-problem-with-sdk-15-and-armgcc

Reply Children
  • Hello Karl, I have got the solution to the  image issue. Please help me with the SYSTEM_OFF problem

  • Hello,

    RJD said:
    I have got the solution to the  image issue.

    I am happy to hear that you were able to resolve this issue. I would warn you that your path is very long - possibly nearing window's limit of 244 characters. If you are not exceeding this already, you should be aware of it if you path should grow even longer.

    RJD said:
    Please help me with the SYSTEM_OFF problem

    RJD said:

    confirm that I intend on the device going to SYSTEM_OFF ( lowest power consumption ), when I say "go to sleep". 

    I also called the nrf_pwr_mgmt_run() in the main loop,

    Thank you for confirming this. It is good that you are now running nrf_pwm_mgmt_run in the main loop now - this should reduce your power consumption when the device is awake and idle.

    In order to go to SYSTEM OFF, you will need to prepare the device, so that it knows what to wake from, such as button-presses or other external interrupts.
    A simple version of this could look something like the function shown below:

    static void sleep_mode_enter(void)
    {
        ret_code_t err_code;
        
        //make DK indicate IDLE
        err_code = bsp_indication_set(BSP_INDICATE_IDLE);
        APP_ERROR_CHECK(err_code);
    
        // Prepare wakeup buttons to trigger wakeup.
        err_code = bsp_btn_ble_sleep_mode_prepare();
        APP_ERROR_CHECK(err_code);
    
        // Go to system-off mode 
        // this function will not return. wakeup will cause a reset.
        err_code = sd_power_system_off();
        APP_ERROR_CHECK(err_code);
    }


    This button configuration is one of the few things that is retained through SYSTEM OFF.

    Is there any errors generated when you call any of these functions?

    Best regards,
    Karl

  • Hello Karl,

    Hope you are doing good. 

    I needed a help with regards to changing my Button's Configurations.

    I wanted to change their Natural states from Active HIGH to Active Low and read High inputs. 

    Also could you please provide me with a way to directly get you on my future issues rather than any othe engineer? You have been really helpful and I do not want any old tickets hanging on your profile.

    Thank you

  • I am using the pwr_mgmt example where  reset event is generated by pressing the Button 2 to wake up the device. I wanted to wake up using an Interrupt by a sensor. The interrupt is a High pulse.

    When i press the button, the port is grounded and that acts as a trigger. I want the pulse to be the trigger to wake it up. How can I change the button's configuration from LOW to HIGH, to wake it up again i.e. to make the Buttons active LOW and Take a High Signal as an input

  • Hello again RID,

    RJD said:
    Hope you are doing good. 

    I am, thank you for asking! I hope you are good as well.

    RJD said:
    I needed a help with regards to changing my Button's Configurations.

    l will answer the question you have posed here, but for future reference please open a new ticket for new questions that diverge from the original ticket. This will ensure that the forum is tidy and easy to navigate for other users.

    RJD said:
    I wanted to change their Natural states from Active HIGH to Active Low and read High inputs. 

    This is not correct, and contradicting itself. The buttons on the nRF52840 DK is active low, meaning that they are pulled up with an internal resistor, and registering a transition to GND ( thus the name, active low ). If you were to have a button active low, which should read high inputs ( assuming this means register and react to transitions to high ), then it would fire constantly, since it is being pulled up. Changing the buttons to active high would require a change in Hardware on the DK, since the button now connects the pin to ground.

    RJD said:
    I wanted to wake up using an Interrupt by a sensor. The interrupt is a High pulse.

    If this is what you seek to do, then you should use the GPIOTE peripheral directly instead - which is what the bsp ( buttons ) are doing behind the scenes.
    It sounds to me like you should use a PORT event in your application, the general approach will then look something like the following:

    ..
    err_code = nrfx_gpiote_init();
    APP_ERROR_CHECK(err_code);
    ..
    nrfx_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
    config.pull = NRF_GPIO_PIN_PULLDOWN;
    ..
    err_code = nrfx_gpiote_in_init(pin, &config, gpiote_event_handler);
    APP_ERROR_CHECK(err_code);
    ..
    nrfx_gpiote_in_event_enable(pin, true);
    ..

    The complete GPIOTE API Reference is available here.
    You can see how this can be done in the app_timer.c's app_button_init and app_button_enable function.

    There are also a lot of other tickets on the forum that discuss how to enable wake-up from an external sensor interrupt, with available code.

    RJD said:
    Also could you please provide me with a way to directly get you on my future issues rather than any othe engineer? You have been really helpful and I do not want any old tickets hanging on your profile.

    I am happy to hear that you have found my answers helpful! Unfortunately, there is no way to guarantee that a specific case will be assigned to me, but I thank you for expressing that!

    Best regards,
    Karl

Related