PIT_demo LED1 Issues

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PIT_demo LED1 Issues

Jump to solution
1,557 Views
mooreken
Contributor II

Hello, pretty new here.

I am working with the FRDM KE02Z development board in IAR.

While editing the PIT_demo.c file I tried to use the green led (LED1 I believe) and it did not turn on (the blue and red ones did though).

So I went to the definitions of the various LEDx functions in the MA64_freedom.h file to see what's up.

Nothing looked wrong there based off of the schematic, but I can't seem to figure out why the green led won't turn on.

Of course thanks in advance for anyone if they can help.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,394 Views
Rick_Li
NXP Employee
NXP Employee

Hi,

I've reproduced this problem on my side.

The root cause is that bit CLKOE of register SIM_SOPT is set in this example application.

when this bit is set, BUSOUT will be enable and BUSOUT is another function of PTH2 and BUSOUT has higher priority (see Table 10-1 of KE02 reference manual), so, in this case, PTH2 is BUSOUT pin, NOT  the GPIO pin.

to fix this problem, please just clear CLKOE before LED1_Init().

the code can be:

#define BUSOUT_Disable()              SIM_SOPT &= 0xFFF7FFFF;

Add the above statement in MA64_freedom.h.

then add BUSOUT_Disable(); before LED1_Init(); in PIT_demo.c

Hope it helps!

View solution in original post

4 Replies
1,395 Views
Rick_Li
NXP Employee
NXP Employee

Hi,

I've reproduced this problem on my side.

The root cause is that bit CLKOE of register SIM_SOPT is set in this example application.

when this bit is set, BUSOUT will be enable and BUSOUT is another function of PTH2 and BUSOUT has higher priority (see Table 10-1 of KE02 reference manual), so, in this case, PTH2 is BUSOUT pin, NOT  the GPIO pin.

to fix this problem, please just clear CLKOE before LED1_Init().

the code can be:

#define BUSOUT_Disable()              SIM_SOPT &= 0xFFF7FFFF;

Add the above statement in MA64_freedom.h.

then add BUSOUT_Disable(); before LED1_Init(); in PIT_demo.c

Hope it helps!

1,394 Views
mooreken
Contributor II

Nice! Thanks Yong!

That fix it, to be honest I looked at that table in the reference manual and completely ignored those entries. Oops.

Now my green LED shines as bright as... well whatever's bright and green I guess!

Thanks again!

0 Kudos
Reply
1,394 Views
mjbcswitzerland
Specialist V

Hi

Check out the following: µTasker FRDM-KE02Z support

If you load the binary to your board it will allow you to control all LED colours in the I/O menu on the UART (115'200 Baud) [I/O 1 is green LED, I/O 2 is red LED and I/O 3 is blue LED]. You can also use its memory debugger (in the same menu) to check out the port registers to find differences to your case which is not yet operating as expected.

Note that a source of confusion with the KE devices is that they have 32 bit ports but they are names as if they were 8 bit ones. This can trip programmers up since it is sometimes difficult to relate between the names and physical locations in a logical way due to the misleading naming conventions used.The green LED's port is however just next to the red one's and so doesn't usually cause any complications.

Regards

Mark

Kinetis: µTasker Kinetis support

KE: µTasker FRDM-KE02Z support  / µTasker FRDM-KE02Z40M support  / µTasker FRDM-KE04Z support  / µTasker FRDM-KE06Z support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
Reply
1,394 Views
mooreken
Contributor II

Thank you Mark,

However, I checked the value for GPIOB when initializing and toggling the LEDs. It seems that the values found in uTasker are no different than the ones that I found in memory. So I think there might be a broken lead on Port H (specifically PTH2_GREEN).

Thanks for the help though.

0 Kudos
Reply