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

app_timer_t' has no member named 'handler' (I got this error after merge the I2c OLED project with ble_template example)

Hi.

I recently started work on some projects where I have to use I2c OLED and BLE. I used OLED to display time which is running on an internal RTC of nrf52832. 

Now I merge my Oled code with the ble_template example to advertise. But I got an error on app_timer2.c fie which is redirected some function to (drv_rtc.h). 

how I try to solve this problem but fail,..

Add the path of the file 

Enable timer

#ifndef APP_TIMER_ENABLED
#define APP_TIMER_ENABLED 1
#endif 

Error looks like:

from C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:41:
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:162:19: error: 'app_timer_t' has no member named 'handler'
2> ../../../../../../components/libraries/util/nrf_assert.h:106:9: note: in definition of macro 'ASSERT'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:165:67: error: 'app_timer_t' has no member named 'active'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:167:33: error: 'app_timer_t' has no member named 'end_val'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:169:24: error: 'app_timer_t' has no member named 'repeat_period'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:171:24: error: 'app_timer_t' has no member named 'active'
2> In file included from ../../../../../../components/libraries/log/nrf_log.h:81,
2>                  from C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:59:
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:183:75: error: 'app_timer_t' has no member named 'p_context'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:145:70: note: in definition of macro 'LOG_INTERNAL_1'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:138:33: note: in expansion of macro 'LOG_INTERNAL_X'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:208:13: note: in expansion of macro 'LOG_INTERNAL'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:280:9: note: in expansion of macro 'NRF_LOG_INTERNAL_MODULE'
2> ../../../../../../components/libraries/log/nrf_log.h:114:48: note: in expansion of macro 'NRF_LOG_INTERNAL_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:183:13: note: in expansion of macro 'NRF_LOG_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:184:20: error: 'app_timer_t' has no member named 'handler'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:184:37: error: 'app_timer_t' has no member named 'p_context'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:187:25: error: 'app_timer_t' has no member named 'repeat_period'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:187:53: error: 'app_timer_t' has no member named 'active'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:189:24: error: 'app_timer_t' has no member named 'end_val'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:189:44: error: 'app_timer_t' has no member named 'repeat_period'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:190:65: error: 'app_timer_t' has no member named 'list_item'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:196:61: error: 'app_timer_t' has no member named 'list_item'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:220:42: error: 'app_timer_t' has no member named 'end_val'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:224:74: error: 'app_timer_t' has no member named 'end_val'
2> In file included from C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer.h:71,
2>                  from C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:40:
2> ../../../../../../components/libraries/util/app_util.h:191:32: error: 'app_timer_t' has no member named 'list_item'
2> ../../../../../../components/libraries/util/app_util.h:430:32: note: in expansion of macro 'offsetof'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:254:26: note: in expansion of macro 'CONTAINER_OF'
2> ../../../../../../components/libraries/util/app_util.h:191:32: error: 'app_timer_t' has no member named 'list_item'
2> ../../../../../../components/libraries/util/app_util.h:430:32: note: in expansion of macro 'offsetof'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:260:26: note: in expansion of macro 'CONTAINER_OF'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:274:19: error: 'app_timer_t' has no member named 'active'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:340:28: error: 'app_timer_t' has no member named 'end_val'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:340:55: error: 'app_timer_t' has no member named 'end_val'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:345:36: error: 'app_timer_t' has no member named 'active'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:348:77: error: 'app_timer_t' has no member named 'list_item'
2> In file included from ../../../../../../components/libraries/log/nrf_log.h:81,
2>                  from C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:59:
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:356:91: error: 'app_timer_t' has no member named 'end_val'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:147:70: note: in definition of macro 'LOG_INTERNAL_2'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:138:33: note: in expansion of macro 'LOG_INTERNAL_X'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:198:13: note: in expansion of macro 'LOG_INTERNAL'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:277:9: note: in expansion of macro 'NRF_LOG_INTERNAL_INST'
2> ../../../../../../components/libraries/log/nrf_log.h:154:48: note: in expansion of macro 'NRF_LOG_INTERNAL_INST_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:356:17: note: in expansion of macro 'NRF_LOG_INST_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:356:108: error: 'app_timer_t' has no member named 'end_val'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:148:24: note: in definition of macro 'LOG_INTERNAL_2'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:138:33: note: in expansion of macro 'LOG_INTERNAL_X'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:198:13: note: in expansion of macro 'LOG_INTERNAL'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:277:9: note: in expansion of macro 'NRF_LOG_INTERNAL_INST'
2> ../../../../../../components/libraries/log/nrf_log.h:154:48: note: in expansion of macro 'NRF_LOG_INTERNAL_INST_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:356:17: note: in expansion of macro 'NRF_LOG_INST_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:410:36: error: 'app_timer_t' has no member named 'active'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:412:35: error: 'app_timer_t' has no member named 'active'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:413:77: error: 'app_timer_t' has no member named 'list_item'
2> In file included from ../../../../../../components/libraries/log/nrf_log.h:81,
2>                  from C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:59:
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:415:65: error: 'app_timer_t' has no member named 'end_val'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:147:70: note: in definition of macro 'LOG_INTERNAL_2'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:138:33: note: in expansion of macro 'LOG_INTERNAL_X'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:198:13: note: in expansion of macro 'LOG_INTERNAL'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:277:9: note: in expansion of macro 'NRF_LOG_INTERNAL_INST'
2> ../../../../../../components/libraries/log/nrf_log.h:154:48: note: in expansion of macro 'NRF_LOG_INTERNAL_INST_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:414:21: note: in expansion of macro 'NRF_LOG_INST_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:415:90: error: 'app_timer_t' has no member named 'end_val'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:148:24: note: in definition of macro 'LOG_INTERNAL_2'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:138:33: note: in expansion of macro 'LOG_INTERNAL_X'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:198:13: note: in expansion of macro 'LOG_INTERNAL'
2> ../../../../../../components/libraries/log/src/nrf_log_internal.h:277:9: note: in expansion of macro 'NRF_LOG_INTERNAL_INST'
2> ../../../../../../components/libraries/log/nrf_log.h:154:48: note: in expansion of macro 'NRF_LOG_INTERNAL_INST_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:414:21: note: in expansion of macro 'NRF_LOG_INST_DEBUG'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:425:93: error: 'app_timer_t' has no member named 'list_item'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:567:8: error: 'app_timer_t' has no member named 'handler'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:568:8: error: 'app_timer_t' has no member named 'repeat_period'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:577:12: error: 'app_timer_t' has no member named 'active'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:582:8: error: 'app_timer_t' has no member named 'p_context'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:583:8: error: 'app_timer_t' has no member named 'end_val'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:585:12: error: 'app_timer_t' has no member named 'repeat_period'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:587:12: error: 'app_timer_t' has no member named 'repeat_period'
2> C:\nRF5_SDK_17.0.2_d674dde\components\libraries\timer\app_timer2.c:598:8: error: 'app_timer_t' has no member named 'active'
Build failed

I use app_timer2.c file in library folder to 

please give some suggestions to solve this issue

Parents
  • Thanks for the answer I just added the path and enable App_time and now it's working but I have another issue now :( 

    Combine ble_app_template example with clock code which is nearly run separately.  After combining

    Code is compiled properly .. but the clock is not working, 

    When I debug the program nrf52832 kit reset when it reached the clock code. 

     bool erase_bonds;
    
        // Initialize.
        log_init();
        timers_init();
        //buttons_leds_init(&erase_bonds);
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        advertising_init();
        services_init();
        conn_params_init();
        peer_manager_init();
    
        // Start execution.
        NRF_LOG_INFO("Template example started.");
        application_timers_start();
    
        advertising_start(erase_bonds);
    
         //Enter main loop.
        //for (;;)
        //{
        //    idle_state_handle();
        //}
    
    
    ret_code_t err_code;
    
    //////log_init();
    APP_ERROR_CHECK(err_code);
    //clocks_start();
    gpio_init();  ///init interrupt on button 1
    
    
    ///////////oled init ////
    uint8_t address;
    uint8_t sample_data;
    bool detected_device = false;
    
    ////APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    ////NRF_LOG_DEFAULT_BACKENDS_INIT();
    
    ssd1306_init_i2c(SSD1306_CONFIG_SCL_PIN, SSD1306_CONFIG_SDA_PIN);
    ssd1306_begin(SSD1306_SWITCHCAPVCC, SSD1306_I2C_ADDRESS, false);
    
    
    NRF_LOG_INFO("TWI scanner started.");
    
    //////////////////////////
    
    //////clcok//
    
    
    
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
    
    
    nrf_cal_init();
    nrf_cal_set_callback(calendar_updated, 4);
    //////////////////
    
    ssd1306_clear_display();
    ssd1306_set_textsize(2);
    ssd1306_set_textcolor(WHITE);
    ssd1306_set_cursor(8, 20);
    
    
    ssd1306_putstring( "Ble_watch");
    
    ssd1306_display();
    
    nrf_delay_ms(2000);
    
    ssd1306_clear_display();
    

  • luqman said:
    Thanks for the answer I just added the path and enable App_time and now it's working

    I am happy to hear that it resolved the issue, great!

    luqman said:
    When I debug the program nrf52832 kit reset when it reached the clock code. 

    That sounds like a non-NRF_SUCCESS error code being passed to an APP_ERROR_CHECK. Please make sure to have DEBUG defined in your preprocessor defines, like shown in the included image.
      
    This will make the logger output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK. Check the error code in this error message against the API Reference of the function that returned it, to see why it generated the error.

    Best regards,
    Karl

  • Hello again,

    luqman said:
    Thanks for the tips I make it clear next time.

    No problem at all, I am happy to hear that you found the tips helpful! :) 
    Thank you for clearing up the code.

    luqman said:

    i try to clear the code now look, 

    the code is stuck on that line below

    Could I ask why you have included the 'clock start' section?
    The SoftDevice restricts access to the CLOCK peripheral when it is enabled, which is likely the cause of these fatal errors. As mentioned in the SoftDevice's hardware peripheral requirements, restricted peripherals should only be accessed by the application through the SoftDevice API when the SoftDevice is enabled.

    The relevant exempt reads:

    Table 1. Hardware access type definitions
    Access type Definition
    Restricted The hardware peripheral is used by the SoftDevice and is outside the application sandbox. When the SoftDevice is enabled, it shall only be accessed through the SoftDevice API. Through this Application Programming Interface (API), the application has limited access.


    The CLOCK peripheral is classified as restricted when the SoftDevice is enabled.

    If you tell me more about the functionality you are looking to implement with these lines, or why you have added them in the first place, I could maybe come up with an alternative approach, that will be OK with the SoftDevice.

    Best regards,
    Karl 

  • Hi Karl.

    I try to reply to the below question but I don't get a reply option on there,

    so read the doc "The CLOCK peripheral is classified as restricted when the SoftDevice is enabled."

    why I  use the 'clock start'

    As I use to monitor time by using Internal RTC. For this purpose, I use NRF_calender_example so I just use that code in order to clockwork properly if I don't use enable clock the RTc didn't start count. If I remove those lines from the code the working of the clock stuck. Is there any way I use both nrf_calender_example and ble_template examples in the same code?

  • Hello,

    luqman said:
    I try to reply to the below question but I don't get a reply option on there,

    I have heard about this issue before, and reported it to the site administrators for examination. In the meantime, it seems that the workaround for this is to click on the timestamp of the comment you would like to reply to, to have the buttons show up again. Sorry for the inconvenience.

    luqman said:
    As I use to monitor time by using Internal RTC. For this purpose, I use NRF_calender_example so I just use that code in order to clockwork properly if I don't use enable clock the RTc didn't start count. If I remove those lines from the code the working of the clock stuck. Is there any way I use both nrf_calender_example and ble_template examples in the same code?

    Thank you for elaborating.
    As written in the Restricted definition, the restricted peripherals are available to the application, but they must be accessed through the SoftDevice API, so that the SoftDevice remains in control of what the peripherals are doing.

    Since I do not know exactly which SoftDevice and version you are working with I can not link you to the exact documentation, so the following links are for the S140 v7.2.0.:
    The operation you are trying to do should be done through the sd_clock_hfclk_request call, to request that the hfclk is kept running.
    Just remember that this will keep the HFCLK running until you manually release it.

    Best regards,
    Karl

  • I'm using S132 Segger embedded studio with nrf52832 dev kit

    The operation you are trying to do should be done through the sd_clock_hfclk_request call, to request that the hfclk is kept running.

    I try to do using sd_clock_hfclk_request but if you have an example related to a specific task let me know

    it's helped me a lot 

Reply Children
  • Thanks a lot, Karl I think the issue is resolved, now the RTC2 is running and the device is not reset.

    Here is the main now.

    int main(void)
    {
        ret_code_t err_code;
        bool erase_bonds;
    
        // Initialize.
        log_init();
        timers_init();
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        advertising_init();
        services_init();
        conn_params_init();
        peer_manager_init();
    
        // Start execution.
        NRF_LOG_INFO("Template example started.");
        application_timers_start();
        advertising_start(erase_bonds);
    
        APP_ERROR_CHECK(err_code);
        gpio_init();  ///init interrupt on button 1
              ////oled init ////
       uint8_t address;
       uint8_t sample_data;
       bool detected_device = false;
    
    ssd1306_init_i2c(SSD1306_CONFIG_SCL_PIN, SSD1306_CONFIG_SDA_PIN);
    ssd1306_begin(SSD1306_SWITCHCAPVCC, SSD1306_I2C_ADDRESS, false);
    
    
       NRF_LOG_INFO("TWI scanner started.");
    
              ///clcok//
    
      uint32_t p_is_running = 0;
      sd_clock_hfclk_request();
     while(! p_is_running) 
     {  							//wait for the hfclk to be available
    	sd_clock_hfclk_is_running((&p_is_running));
     }
     NRF_LOG_INFO("clock started.");
    
     nrf_cal_init();
     nrf_cal_set_callback(calendar_updated, 4);
    //////////////////
    
    ssd1306_clear_display();
    ssd1306_set_textsize(2);
    ssd1306_set_textcolor(WHITE);
    ssd1306_set_cursor(8, 20);
    
    
    ssd1306_putstring( "Ble_watch");
    ssd1306_display();
    nrf_delay_ms(2000);
    ssd1306_clear_display();
    while (true)
    { 
    //do something
    }
    

  • luqman said:
    I think the issue is resolved, now the RTC2 is running and the device is not reset.

    Great, I am glad to hear that! :)

    luqman said:
    Thanks a lot, Karl

    No problem at all, I am happy to help!

    Please do not hesitate to open another ticket if you should encounter any issues or question in the future.

    Good luck with your development!

    Best regards,
    Karl

Related