SparkFun Forums 

Where electronics enthusiasts find answers.

Everything with the AmbiqSuite SDK tools and software are welcome here.
User avatar
I'm trying my first Ambiq Micro example, the adc_vbatt with Segger Embedded Studio. I've commented out any references to pins as I don't need to see the leds or use the button in the example (if I keep them in it's won't compile for some reason). I've changed the printf debugging commands so that it prints. The program compiles and runs (only one run through the code, it should repeat twice a second. Can't see why it hangs. Also the six adc channels are not outputting data, most are always zero and two channels have data but the data never changes.

I'm using an Artemis Red Board.

Anyone have this example working, especially with SES?
User avatar
Well it turns out my problem with the Ambiq demo code was the code didn't setup the clocks. I added Robins SystemInit code too set the clocks up and the demo now works...

void SystemInit()
// Set the default cache configuration. These defaults are declared as const (stored in flash)
// so it is OK to reference them at this point:
// We need to point the Cortex M4 VTOR register at our vector table.
#define AM_REGVAL(x) (*((volatile uint32_t *)(x)))
#define VTOR_ADDR 0xE000ED08
extern uint32_t* _vectors;
AM_REGVAL(VTOR_ADDR) = (uint32_t)&_vectors;
// These routines need to run early on in main().
// They can't go in SystemInit because they modify global RAM as part of
// their operation.
static void init()
// Set the clock frequency.
am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_SYSCLK_MAX, 0);
// Configure the processor for low power operation.
// This routine cannot be called from SystemInit() since it modifies some HAL globals!
User avatar
By dgjacobson

I am new to the Apollo series but have built a number of sensor monitors using Arduino Pro Minis and Micros. I just bought an Artemis Nano for evaluation and am trying to get VBATT to work as well. I am especially interested in the timer interrupt because I use that extensively in the Arduino environment. I haven't been able to get adc_vbatt to work and while I'm a decent C programmer, I'm not very knowledgeable on the hardware side. Would you be willing to post the code that you used to get this to work? Did you use adc_vbatt.c? Also, were you able to get it to work with the 3 libraries listed: am_util.h, am_mcu.apollo.h, am_bsp.h? I downloaded those libraries from github and installed them but can't get the code compile. Thanks for any help you can provide.
 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

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]