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

SPI not working in infinite loop

Hi experts

I am trying to interface an external ADC to NRF51-DK i am presently reading SPI ADC code values on BUTTON press event. I am able to read the values from ADC properly on button press.

I want to read the ADC values through infinite loop. idea is to constantly read ADC values in a loop and copy the value on button press in a variable and then send the variable over bluetooth to connected device.

Right now when i try to read the SPI based ADC in infinite loop i am able to read the ADC only once. On every subsequent query only the last received value is displayed the count does not change even if i change the ADC input voltage physically

Please find attached source code of my implementation. Right now the SPI i implemented in Button_0 event and in the int main function the test routine is commented.

Can someone help me in reading the ADC code in infinite loop.

main.c

Related