SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
#212176
Per the article "How to Set up the PDM to Achieve 48/16/44.1 KHz Audio Data", from the support.ambiqmicro.com website, the following code will fine tune the Apollo 3 PDM to produce nearly exact PCM audio sampling rates of 48/16/44. 1 KHz:

case AM_HAL_CLKGEN_CONTROL_HFADJ_ENABLE:

_VAL2FLD(CLKGEN_HFADJ_HFXTADJ, 0x5DC) /* 49.152 MHz */
or
_VAL2FLD(CLKGEN_HFADJ_HFXTADJ, 0x562) /* 45.1584 MHz */

The case statement comes from the function "uint32_t am_hal_clkgen_control(am_hal_clkgen_control_e eControl, void *pArgs)" that can be found in the file "am_hal_clkgen.c" from the ambiq sdk.

Will the referenced function work on the Redboard Artemis?

I have tried adding "#include <am_hal_clkgen_h>" and calling the function from within the Arduino IDE but it isn't recognizing the function and treats my call as an improper function definition. Is it possible to "#include" the am_hal_clkgen.h and gain access to the functions in am_hal_clkgen.c from within the Arduino IDE or do I need to use a different interface for this?
#212301
I was able to upload the command am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_HFADJ_ENABLE, _VAL2FLD(CLKGEN_HEADJ_HFXTADJ, 0x5DC)) via the AmbiqSDK environment but I think it bricked my board. I can no longer upload anything even with the Arduino IDE. Even "Burn Bootloader" fails. Is there a way to reset the clock to its factory value?
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum