Hello, I use this example for blinking red with the uVision IDE:
My asking is why when I change BOARD_LED_RED_GPIO with BOARD_LED_GREEN_GPIO and BOARD_LED_RED_GPIO_PIN with BOARD_LED_GREEN_GPIO_PIN it doesn't works:
#include "board.h"
#include "fsl_debug_console.h"
#include "fsl_gpio.h"
#include "clock_config.h"
#include "pin_mux.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define BOARD_LED_GPIO BOARD_LED_RED_GPIO
#define BOARD_LED_GPIO_PIN BOARD_LED_RED_GPIO_PIN
/*******************************************************************************
* Prototypes
******************************************************************************/
/*!
* @brief delay a while.
*/
void delay(void);
/*******************************************************************************
* Variables
******************************************************************************/
/*******************************************************************************
* Code
******************************************************************************/
void delay(void)
{
volatile uint32_t i = 0;
for (i = 0; i < 800000; ++i)
{
__asm("NOP"); /* delay */
}
}
/*!
* @brief Main function
*/
int main(void)
{
/* Define the init structure for the output LED pin*/
gpio_pin_config_t led_config = {
kGPIO_DigitalOutput, 0,
};
/* Board pin, clock, debug console init */
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();
/* Print a note to terminal. */
PRINTF("\r\n GPIO Driver example\r\n");
PRINTF("\r\n The LED is blinking.\r\n");
/* Init output LED GPIO. */
GPIO_PinInit(BOARD_LED_GPIO, BOARD_LED_GPIO_PIN, &led_config);
while (1)
{
delay();
GPIO_PortToggle(BOARD_LED_GPIO, 1u << BOARD_LED_GPIO_PIN);
}
}
Solved! Go to Solution.
Hi Radoslav,
Please download the official sample code from this link:
https://mcuxpresso.nxp.com/en/select
Choose the board as FRDM-KL02, generate the code and download it.
Then you can find the example in folder:
FRDM-KL02Z\boards\frdmkl02z\driver_examples\gpio\led_output
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Radoslav LLiev,
Please check BOARD_InitPins code, do you configure the according pin mux as 1?
Any updated information, please kindly let me know.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you so much for the help, I found the pinMux.c, I configured it and it's done!
Hi Radoslav lliev,
Thank you for your updated information, and it's good to hear you solve the problem.
If your problem is solved and don't have any other question, please help to mark the correct answer, just to close this post, thank you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Can you give me an example, please?
I am newbie in working with Embedded-C.
Hi Radoslav,
Please download the official sample code from this link:
https://mcuxpresso.nxp.com/en/select
Choose the board as FRDM-KL02, generate the code and download it.
Then you can find the example in folder:
FRDM-KL02Z\boards\frdmkl02z\driver_examples\gpio\led_output
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------