Unexpected behavior from SAADC in advanced configuration mode when two channels enabled.

Hi,

I am reposting this as the previous question might have been closed due to inactivity from my side and the issue isn't resolved yet. 

To follow up please check this previous question.

Developing the application for nrf52840 custom board on NCS1.9.1.


To make it quick, I have prepared example codes that you can run nrf52840dk_nrf52840 board to reproduce what I am facing here. 

- THE CHANNELS CONFIGURED HERE ARE P0.05 AND P0.31

- TO DISTINGUISH BETWEEN THE SAMPLES OF THE TWO CHANNELS CONNECT THE P0.31 TO GROUND AND P0.5 TO VDD OR VICE-VERSA.

- ALSO, I HAVE ADDED A TIME DIFFERENCE INDICATION FOR EVERY SAADC HANDLER CALL (WHICH PRINTS THE TIME ELAPSED BETWEEN PREVIOUS CALL TO THE CURRENT CALL - 32KHZ KERNEL CYCLE VALUE) TO GIVE AN IDEA OF THE TIMING OF THE EVENTS IN SAADC DRIVER).

- ALSO, I AM DEVELOPING THIS APPLICATION ON NCS V1.9.1.

1. blinky_dual_channel_error.zip 2376.blinky_dual_channel_error.zip

this is the initial error. for simplicity i used the blinky example.
steps to recreate: 

- build the application and run it on eval board. 

- you will see all the samples gets printed on UART as the buffers arrive from SAADC. 

- observe the first two buffers on the log, at the end of first buffer and start of the second buffer you will find the values of the same channel repeated twice. (This might also happen at end of second buffer and start of third buffer)

-to rectify, I followed the first workaround mentioned here. which resulted in the second error below.

2. blinky_dual_channel_erro_after_end_to_start_ppi_channel.zip blinky_dual_channel_error_after_end_to_start_ppi_channel.zip

- again, run this code, keeping the wires connected.

- observe the time delays between saadc handler calls. after giving the first event done the buffer should be immediately request a buffer as the started event is generated when it starts writing samples to the second buffer.

  - and the third buffer values also get corrupted.

-After this, I checked the saadc example in sdk and decided to make the changes in the driver which cleared all the issues and saadc worked properly.

3blinky_after_driver_changes.zip. 0317.blinky_after_driver_changes.zip

- Make the changes in the driver as described previously and run this code. 
- this one has the end to start ppi channel enabled. and start_on_end flag in the saadc intialization given as false.

Parents Reply Children
No Data
Related