NRF52805 ADC BLE APP UART

Hello, I'm working currently on an nrf52805 module and I'm creating a board with it, for now, I managed to do the ble app uart for this module and improve to code a little bit.

My goal, for now, is to create an ADC measurement of voltage, and I'm struggling with this. If someone could help me with this that would be great to give a code that would be good with it or an idea (i'm kinda new with BLE)

So I tried to use the example:    github.com/.../ble_app_uart__saadc_timer_driven__scan_mode

I'm trying to readapt the example to my board and thanks to the datasheet i saw that The nRF52805 only has 10 PPI channels (0-9) and The nRF52805 also only has 3 timers (TIMER0-TIMER2) but when I'm trying to taking off this in the code i get this error after : 

Thank you to everybody for their help. 

Parents
  • Thank you for providing the file.

    Please change to using the nrfx_timer driver directly.
    You will only need to replace the function calls with the same ones in the nrfx driver - if you look at the definitions of the legacy nrf_drv_timer_* calls you will see that they are macro forwarded to the nrfx implementation behind the scenes anyways. You should therefore use these calls directly instead.
    Then, when you are using the nrfx_timer driver you should remove the following legacy definitions entirely from your sdk_config.h file:

    // <e> TIMER_ENABLED - nrf_drv_timer - TIMER periperal driver - legacy layer
    //==========================================================
    #ifndef TIMER_ENABLED
    #define TIMER_ENABLED 1
    #endif
    // <o> TIMER_DEFAULT_CONFIG_FREQUENCY  - Timer frequency if in Timer mode
     
    // <0=> 16 MHz 
    // <1=> 8 MHz 
    // <2=> 4 MHz 
    // <3=> 2 MHz 
    // <4=> 1 MHz 
    // <5=> 500 kHz 
    // <6=> 250 kHz 
    // <7=> 125 kHz 
    // <8=> 62.5 kHz 
    // <9=> 31.25 kHz 
    
    #ifndef TIMER_DEFAULT_CONFIG_FREQUENCY
    #define TIMER_DEFAULT_CONFIG_FREQUENCY 0
    #endif
    
    // <o> TIMER_DEFAULT_CONFIG_MODE  - Timer mode or operation
     
    // <0=> Timer 
    // <1=> Counter 
    
    #ifndef TIMER_DEFAULT_CONFIG_MODE
    #define TIMER_DEFAULT_CONFIG_MODE 0
    #endif
    
    // <o> TIMER_DEFAULT_CONFIG_BIT_WIDTH  - Timer counter bit width
     
    // <0=> 16 bit 
    // <1=> 8 bit 
    // <2=> 24 bit 
    // <3=> 32 bit 
    
    #ifndef TIMER_DEFAULT_CONFIG_BIT_WIDTH
    #define TIMER_DEFAULT_CONFIG_BIT_WIDTH 0
    #endif
    
    // <o> TIMER_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef TIMER_DEFAULT_CONFIG_IRQ_PRIORITY
    #define TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 6
    #endif
    
    // <q> TIMER0_ENABLED  - Enable TIMER0 instance
     
    
    #ifndef TIMER0_ENABLED
    #define TIMER0_ENABLED 0
    #endif
    
    // <q> TIMER1_ENABLED  - Enable TIMER1 instance
     
    
    #ifndef TIMER1_ENABLED
    #define TIMER1_ENABLED 0
    #endif
    
    // <q> TIMER2_ENABLED  - Enable TIMER2 instance
     
    
    #ifndef TIMER2_ENABLED
    #define TIMER2_ENABLED 0
    #endif
    
    // <q> TIMER3_ENABLED  - Enable TIMER3 instance
     
    
    #ifndef TIMER3_ENABLED
    #define TIMER3_ENABLED 1
    #endif
    
    // <q> TIMER4_ENABLED  - Enable TIMER4 instance
     
    
    #ifndef TIMER4_ENABLED
    #define TIMER4_ENABLED 0
    #endif
    
    // </e>


    Instead, you should now use the NRFX_TIMER_* defines to configure your nrfx_timer driver.
    Please make sure to define the NRFX_TIMER_ENABLED to 1, along with the *_ENABLE for the timer instance you will be using.

    Let me know if this resolves your issue! :) 
    Best regards,
    Karl

  • I'm sorry it is hard to understand i'm french... Could you do the work for me? or explain to me easily? thank you so much

  • Yes thank you this is what i did i have the errors that a showed in the last post that i'm trying to fix...

  • Could you elaborate on what you changed?
    You do not necessarily have to change your nrf_drv calls to the nrfx equivalent - you could keep the nrf_drv function calls (since they are forwarded to the nrfx implementation behind the scenes) so long as you remove the part I specified from the sdk_config.

    Best regards,
    Karl

  • Karl, I have too many errors now ... I'm following what you are saying and now I have many many problems ble_app_uart__saadc_timer_driven__scan_mode V1.zip

  • If you are just attempting to change the timer instance of the referenced example I would instead start from the unmodified example again, and change the sdk_config.h and timer instance like we have spoken about.
    This will be easier than to trace and backtrack all the changes you have mentioned thus far (like changes to the apply_old_config and possibly other SDK files).
    Could this be an option instead?

    Best regards,
    Karl

Reply
  • If you are just attempting to change the timer instance of the referenced example I would instead start from the unmodified example again, and change the sdk_config.h and timer instance like we have spoken about.
    This will be easier than to trace and backtrack all the changes you have mentioned thus far (like changes to the apply_old_config and possibly other SDK files).
    Could this be an option instead?

    Best regards,
    Karl

Children
  • Yes I just took a new example on the new folder and i don't have an error with my DK 52832 now i have to modify the timers and SDK to the 52805 module compatibility

    Thank you

  • Okay I did my best (changed the options, taking off the timers, modified the sdk etc) I'm going to give you my code my code is in examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode thank you 5658.nRF5_SDK_17.1.0_ddde560.zip

  • Okay I did my best (changed the options, took off the timers, modified the SDK, etc) I'm going to give you my code my code is in examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode

    thank you 7043.nRF5_SDK_17.1.0_ddde560.zip

  • What happened when you made the changes? Are you still experiencing an issue, or are you sharing the project for future reference because it now works?
    In case of the former, please elaborate thoroughly on what you would like me to help you with in the attached project.

    For future reference, please do not upload the entire SDK folder, you only need to zip the specific project folder.

    Best regards,
    Karl

  • it happens that i'm having ussues even if i'm doing exactly like you told me to do ... and i have this 

    Building ‘ble_app_uart_pca10040_s132’ from solution ‘ble_app_uart_pca10040_s132’ in configuration ‘Release’
    2> Checking ‘thumb_crt0.s’
    2> 'Output/Release/Obj/ble_app_uart_pca10040_s132/thumb_crt0.o' is up to date
    3> Checking ‘nrf_log_backend_rtt.c’
    3> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_log_backend_rtt.o' is up to date
    4> Checking ‘nrf_log_backend_serial.c’
    4> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_log_backend_serial.o' is up to date
    5> Checking ‘nrf_log_default_backends.c’
    5> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_log_default_backends.o' is up to date
    6> Checking ‘nrf_log_frontend.c’
    6> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_log_frontend.o' is up to date
    7> Checking ‘nrf_log_str_formatter.c’
    7> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_log_str_formatter.o' is up to date
    8> Checking ‘app_button.c’
    8> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_button.o' is up to date
    1> Checking ‘app_error.c’
    1> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_error.o' is up to date
    2> Checking ‘app_error_handler_gcc.c’
    2> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_error_handler_gcc.o' is up to date
    3> Checking ‘app_error_weak.c’
    3> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_error_weak.o' is up to date
    4> Checking ‘app_fifo.c’
    4> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_fifo.o' is up to date
    5> Checking ‘app_scheduler.c’
    5> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_scheduler.o' is up to date
    6> Checking ‘app_timer.c’
    6> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_timer.o' is up to date
    7> Checking ‘app_uart_fifo.c’
    7> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_uart_fifo.o' is up to date
    8> Checking ‘app_util_platform.c’
    8> 'Output/Release/Obj/ble_app_uart_pca10040_s132/app_util_platform.o' is up to date
    1> Checking ‘hardfault_implementation.c’
    1> 'Output/Release/Obj/ble_app_uart_pca10040_s132/hardfault_implementation.o' is up to date
    2> Checking ‘nrf_assert.c’
    2> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_assert.o' is up to date
    3> Checking ‘nrf_atfifo.c’
    3> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_atfifo.o' is up to date
    4> Checking ‘nrf_atflags.c’
    4> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_atflags.o' is up to date
    5> Checking ‘nrf_atomic.c’
    5> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_atomic.o' is up to date
    6> Checking ‘nrf_balloc.c’
    6> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_balloc.o' is up to date
    7> Checking ‘nrf_fprintf.c’
    7> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_fprintf.o' is up to date
    8> Checking ‘nrf_fprintf_format.c’
    8> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_fprintf_format.o' is up to date
    1> Checking ‘nrf_memobj.c’
    1> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_memobj.o' is up to date
    2> Checking ‘nrf_pwr_mgmt.c’
    2> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_pwr_mgmt.o' is up to date
    3> Checking ‘nrf_ringbuf.c’
    3> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_ringbuf.o' is up to date
    4> Checking ‘nrf_section_iter.c’
    4> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_section_iter.o' is up to date
    5> Checking ‘nrf_strerror.c’
    5> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_strerror.o' is up to date
    6> Checking ‘retarget.c’
    6> 'Output/Release/Obj/ble_app_uart_pca10040_s132/retarget.o' is up to date
    7> Checking ‘ses_startup_nrf52.s’
    7> 'Output/Release/Obj/ble_app_uart_pca10040_s132/ses_startup_nrf52.o' is up to date
    8> Checking ‘ses_startup_nrf_common.s’
    8> 'Output/Release/Obj/ble_app_uart_pca10040_s132/ses_startup_nrf_common.o' is up to date
    1> Checking ‘system_nrf52.c’
    1> 'Output/Release/Obj/ble_app_uart_pca10040_s132/system_nrf52.o' is up to date
    2> Checking ‘boards.c’
    2> 'Output/Release/Obj/ble_app_uart_pca10040_s132/boards.o' is up to date
    3> Checking ‘nrf_drv_clock.c’
    3> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_drv_clock.o' is up to date
    4> Checking ‘nrf_drv_uart.c’
    4> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_drv_uart.o' is up to date
    5> Checking ‘nrfx_clock.c’
    5> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_clock.o' is up to date
    6> Checking ‘nrfx_gpiote.c’
    6> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_gpiote.o' is up to date
    7> Checking ‘nrfx_prs.c’
    7> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_prs.o' is up to date
    8> Checking ‘nrfx_uart.c’
    8> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_uart.o' is up to date
    1> Checking ‘nrfx_uarte.c’
    1> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_uarte.o' is up to date
    2> Checking ‘nrfx_saadc.c’
    2> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_saadc.o' is up to date
    3> Checking ‘nrfx_ppi.c’
    3> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_ppi.o' is up to date
    4> Checking ‘nrfx_timer.c’
    4> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_timer.o' is up to date
    5> Checking ‘nrf_drv_ppi.c’
    5> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrf_drv_ppi.o' is up to date
    6> Checking ‘nrfx_power.c’
    6> 'Output/Release/Obj/ble_app_uart_pca10040_s132/nrfx_power.o' is up to date
    7> Checking ‘bsp.c’
    7> 'Output/Release/Obj/ble_app_uart_pca10040_s132/bsp.o' is up to date
    8> Checking ‘bsp_btn_ble.c’
    8> 'Output/Release/Obj/ble_app_uart_pca10040_s132/bsp_btn_ble.o' is up to date
    1> Checking ‘main.c’
    1> C:/Users/l.marcos/Desktop/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode/pca10040/s132/config/sdk_config.h (21.04.2022 11:11:16) is later than Output/Release/Obj/ble_app_uart_pca10040_s132/main.o (21.04.2022 10:41:35).
    1> Compiling ‘main.c’
    3> Checking ‘SEGGER_RTT.c’
    3> C:/Users/l.marcos/Desktop/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode/pca10040/s132/config/sdk_config.h (21.04.2022 11:11:16) is later than Output/Release/Obj/ble_app_uart_pca10040_s132/SEGGER_RTT.o (21.04.2022 11:09:29).
    3> Compiling ‘SEGGER_RTT.c’
    4> Checking ‘SEGGER_RTT_Syscalls_SES.c’
    4> C:/Users/l.marcos/Desktop/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode/pca10040/s132/config/sdk_config.h (21.04.2022 11:11:16) is later than Output/Release/Obj/ble_app_uart_pca10040_s132/SEGGER_RTT_Syscalls_SES.o (21.04.2022 11:09:29).
    4> Compiling ‘SEGGER_RTT_Syscalls_SES.c’
    5> Checking ‘SEGGER_RTT_printf.c’
    5> C:/Users/l.marcos/Desktop/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode/pca10040/s132/config/sdk_config.h (21.04.2022 11:11:16) is later than Output/Release/Obj/ble_app_uart_pca10040_s132/SEGGER_RTT_printf.o (21.04.2022 10:41:36).
    5> Compiling ‘SEGGER_RTT_printf.c’
    6> Checking ‘ble_advdata.c’
    6> C:/Users/l.marcos/Desktop/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode/pca10040/s132/config/sdk_config.h (21.04.2022 11:11:16) is later than Output/Release/Obj/ble_app_uart_pca10040_s132/ble_advdata.o (21.04.2022 10:41:36).
    6> Compiling ‘ble_advdata.c’
    7> Checking ‘ble_advertising.c’
    7> C:/Users/l.marcos/Desktop/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode/pca10040/s132/config/sdk_config.h (21.04.2022 11:11:16) is later than Output/Release/Obj/ble_app_uart_pca10040_s132/ble_advertising.o (21.04.2022 10:41:36).
    7> Compiling ‘ble_advertising.c’
    8> Checking ‘ble_conn_params.c’
    8> C:/Users/l.marcos/Desktop/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode/pca10040/s132/config/sdk_config.h (21.04.2022 11:11:16) is later than Output/Release/Obj/ble_app_uart_pca10040_s132/ble_conn_params.o (21.04.2022 10:41:36).
    8> Compiling ‘ble_conn_params.c’
    2> Checking ‘ble_conn_state.c’
    2> C:/Users/l.marcos/Desktop/nRF5_SDK_17.1.0_ddde560/examples/ble_peripheral/ble_app_uart__saadc_timer_driven__scan_mode/pca10040/s132/config/sdk_config.h (21.04.2022 11:11:16) is later than Output/Release/Obj/ble_app_uart_pca10040_s132/ble_conn_state.o (21.04.2022 10:41:36).
    2> Compiling ‘ble_conn_state.c’
    1> In file included from ../../../../../../modules/nrfx/nrfx.h:45,
    1>                  from ../../../../../../modules/nrfx/hal/nrf_gpio.h:44,
    1>                  from ../../../../../../components/boards/boards.h:43,
    1>                  from ../../../../../../components/libraries/bsp/bsp.h:58,
    1>                  from ../../../../../../components/libraries/bsp/bsp_btn_ble.h:60,
    1>                  from C:\Users\l.marcos\Desktop\nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_uart__saadc_timer_driven__scan_mode\main.c:71:
    1> ../../../../../../modules/nrfx/drivers/include/nrfx_timer.h:71:39: error: 'NRF_TIMER3' undeclared here (not in a function); did you mean 'NRF_TIMER0'?
    1> ../../../../../../modules/nrfx/drivers/nrfx_common.h:92:37: note: in definition of macro 'NRFX_CONCAT_2_'
    1> ../../../../../../modules/nrfx/drivers/include/nrfx_timer.h:71:25: note: in expansion of macro 'NRFX_CONCAT_2'
    1> ../../../../../../integration/nrfx/legacy/nrf_drv_timer.h:64:50: note: in expansion of macro 'NRFX_TIMER_INSTANCE'
    1> C:\Users\l.marcos\Desktop\nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_uart__saadc_timer_driven__scan_mode\main.c:130:42: note: in expansion of macro 'NRF_DRV_TIMER_INSTANCE'
    1> ../../../../../../modules/nrfx/drivers/include/nrfx_timer.h:72:39: error: 'NRFX_TIMER3_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_TIMER2_INST_IDX'?
    1> ../../../../../../modules/nrfx/drivers/nrfx_common.h:113:37: note: in definition of macro 'NRFX_CONCAT_3_'
    1> ../../../../../../modules/nrfx/drivers/include/nrfx_timer.h:72:25: note: in expansion of macro 'NRFX_CONCAT_3'
    1> ../../../../../../integration/nrfx/legacy/nrf_drv_timer.h:64:50: note: in expansion of macro 'NRFX_TIMER_INSTANCE'
    1> C:\Users\l.marcos\Desktop\nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_uart__saadc_timer_driven__scan_mode\main.c:130:42: note: in expansion of macro 'NRF_DRV_TIMER_INSTANCE'
    1> ../../../../../../modules/nrfx/hal/nrf_timer.h:125:55: error: 'TIMER3_CC_NUM' undeclared here (not in a function); did you mean 'TIMER0_CC_NUM'?
    1> ../../../../../../modules/nrfx/drivers/nrfx_common.h:113:37: note: in definition of macro 'NRFX_CONCAT_3_'
    1> ../../../../../../modules/nrfx/hal/nrf_timer.h:125:41: note: in expansion of macro 'NRFX_CONCAT_3'
    1> ../../../../../../modules/nrfx/drivers/include/nrfx_timer.h:73:25: note: in expansion of macro 'NRF_TIMER_CC_CHANNEL_COUNT'
    1> ../../../../../../integration/nrfx/legacy/nrf_drv_timer.h:64:50: note: in expansion of macro 'NRFX_TIMER_INSTANCE'
    1> C:\Users\l.marcos\Desktop\nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_uart__saadc_timer_driven__scan_mode\main.c:130:42: note: in expansion of macro 'NRF_DRV_TIMER_INSTANCE'
    Build failed
    

Related