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

How can I merge the Csense_drv and saadc application together?

Hello,

I am trying to sample capacitance change as well as voltage change from sensors. I combined the simplified sample codes from Csense_drv and saadc sample. If I only enable either csense_drv or saadc, I can read value. But if I combine them together, I always get "fatal" error. I understand csense_drv also use saadc (I disable COMP) but don't know where the conflict/problem is.

Can anybody take a look at my [source] file?

Thanks a lot! -Lei

Parents
  • added comments: a lit more details after debugging. The first time sampling is okay to give me saadc and csense value. Then the program tried to do second sampling, started the first saadc sampling. But I got a return a err_code vaule of "8", I searched old post. The error code of "8" meant "NRF_ERROR_INVALID_STATE". It seemed the saadc already initiated. But even I added another"nrf_drv_saadc_uninit();" it still showed me the same error code of "8". Thanks.

    Another question is how I can just initiate the saadc once and then reuse it for csense application. So I won't have to "uninitiate" the saadc after the sampling. Thanks.

Reply
  • added comments: a lit more details after debugging. The first time sampling is okay to give me saadc and csense value. Then the program tried to do second sampling, started the first saadc sampling. But I got a return a err_code vaule of "8", I searched old post. The error code of "8" meant "NRF_ERROR_INVALID_STATE". It seemed the saadc already initiated. But even I added another"nrf_drv_saadc_uninit();" it still showed me the same error code of "8". Thanks.

    Another question is how I can just initiate the saadc once and then reuse it for csense application. So I won't have to "uninitiate" the saadc after the sampling. Thanks.

Children
No Data
Related