frdm-kl02z LED example problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

frdm-kl02z LED example problem

ソリューションへジャンプ
2,633件の閲覧回数
rado__99
Contributor II

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);
}
}

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
2,361件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
2,361件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

2,361件の閲覧回数
rado__99
Contributor II

Thank you so much for the help, I found the pinMux.c, I configured it and it's done!

0 件の賞賛
返信
2,361件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,361件の閲覧回数
rado__99
Contributor II

Can you give me an example, please?

I am newbie in working with Embedded-C.

0 件の賞賛
返信
2,362件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信