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

Troubles in SAADC Module pre-prepared program in nRF52840

I am working on the nRF52840 DK board SAADC module with nRF5_SDK_17.0.0 SDK, and I am unable to get the output on RTT.\

I am working on the pre-prepared program from the peripheral folder of SAADC from the SDK.

I am using the pre-prepared program for now and as far as I have observed program doesn't enter the saadc_callback function. Have checked that using NRF_LOG_INFO.

I have checked reset all other initializations are successfully done, the only issue is it doesn't enter SAADC event handler 

What should I do?

  • Hello,

    I am working on the nRF52840 DK board SAADC module with nRF5_SDK_17.0.0 SDK, and I am unable to get the output on RTT.\

    I am working on the pre-prepared program from the peripheral folder of SAADC from the SDK.

    The SAADC example provided in the SDK uses the UART logging backend by default.
    If you would like to switch from the loggers UART backend to the RTT backend, you will have to change the following definitions in the sdk_config.h file:

    #define NRF_LOG_BACKEND_UART_ENABLED 0
    
    #define NRF_LOG_BACKEND_RTT_ENABLED 1


    Making these changes should make the logger output through RTT.
    If you do not make these changes, you would need to have open a serial monitor with the configuration specified in the SAADC Example documentation to see the output.

    Try this, and let me know if it resolves your issue.

    I am using the pre-prepared program for now and as far as I have observed program doesn't enter the saadc_callback function. Have checked that using NRF_LOG_INFO.

    The example writes a statement to the logger upon startup, so if you have not seen anything written to your RTT viewer or debug terminal, chances are that you are using the wrong backend, or have configured the serial monitor incorrectly.

    Best regards,
    Karl

  • Have done your suggested changes, unable to get any ADC value. The only thing I get is as follow: 

    SAADC HAL simple example started.

    The program is not entering the saadc_callback function.

    Because when I tried running a simple program where I was making SAADC work in Blocking mode I am getting ADC output on the RTT terminal.

    I have attached a 5K pot on the input terminal P0.04(AIN2), for variable analog signal.

  • Ashu@2000 said:

    Have done your suggested changes, unable to get any ADC value. The only thing I get is as follow: 

    SAADC HAL simple example started.

    Could you confirm for me whether you are testing the unmodified SAADC peripheral example from the SDK, or if you have made any changes to it? In the case that you have made changes, could you share your main.c file here, so I may take a look?
    The unmodified example works just fine for me here on my end, running on the nRF52840 DK.

    Ashu@2000 said:
    The program is not entering the saadc_callback function.

    It sounds very strange that it never enters the saadc callback. This should happen periodically, as the timer CC event triggers the sampling through PPI, and the buffer fills up.
    How are you checking whether it enters the callback or not? Could it be that you never start its timer?

    Looking forward to resolving this issue together!

    Best regards,
    Karl

  • Hey Karl,

    Thank you for your help, have extracted a new SDK and run the preprepared program of SAADC  of it and it runs perfectly.

    I would have made some wrong changes in the previous file, that's why it wouldn't be working.

    Thank you, for your help.

  • Hello, 

    Ashu@2000 said:
    Thank you for your help, have extracted a new SDK and run the preprepared program of SAADC  of it and it runs perfectly.

    I am happy to hear that you've now got it up an running as expected, great!

    Ashu@2000 said:
    I would have made some wrong changes in the previous file, that's why it wouldn't be working.

    I recommend creating a copy of each example you intend to modify, and keep your work in the copy - to ensure that you always have access to an unmodified version, in case something goes wrong with the modification.
    Furthermore, I also recommend that you never make changes to the drivers / components provided with the SDK for the same reason. If you should want to modify a driver for whatever reason, you should first copy it into your project folder, then make the modifications to it.

    Ashu@2000 said:
    Thank you, for your help.

    No problem at all, I am happy to help!

    Please do not hesitate to open a new ticket if you should encounter any issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Related