Working anyone? adc_vbatt.c example from Ambiq Micro

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?

Regards,

Kevin

How about anyone have this example working with any environment?

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:

am_hal_cachectrl_config(&am_hal_cachectrl_defaults);

am_hal_cachectrl_enable();

// 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!

am_hal_pwrctrl_low_power_init();

}

Hello:

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.