New from ST: "Nucleo" boards

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: New from ST: "Nucleo" boards

Post by Giovanni »

"break" makes the main() return and go boom.

Giovanni
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: New from ST: "Nucleo" boards

Post 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
User avatar
jcw
Posts: 55
Joined: Thu May 23, 2013 12:59 am

Re: New from ST: "Nucleo" boards

Post 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.
User avatar
jcw
Posts: 55
Joined: Thu May 23, 2013 12:59 am

Re: New from ST: "Nucleo" boards

Post 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!
User avatar
jcw
Posts: 55
Joined: Thu May 23, 2013 12:59 am

Re: New from ST: "Nucleo" boards

Post 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
Post Reply