Hi,
I'm unsuccessfully trying to change the default setting so that they record at 256kHz instead of 48kHz. I've tried modifying the "main.c", under the header
/* USB configuration data structure */
I have changed the following line, trying different values (1, for 384kHz sampling rate; and 1.5 for 256kHz sampling rate):
.sampleRateDivider = 8,
But as a result the devices do not record at all when the switch is in "DEFAULT" position. Instead the green led flashes every two seconds.
Any indications on how to achieve this change in the default settings will be greatly appreciated.
Many thanks,
Hi, What you are seeing is the delayed affect of updating the default parameters. This data structure is stored in FLASH initially and is copied to the backup RAM when the AudioMoth detects that it has experienced a power-up reset. The backup RAM is maintained when the AudioMoth switches itself off whilst waiting to make recordings and the settings are read from the backup RAM each time the AudioMoth makes a recording. When you edit the default settings and refresh the AudioMoth you won't see the impact of the changes unless you cycle the power on your AudioMoth - remove batteries and USB connection. When re-powered it will then register that it has experiences a power-up reset and will copy the new default values to the backup RAM. You can set the sample rate to any value but it is most accurate when it is a divisor of 48 MHz. The audioMoth.c code uses TIMER2 to trigger the ADC -
TIMER_TopSet(TIMER2, CMU_ClockFreqGet(cmuClock_TIMER2) / sampleRate - 1);
- inside the -
static void enablePrsTimer(uint32_t sampleRate)
- function and this will set the clock period to the integer division of the clock frequency (48 MHz) and the sample rate. The minus one accounts for the overflow and the counter starting to count up from zero again. Sometimes you can change the sampleRateDivider to get a more accurate sample rate (e.g. half both the sample rate and sample rate divider to avoid a fractional result), but in most settings it is worth using the higher sample rate divider to a get better signal to noise ratio in the recordings as the sample rate error is pretty small. Alex