BLE_APP_UART and SAADC

Hi,

I am trying to send the data from SAADC on BLE. I follow the example: https://github.com/NordicPlayground/nRF52-ADC-examples/tree/master/ble_app_uart__saadc_timer_driven__scan_mode (NRF52832 and SDK 17.0)

However, when I change the sample rate, I found I cannot go beyond 250 samples/second. Once I change the SAADC_SAMPLE_RATE to less than 5 ms, the program would stop and give an ERROR after sending 1 data out.

I tried the SAADC example in the peripheral, it worked fine with higher data rate. 

Which things limited the sample rate? How can I send the data at higher speed (like ~1000 samples/second)?

Thanks in advance!

Parents
  • Hi,

    What error do you get? Can you share the entire error log?

    regards

    Jared 

  • <info> app: Debug logging for UART over RTT started.
    <info> app: Connected
    <error> app: ERROR 19 [NRF_ERROR_RESOURCES] at \nRF5_SDK_17.1.0_ddde560\examples\nRF52-ADC-examples-master\ble_app_uart__saadc_timer_driven__scan_mode\main.c:799
    PC at: 0x0002A40F
    <error> app: End of error report

    This is the error i got. It worked fine if the sample rate is slower than 5 ms. For this case I use 4 ms.

  • Hi,

    The error log is telling you that some function at line 799 is returning NRF_ERROR_RESOURCES. I'm guessing that this is a BLE function. Usually this happens if the Softdevice queue is full, for example if you queue too many TX operations before the Softdevice is able to send the data. There is many threads on this topic in the forum, here is a suggested solution from another thread.

    regards

    Jared 

  • I tried the solution from the thread you recommended. But it gave me another error. 

    <warning> nrf_sdh_ble: Insufficient RAM allocated for the SoftDevice.
    <warning> nrf_sdh_ble: Change the RAM start location from 0x20002AD8 to 0x20003E90.
    <warning> nrf_sdh_ble: Maximum RAM size for application is 0xC170.
    <error> nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.
    <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at \nRF5_SDK_17.1.0_ddde560\examples\nRF52-ADC-examples-master\ble_app_uart__saadc_timer_driven__scan_mode\main.c:464
    PC at: 0x0002A81B

    At line 464, it is 

    err_code = nrf_sdh_ble_enable(&ram_start);
    APP_ERROR_CHECK(err_code);

    Is it hard to send 16-Byte data every 1 ms? Should I try to send in slower frequecy, like send 160 bytes every 10 ms instead?

    I will try to find some other solutions in the forum too. 

  • You need to change the RAM address and size so that your application fits into the memory. See this blog post.

    dfbdfb said:
    Is it hard to send 16-Byte data every 1 ms? Should I try to send in slower frequecy, like send 160 bytes every 10 ms instead?

    I think this depends on your connection parameters. You could try to decrease the connection interval and NRF_SDH_BLE_GAP_EVENT_LENGTH, see if that mitigates your issue.

    regards

    Jared

Reply
  • You need to change the RAM address and size so that your application fits into the memory. See this blog post.

    dfbdfb said:
    Is it hard to send 16-Byte data every 1 ms? Should I try to send in slower frequecy, like send 160 bytes every 10 ms instead?

    I think this depends on your connection parameters. You could try to decrease the connection interval and NRF_SDH_BLE_GAP_EVENT_LENGTH, see if that mitigates your issue.

    regards

    Jared

Children
No Data
Related