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

Continuous reading/sampling the ADC

Does the 2nd argument in the following function SAADC example controls the sampling frequency? If this is not the case then can this saadc example program be modified to be used for continuously. Is there a better way to continuously read the ADC for nRF52 chip instead of using the saadc example.

/* setup m_timer for compare event every 400ms */
uint32_t ticks = nrf_drv_timer_ms_to_ticks(&m_timer, 400);

Parents
  • Jared,

    I was able to use the new function but I my program always ends up in a break point condition after log_init(). Am I initializing something multiple times ?

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**
    * Copyright (c) 2014 - 2019, Nordic Semiconductor ASA
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    * 1. Redistributions of source code must retain the above copyright notice, this
    * list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form, except as embedded into a Nordic
    * Semiconductor ASA integrated circuit in a product or a software update for
    * such product, must reproduce the above copyright notice, this list of
    * conditions and the following disclaimer in the documentation and/or other
    * materials provided with the distribution.
    *
    * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    * contributors may be used to endorse or promote products derived from this
    * software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi,

    Is any error code thrown? Where exactly after log_init() does the program stop?

    regards

    Jared

  • Adding disassembly.

    NRF_BREAKPOINT_COND;
    // On assert, the system can only recover with a reset.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    E003 b 0x00027FC2
    --- app_button.c -- 270 ------------------------------------
    }
    if (!nrf_drv_gpiote_is_init())
    {
    err_code = nrf_drv_gpiote_init();
    F001FCA3 bl 0x00029904 <nrfx_gpiote_init>
    --- app_button.c -- 275 ------------------------------------
    VERIFY_SUCCESS(err_code);
    2800 cmp r0, #0
    D0DF beq 0x00027F82
    --- app_button.c -- 301 ------------------------------------
    /* Create polling timer. */
    return app_timer_create(&m_detection_delay_timer_id,
    APP_TIMER_MODE_SINGLE_SHOT,
    detection_delay_timeout_handler);
    }
    B003 add sp, sp, #12
    BDF0 pop {r4-r7, pc}
    --- app_button.c -- 288 ------------------------------------
    app_button_cfg_t const * p_btn = &p_buttons[button_count];
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi,

    I can't tell from the images where it asserts, the quality of the uploaded image is too low. Can you tell what function is causing it to go the error handler when you step through the code?

    regards

    Jared 

Reply
  • Hi,

    I can't tell from the images where it asserts, the quality of the uploaded image is too low. Can you tell what function is causing it to go the error handler when you step through the code?

    regards

    Jared 

Children
  • The error is in the log_init().

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**
    * Copyright (c) 2014 - 2019, Nordic Semiconductor ASA
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    * 1. Redistributions of source code must retain the above copyright notice, this
    * list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form, except as embedded into a Nordic
    * Semiconductor ASA integrated circuit in a product or a software update for
    * such product, must reproduce the above copyright notice, this list of
    * conditions and the following disclaimer in the documentation and/or other
    * materials provided with the distribution.
    *
    * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    * contributors may be used to endorse or promote products derived from this
    * software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi,

    Compile the project in debug mode and comment out the NRF_BREAKPOINT_COND. The project should now print out the error code to the terminal when you run it.

    regards

    Jared