I'd like to build a prototype using the nrf9160DK that samples audio from a microphone and plays it back. Given that the dev board has Arduino compatible headers, I'm assuming the easiest thing to do is get a shield like this one?
If so, I'm looking for any sample code that shows how best to interact with an Arduino shield using the nrf SDK. Obviously a microphone example would be preferred, but I'm looking fo any arduinio shield examples as they will likely show the way.
Actually, doing further research indicates that that previous shield was a bit over kill. A much simpler microphone (there are many) just produces an analog out that can go into one of the Arduino pins. If I use that approach, I just need the nrf9160 code example to read the analog pin. It'll be my job to stash it away.
You could use the PDM peripheral as well, as there's many digital microphones that use this bus as well.
In order to use the SAADC peripheral to perform ad conversions in nrf connect sdk, there's a process that needs to be performed first:
1. Add the SAADC peripheral to the non-secure region:
After this line: https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/samples/nrf9160/secure_boot/src/main.c#L336
you must append:
Then build and flash this onto the device.
2a. Adding the SAADC to the project requires a nrf9160_pca10090.overlay file to hold:
status = "ok";
2b. Then you need to add the ADC driver itself to the project in "prj.conf":
Now, you can add the functions needed for using the ADC in your example. I made an example here to show what's needed:
Love the sample! Is it possible to see a sample that uses more of the SAADC facility of the nRF91? If possible I'd like to see an example that uses the task feature to take a sample on a timer event and then easyDMA to publish the result to RAM. It could be that the sample code is already doing some of that, but it's hidden in the enums or something.
I think this is the one you're looking for?
The ADC API in zephyr might not satisfy your requirements, and if that is the case, I'd recommend that you include nrf_saadc.h directly and communicate with that API to override or expose the deeper level functions as a workaround for now. We are looking into exposing all the functionality of our drivers/peripherals in the ncs code base, but it takes a bit of time until we know how to approaching this in the best possible way.
Thanks Hakon, we'll check this out! Much appreciated