SparkFun Forums 

Where electronics enthusiasts find answers.

Everything with the AmbiqSuite SDK tools and software are welcome here.
User avatar
By gpiota
#209200
I'm trying to run the blinky example provided with the sparkfun bsps. The code uploads successfully with either bootloader, but nothing blinks. As a note, I am able to run the UART example successfully.

Looking at the code it shows `am_bsp_pins.c` to have

- `am_bsp_pins.h` sets `AM_BSP_GPIO_LED_BLUE` to `37`
- `am_bsp_pins.c` sets `g_AM_BSP_GPIO_LED_BLUE.uFuncSel`to `AM_HAL_PIN_37_GPIO`

Looking at the Nano schematics we see pad 19 maps to GPIO 19 which is assigned to LED and printed next to the LED. This makes me think 37 is incorrect the above values should be `19` and `AM_HAL_PIN_19_GPIO` respectively but this does not work either.

It seems the Thing Plus is set up this way (assuming it can run blinky...). Looking its schematics we see pas 26 maps to GPIO 18 which is assigned to the LED and also printed on the PCB next to the LED. In its respective files it has `AM_BSP_GPIO_LED_BLUE` set to 26 and `g_AM_BSP_GPIO_LED_BLUE.uFuncSel` set to `AM_HAL_PIN_26_GPIO`.

Nano Schematics: https://cdn.sparkfun.com/assets/5/5/1/6 ... s-Nano.pdf
Thing Plus Schematics: https://cdn.sparkfun.com/assets/6/f/0/5 ... ematic.pdf
User avatar
By gpiota
#209202
I think the bsp is just configured poorly. Wrote my own blink by setting and clearing the pin.
Code: Select all
#include "am_mcu_apollo.h"

#define LED_BUILTIN 19

int main(void) {

  am_hal_gpio_pinconfig(LED_BUILTIN, g_AM_HAL_GPIO_OUTPUT);

  bool ledOn = false;
  while(1){
    if(ledOn){
      am_hal_gpio_output_clear(LED_BUILTIN);
    } else {
      am_hal_gpio_output_set(LED_BUILTIN);
    }
    ledOn = !ledOn;
    am_util_delay_ms(250);
  }
}
User avatar
By turmerik
#229138
I had the same problem on the OLA (Open Logger Artemis). My setup:

Board: Artemis OLA
Arduino IDE: 1.8.16
Apollo3 core/library/package/whatever: 2.1.1

All I did was redefine LED_BUILTIN at the top of blink.ino like this:

#define LED_BUILTIN (19)

I got a redefinition warning at compile time, but the STAT LED blinks now!

Thanks @gpiota!
 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