Interrupts in HAL core for STM32F1 broken or daft programmer??

STM32F103 Nucleo boards e.g. STM Nucleo F103RB
mailhouse
Posts: 26
Joined: Tue Nov 01, 2016 12:19 am

Re: Interrupts in HAL core for STM32F1 broken or daft programmer??

Post by mailhouse » Sat Nov 12, 2016 2:24 am

danieleff wrote:There is timer interrupt in timer.c, for example:

Code: Select all

void blink(timer_id_e timer, uint32_t counter) {
  digitalWrite(13, !digitalRead(PB1));
}
void setup() {
  pinMode(13, OUTPUT);
  TimerPulseInit(TIM2_E, 36000, 1000, blink);
}
It is not exactly what you want, but check out that code.
actually, it pretty much is what i want. i can get a 70us and 50us hardware timer going. they dont need to be connected to pins or antyhing, just set a flag. thank you.

here's a 1-second blink using the timer.h library:

Code: Select all

void doStuff(timer_id_e timer) {
 // Do interrupt handler stuff here
 digitalWrite(13, !digitalRead(13));
}

void setup() {
  // put your setup code here, to run once:
  TimerHandleInit(TIM2_E, 2000, 32000);
  attachIntHandle(TIM2_E, doStuff); 
  pinMode(13, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:

}

now i have to figure out how to start the board at 72mhz instead of 64mhz.

Post Reply