10 years ago.

Why do programs not run?

Hi,

I've designed and soldered up my own custom KL05 board with the 32pin LQFP package MKL05Z32VLC4 and when I try and program it using a FRDM-KL05Z with the "helloworld_kl05.bin" found here https://mbed.org/platforms/FRDM-KL05Z/ then PTB8 or LED1 flashes. This proves that the microcontroller is connected correctly.

However when I try and write my own code to replicate this with the mbed library, compile it and run it nothing happens. No LEDs light.

Why could this be?

Question relating to:

The FRDM-KL05Z is an ultra-low-cost development platform enabled by the Kinetis L Series KL0x MCU family built on the ARM® Cortex™-M0+ processor. Features include easy access to MCU I/O, battery-ready, …

You can also export a program to external IDE where you can debug it. CoIDE is quite trivial to set and available for KL05Z or fully supported uvision (no license - 32kB limit). Erik suggestions are most probably correct in your case.

posted by Martin Kojtal 10 May 2014

1 Answer

10 years ago.

Do you have a 32kHz crystal connected to the appropriate pins? In the past, when that bin file was compiled probably, it used the internal 32kHz oscillator. Later we changed it to an external one, since the KL05 board has one, and it is more accurate than using the internal one. So if you indeed have no crystal, it will fail trying to use it as clock.

If this is your issue, delete the mbed lib from your program, instead import mbed-src (next link). This is the complete source code of the mbed lib. Go to the following file (in the compiler): http://mbed.org/users/mbed_official/code/mbed-src/file/e752b4ee7de1/targets/cmsis/TARGET_Freescale/TARGET_KLXX/TARGET_KL05Z/system_MKL05Z4.c. Here you can change the clock setup. You can manually add anything you want, or use one of the presets. I would advice clock setup 0. It is a bit slower than 1 (don't know why it was set that way to be honest, you can manually change it if you want, but it generally won't be an issue, the mbed libs are setup to calculate everything with the used clock frequency, so your wait(1), will still wait 1 second), and only uses the internal oscillator.

If you do have a crystal, try it anyway, maybe it isn't oscillating. One thing to note: Without crystal time functions will not work.

Hi,

I've got a 32.768 crystal hooked up to the XTAL pins, PTA3 & PTA4 but I have a 200K resistor in parallel with the crystal instead of the FRDM-KL05Z board which has a 10M resistor. When I tried to upload the other non-blinking files I noticed that I did not have any signal coming from the crystal unlike the FRDM board. I figure I may need to change this 200K resistor to match the 10M resistor to allow me to use the stock mbed libraries..

To double check I imported "mbed-src" and made the above modification, changing "#define CLOCK_SETUP 1" to "#define CLOCK_SETUP 0" re-compiled and uploaded the code. SUCCESS! The lights blink!

Thanks Erik!

Regards,

Pinski1

posted by Robert K 10 May 2014

Glad to hear, good luck with it :)

posted by Erik - 10 May 2014