BOOT_FLASH attached to a pin?

This is almost @shensley’s pseudocode, just had to add the #include, “correct” the Reset-call, and add a small delay to let the cap charge (as noted on the schematic: https://github.com/electro-smith/Hardware/blob/master/reference/daisy_seed/ES_Daisy_Seed_Rev4.pdf).

This small program blinks the LED two times then is ready to accept another download:

#include <daisy_seed.h>
#include "stm32h7xx_hal.h"

daisy::DaisySeed hw;

void RebootToBootloader()
{
    // Initialize Boot Pin
    dsy_gpio_pin bootpin = {DSY_GPIOG, 3};
    dsy_gpio pin;
    pin.mode = DSY_GPIO_MODE_OUTPUT_PP;
    pin.pin = bootpin;
    dsy_gpio_init(&pin);

    // Pull Pin HIGH
    dsy_gpio_write(&pin, 1);

	// wait a few ms for cap to charge
	hw.DelayMs(10);

    // Software Reset
	HAL_NVIC_SystemReset();
}

int main()
{

	hw.Configure();
	hw.Init();

	hw.SetLed(1);
	hw.DelayMs(500);
	hw.SetLed(0);
	hw.DelayMs(500);
	hw.SetLed(1);
	hw.DelayMs(500);
	hw.SetLed(0);

	RebootToBootloader();

}

I’ll just add a button to my breadboard and connect it to this function, and speed up my numerous uploads! :slight_smile:

2 Likes