Hi everyone,
I have written a code that sends data over BLE notifications (IMU data). It works great so far and now I want to read the analog values from eight force sensors and send them also as well.
Using the SAADC,PPI AND TIMER drivers I wrote a code that works great. I am using an eight-channel multiplexer in order to read the 8 analog sensors
Due to the fact that I am trying to design a low power application I want to use the app_timer (RTC) rather than the TIMER driver. I am trying to combine my BLE and SAADC codes but I fail.
In the BLE code, I have created an app_timer that starts as soon as notification is enabled. When the timer expires the notification_timeout_handler function is called
Inside the notification_timeout_handler function, I read the data from the IMU and I update the payload that will be sent through BLE notification.
Until this point, everything works fine.
Now inside the notification_timeout_handler() function I want to read also the analog sensors...
I tried to call the nrf_drv_saadc_sample() inside a for loop in order to read the 8 sensors but it fails :
This is the callback function as well the function to switch the channels of the multiplexer:
My problem is that the nrf_drv_saadc_sample() function inside the for loop does not work. I was expecting to call nrf_drv_saadc_sample() function eight times, store the data in ADC_RawData[] array, and then send the data over BLE. But when I run the code and while the loop iterates the nrf_drv_saadc_sample() is being called only once...
Any advice of how could I solve this issue?
p.s SAMPLES_IN_BUFFER is 1
Thanks in advance
Nick