Dear all,
I met a strange situation regarding the KL27 chip. I had one Freedom board and one board designed by myself.
I copied the projects in SDK_2.0_FRDM_KL27Z/boards/fdmkl27z/driver_examples/gpio/input_interrupt to my project.
I only modified the input trigger pin (from PTC1 to PTD1) for both boards and LED pin (PTB18 vs PTB19). I am using
KDS 3.2 with SDK 2.0 built for this chip. The SWD tool is the freedom board on-board one.
The code works well on the Freedom board but won't get the interrupt triggered for my own board. The code will turn on the LED at the beginning and blink once the interrupt is triggered. Therefore I know the code is running once I saw the LED turned on. If I use UART to dump the message, I found out the output freeze once the input trigger happened. Could it be
interrupt vector issue?
Actually I found the same behavior for the PIT example.
Please some one in the know could give me a hand!!!
Original Attachment has been moved to: PD1625.rar
Hi
I am using the IAR IDE using KSDK V2.0 and FRDM-KL27Z board, just modify below code could generate using PTD1 pin to control the LED(PTB18):
<board.h>
#define BOARD_SW3_GPIO GPIOD
#define BOARD_SW3_PORT PORTD
#define BOARD_SW3_GPIO_PIN 1U
#define BOARD_SW3_IRQ PORTB_PORTC_PORTD_PORTE_IRQn
#define BOARD_SW3_IRQ_HANDLER PORTBCDE_IRQHandler
#define BOARD_SW3_NAME "SW3"
<pin_mux.c>
/* Enable gpio port clock */
//CLOCK_EnableClock(kCLOCK_PortC);
CLOCK_EnableClock(kCLOCK_PortD);
/* Affects PORTC_PCR1 register */
port_pin_config_t config = {0};
config.pullSelect = kPORT_PullUp;
config.mux = kPORT_MuxAsGpio;
//PORT_SetPinConfig(PORTC, 1U, &config);
PORT_SetPinConfig(PORTD, 1U, &config);
With above modification, I could using PTD1 pin control the LED.
I checked your code related place is same, while, I am not sure if you have modify the other places.
Could you using the KSDK V2.0 gpio demo [input_interrupt] re-generate related code and check if it works or not.
Wish it helps.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks for the reply.
I modified the code based on the KSDK 2.0 GPIO demo (input interrupt)。I can run the program successfully on the freedom board. The problem is that I change the port and the code won't work on my own board.
I tried the PIT demo as well. The code could work on Freedom board but not on my own board.
Hi Tony,
For the PIT demo is only chip based, there without any relationship with external circuit.
If the PIT demo could not work on your designed board, I suspect the chip on your own board is broken.
You need to replace that chip and check if the PIT demo could work or not.
wish it helps.
best regards,
Ma Hui