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

After configured internal low frequency clock source,advertising stop but saadc still working

The program flow of the slave is to sample the analog signal source through the saadc and then send it to the host through the nus.
When debugging on nrf52dk, configure the chip to xtal mode and the program can run smoothly. But when the chip is configured as a 32.768k internal low-frequency clock source RC, after each reset, the broadcast signal appears for a while and disappears, but the saadc sampling continues to run. Why?
The strange thing is that the first run after programming the program is normal.

Parents
  • Hi

    Can you please check the return value of your app_timer_start() function, just so we know that it returns successfully? I don't see that you've initialized the app_timer either, but I assume you just omitted it from this snippet?

    You can also try setting the ADC to blocking mode, to make sure it will wait for the transmission to be completed before doing the next one. Can you also upload the RTT log you're seeing? Please make sure that your app_uart_put() comes from app_uart_fifo, and not app_uart.c.

    Best regards,

    Simon

Reply
  • Hi

    Can you please check the return value of your app_timer_start() function, just so we know that it returns successfully? I don't see that you've initialized the app_timer either, but I assume you just omitted it from this snippet?

    You can also try setting the ADC to blocking mode, to make sure it will wait for the transmission to be completed before doing the next one. Can you also upload the RTT log you're seeing? Please make sure that your app_uart_put() comes from app_uart_fifo, and not app_uart.c.

    Best regards,

    Simon

Children
  • Hi,

    Firstly, the return value of app_timer_start() function I get is "0"(print in %x format). And, I have initialized the app_timer.

    Also I'm sure that the app_uart_put() comes from app_uart_fifo.

    Before setting the ADC to blocking mode,the RTT log as follows:

    00> <debug> nrf_sdh: State request: 0x00000000
    00> <debug> nrf_sdh: State change: 0x00000000
    00> <debug> nrf_sdh: State change: 0x00000001
    00> <debug> nrf_sdh_ble: RAM starts at 0x20002A00
    00> <info> app: Debug logging for advertising started.
    00> <info> app: Debug logging for adc over RTT started.
    00> <info> app: app_timer_start erecode==0
    00> <info> app: SAADC loop.
    00> <info> app: 0 evt_done
    00> <info> app: 47 /n
    00> <info> app: result:16
    00> <debug> app: sending data from saadc. Writing data on UART.
    00> <debug> app: 0x200030A8,0x2000ADA4

    After setting the ADC to blocking mode,and the program runs continuously (load on the nrf52-dk and the self-made pcb), but never enter in saadc callback function. 

    And after I add other function (like uart_put), program can also run on the nrf52-dk, but when load on the self-made pcb, program stop at every time power on ,the RTT log as follows:(but can run normally after reset)

    00> <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at main.c:347
    00> PC at: 0x0002C551
    00> <error> app: End of error report

    Finally, all in all, I want to know the solution to nrf_no_mem and the reason for the failure in non-blocking mode. It is best for you to provide a solution. Thank you.

    Best regards,

Related