How to use ADC in continous mode on nrf5340 dk?

Hello,I am currently using nrf5340 DK.I have successfully run this samplehttps://docs.zephyrproject.org/latest/samples/drivers/adc/README.html.Now I want to use ADC continuous sampling mode to collect data, how do I configure it?Do you have any relevant examples?

looking forward to your reply.

  • Hi Danny,

    I also want to run the adc sample in my nrf5340DK.

    I want to know whether the Board selected nrf5340dk_nrf5340_cpuapp_ns when you set build configuration?

    Also, can you see how to write the overlay file corresponding to 5340 in the board folder under your adc project file?

    Because I wrote according to nrf52840dk_nrf52840.overlay in the board folder under the original adc project, the program compilation was not

    complete.

    Thank you~

  • Hello ChuckRui,

    You can add an nrf5340dk_nrf5340_cpuapp_ns.overlay file refer to nrf52840dk nrf52840.overlay

    to the boards file.Here is an example:

    // To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.
    
    // You can also use the buttons in the sidebar to perform actions on nodes.
    // Actions currently available include:
    
    // * Enabling / disabling the node
    // * Adding the bus to a bus
    // * Removing the node
    // * Connecting ADC channels
    
    // For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
    // You can also visit the nRF DeviceTree extension documentation at https://nrfconnect.github.io/vscode-nrf-connect/devicetree/nrfdevicetree.html
    / {
        zephyr,user {
    		io-channels = <&adc 0>;
    	};
    };
    
    &adc {
    	#address-cells = <1>;
    	#size-cells = <0>;
    
    	channel@0 {
    		reg = <0>;
    		zephyr,gain = "ADC_GAIN_1_6";
    		zephyr,reference = "ADC_REF_INTERNAL";
    		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
    		zephyr,input-positive = <NRF_ADC_AIN0>; /* P0.04 */
    		zephyr,resolution = <12>;
    	};
    
        // channel@1 {
    	// 	reg = <1>;
    	// 	zephyr,gain = "ADC_GAIN_1_6";
    	// 	zephyr,reference = "ADC_REF_INTERNAL";
    	// 	zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
    	// 	zephyr,input-positive = <NRF_ADC_AIN1>; /* P0.05 */
    	// 	zephyr,resolution = <12>;
    	// };
    };

Related