AnsweredAssumed Answered

LED blink example

Question asked by Daniel Milutinovic on Jan 6, 2020
Latest reply on Jun 4, 2020 by Daniel Milutinovic

Hello,

 

I followed the "Get Started" instructions on the i.MX RT1010 EVK webpage and everything is working well. I've tried the led_blink.c example for the LED on the i.MX RT1010 EVK and it works fine:  

 

/*
* Copyright 2019 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#include "board.h"

#include "pin_mux.h"
#include "clock_config.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define EXAMPLE_LED_GPIO BOARD_USER_LED_GPIO
#define EXAMPLE_LED_GPIO_PIN BOARD_USER_LED_GPIO_PIN


/*******************************************************************************
* Prototypes
******************************************************************************/

/*******************************************************************************
* Variables
******************************************************************************/
volatile uint32_t g_systickCounter;
/* The PIN status */
volatile bool g_pinSet = false;

/*******************************************************************************
* Code
******************************************************************************/
void SysTick_Handler(void)
{
if (g_systickCounter != 0U)
{
g_systickCounter--;
}
}

void SysTick_DelayTicks(uint32_t n)
{
g_systickCounter = n;
while (g_systickCounter != 0U)
{
}
}

/*!
* @brief Main function
*/
int main(void)
{
/* Board pin init */
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();

/* Set systick reload value to generate 1ms interrupt */
if (SysTick_Config(SystemCoreClock / 1000U))
{
while (1)
{
}
}

while (1)
{
/* Delay 1000 ms */
SysTick_DelayTicks(1000U);
if (g_pinSet)
{
GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 0U);
g_pinSet = false;
}
else
{
GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 1U);
g_pinSet = true;
}
}
}

 

I would like to interface an LED to one of the Arduino interface pins on the i.MX RT1010 EVK and blink the LED, i.e. use the Arduino interface pin as GPIO. 

 

So I just need to change the following definitions:

 

#define EXAMPLE_LED_GPIO BOARD_USER_LED_GPIO
#define EXAMPLE_LED_GPIO_PIN BOARD_USER_LED_GPIO_PIN

 

and connect the LED to the corresponding Arduino interface pin on the i.MX RT1010 EVK

 

Can you please give me an example of what to change "BOARD USER_LED_GPIO" and "BOARD_USER_LED_GPIO_PIN" to?

 

Also, which Arduino interface pin should I connect the LED to on the i.MX RT1010 EVK?

 

Also, can you please direct me to the document(s) with this information?

Outcomes