This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

Timer difference S110 v7 vs v8

For a sensor design I want to use timers with the UART service. I got it somehow working for the S110 version 7. The only problem I have with version 7 is that I can't use the UART like it should. However when I try to port the software to get it working with version 8 of S110, the UART will work. But now the timers don't work. I tried several timer examples, but they work the same way I already use and don't solve my problem or the work not at all. I use several timers, but because of the problems I only use the battery measurement at this moment.

I'm using the following code for my timers. in S110 v8.

// Initialize timer module.
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);

// Create BATTERY timer.
err_code = app_timer_create(&m_battery_timer_id, APP_TIMER_MODE_REPEATED, battery_level_meas_timeout_handler);

In the code I use the next function to start my timer.

static void battery_timer_start(void)
{
	uint32_t err_code;
	uint32_t battery_meas_timer_ticks;

	battery_meas_timer_ticks = APP_TIMER_TICKS(BATTERY_LEVEL_MEAS_INTERVAL, APP_TIMER_PRESCALER);
	err_code = app_timer_start(m_battery_timer_id, battery_meas_timer_ticks, NULL);
	APP_ERROR_CHECK(err_code);
}

When I start the battery timer, the device is resetting.

Does somebody know what I'm doing wrong. Or which timer example can I use and will work with the NUS on the latest version of S110.

  • What's 'err_code'? Most likely the APP_ERROR_CHECK() is resetting the device because err_code isnt' NRF_SUCCESS

  • Thanks for the comment. I checked the error code. It is indeed not NRF_SUCCESS but Code number 8 which suggests NRF_ERROR_INVALID_STATE. But this is still strange for me.

  • Which SDK version are you using? I see that you dont check the error code from app_timer_create(), are you sure this completed successfully?

  • I have selected the latest versions of the Software Packs. As far as I know I'm using 10.0.0.

    • nRF_Examples = 10.0.0
    • nRF_BLE, Libraries, Drivers, = 3.1.0
    • FamilyPack = 8.2.0
    • nRF_Softdevice_S110 = 8.0.3

    The error-code after creating the timer is 0, so that should be NRF_SUCCESS.

    I will add some of the declaration

    #define BATTERY_LEVEL_MEAS_INTERVAL	500  /**< Battery Level measurement interval. */
    #define APP_TIMER_PRESCALER             0         /**< Value of the RTC1 PRESCALER register. */
    
    static app_timer_id_t   m_battery_timer_id;     /**< Battery timer. */
    
  • For SDK 10 it looks like you have to use this macro (app_timer_start(...) will return NRF_ERROR_INVALID_STATE if the id is zero):

    APP_TIMER_DEF(m_battery_timer_id);
    
Related