Page 3 of 3

Re: New from ST: "Nucleo" boards

Posted: Sat Aug 23, 2014 1:21 pm
by Giovanni
"break" makes the main() return and go boom.

Giovanni

Re: New from ST: "Nucleo" boards

Posted: Sat Aug 23, 2014 1:26 pm
by Tectu
Oh, I didn't even see those...

@Giovanni: But is it correct that one has to manually change the PLL values when changing from HSE to HSI or am I giving wrong advice here?


~ Tectu

Re: New from ST: "Nucleo" boards

Posted: Sat Aug 23, 2014 1:29 pm
by jcw
Ah, thanks - this is what I have now, I'll investigate!

Code: Select all

#define STM32_SW                            STM32_SW_PLL
#define STM32_PLLSRC                        STM32_PLLSRC_HSI
#define STM32_PLLXTPRE                      STM32_PLLXTPRE_DIV1
#define STM32_PLLMUL_VALUE                  9


Above example simplified, as per your suggestion. I also removed the "break" commands, leftover from an old edit.

Re: New from ST: "Nucleo" boards

Posted: Sat Aug 23, 2014 1:36 pm
by jcw
Definitely a clock issue, this one blinks just fine:

Code: Select all

  while (true) {
    palTogglePad(GPIOA, GPIOA_LED_GREEN);
    for (volatile int i = 0; i < 1000000; ++i)
      ;
    // chThdSleepMilliseconds(1);
  }


Ok, that narrows it down considerably.

-jcw

PS. You guys are amazing, helping out within minutes!

Re: New from ST: "Nucleo" boards

Posted: Sat Aug 23, 2014 2:22 pm
by jcw
Problem solved - I had turned off the idle thread, now restored to:

Code: Select all

#define CH_CFG_NO_IDLE_THREAD               FALSE


Can't do a chThdSleepMilliseconds() in main() when there's no idle thread to switch to - doh!

Final test code, for reference:

Code: Select all

#include "ch.h"
#include "hal.h"

int main () {
  halInit();
  chSysInit();
  while (true) {
    palTogglePad(GPIOA, GPIOA_LED_GREEN);
    chThdSleepMilliseconds(500);
  }
  return 0;
}


All is well now, both tick-less and with periodic ticks. Onwards!

-jcw