AnsweredAssumed Answered

KL03Z Minimum Program (LED Blink)

Question asked by Daniel Samarin on Jul 18, 2016
Latest reply on Jul 21, 2016 by Daniel Samarin

Hi all, 2 problems I'm having:

 

I have a MKL03Z8VFG4 that I soldered to a QFN16 breakout board. I plugged this into a breadboard. I put a decoupling cap between VCC and GND (and connect a linearly regulated 3.3V to it), put a pullup resistor on NMI_b, and put a pulldown button closer to the NMI_b pin so I can enter bootloader mode. I also connect a USB to 3.3V UART adapter's TX, RX, and GND to the board. This works for a while.

 

1. I rarely move stuff around on my desk, and I'm being very careful not to generate static (everything is grounded back to my metal case laptop), but eventually (a few hours to a few weeks) the chip will stop responding. The chip didn't pop or even get hot as far as I can tell. But when holding the button to put it in bootloader mode, then using the KinetisFlashTool to 'connect' to the bootloader, it will not respond. I don't think anything is running, since on the chip's TX pin I can see the cross-talk noise (a few millivolts on the adapter's RX) from my USB UART adapter's TX signal (they happen synchronously, I checked with a scope). Is there any other way to see if my chip is still alive?

 

2. I've been having a hell of a time getting the minimum program working, while the chip is still alive. See code below. I'm just trying to blink an LED! (rather, toggle an output... I just use my scope and probe the pin in case the chip can't support the 1 mA of LED current.)

 

#include "system_MKL03Z4.h"

#include "MKL03Z4.h"

 

int main(){

   

    SystemInit();

    PORTA_PCR1 = 0x143;        // port A pin 1 is gpio (bit 8 set), drive strength high (bit 6 set)

    GPIOA_PDDR = 0x2;            // port A pin 1 is output (bit 1 set)

    GPIOA_PSOR = 0x2;            // port A pin 1 set high (bit 1 set)

    //SIM_SCGC5 = 0x200;        // already set in system_MKL03Z4.c --- port A clock enable (bit 9 set)

   

    int i;

    while(1){

        for (i=0; i>40000; i++){

            GPIOA_PTOR = 0x2;        // port A pin 1 toggle

        }

    }

   

    return(0);

}

BTW I'm using Keil uVision because the aliases in KDS were giving me a headache. Keil is much easier to read IMO.

 

Thanks in advance for any help!

Outcomes