Board: MIMXRT1060
I am using the LED Blinky Example to toggle GPIO port 1, pin 10 (IOMUXC_GPIO_AD_B0_10_GPIO1_IO10). According to the schematic this should correspond to pin D5 of the Arduino shield. I've confirmed I can toggle all the pins of the Arduino D Port except D5. I don't see any zero ohm resistors anywhere in the schematic so I am not sure what is going on.
Any ideas will be greatly appreciated. Thanks very much in advance.
The changes I am making to the original example are (whole project also attached as blinky.tar.bz2):
source/led_blinky.c
/*
* Copyright 2019 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "board.h"
#include "pin_mux.h"
#include "system_MIMXRT1062.h"
#include "clock_config.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define EXAMPLE_LED_GPIO BOARD_USER_LED_GPIO
#define EXAMPLE_LED_GPIO_PIN BOARD_USER_LED_PIN
#define ARDUINO_D5 10U
/*******************************************************************************
* 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_InitBootClocks();
/* Update the core clock */
SystemCoreClockUpdate();
/* 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, ARDUINO_D5, 0U);
g_pinSet = false;
}
else
{
GPIO_PinWrite(EXAMPLE_LED_GPIO, ARDUINO_D5, 1U);
g_pinSet = true;
}
}
}
board/pin_mux.c
/*
* Copyright 2019-2020 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/***********************************************************************************************************************
* This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
* will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
**********************************************************************************************************************/
/*
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Pins v7.0
processor: MIMXRT1062xxxxA
package_id: MIMXRT1062DVL6A
mcu_data: ksdk2_0
processor_version: 0.7.9
board: MIMXRT1060-EVK
pin_labels:
- {pin_num: F14, pin_signal: GPIO_AD_B0_09, label: 'JTAG_TDI/J21[5]/ENET_RST/J22[5]/USER_LED', identifier: USER_LED}
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
*/
#include "fsl_common.h"
#include "fsl_iomuxc.h"
#include "fsl_gpio.h"
#include "pin_mux.h"
/* FUNCTION ************************************************************************************************************
*
* Function Name : BOARD_InitBootPins
* Description : Calls initialization functions.
*
* END ****************************************************************************************************************/
void BOARD_InitBootPins(void) {
BOARD_InitPins();
}
/*
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
BOARD_InitPins:
- options: {callFromInitBoot: 'true', prefix: BOARD_, coreID: core0, enableClock: 'true'}
- pin_list:
- {pin_num: F14, peripheral: GPIO1, signal: 'gpio_io, 09', pin_signal: GPIO_AD_B0_09, direction: OUTPUT, hysteresis_enable: Disable, pull_up_down_config: Pull_Down_100K_Ohm,
pull_keeper_select: Keeper, pull_keeper_enable: Enable, open_drain: Disable, speed: MHZ_100, drive_strength: R0_6, slew_rate: Slow}
- {pin_num: G13, peripheral: ARM, signal: arm_trace_swo, pin_signal: GPIO_AD_B0_10, slew_rate: Fast}
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
*/
/* FUNCTION ************************************************************************************************************
*
* Function Name : BOARD_InitPins
* Description : Configures pin routing and optionally pin electrical features.
*
* END ****************************************************************************************************************/
void BOARD_InitPins(void) {
CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03U */
/* GPIO configuration of USER_LED on GPIO_AD_B0_09 (pin F14) */
gpio_pin_config_t USER_LED_config = {
.direction = kGPIO_DigitalOutput,
.outputLogic = 0U,
.interruptMode = kGPIO_NoIntmode
};
/* Initialize GPIO functionality on GPIO_AD_B0_09 (pin F14) */
GPIO_PinInit(GPIO1, 10U, &USER_LED_config);
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B0_10_GPIO1_IO10,
// IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 is configured as GPIO1_IO09 */
0U); /* Software Input On Field: Input Path is determined by functionality */
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B0_10_ARM_TRACE_SWO, /* GPIO_AD_B0_10 is configured as ARM_TRACE_SWO */
0U); /* Software Input On Field: Input Path is determined by functionality */
IOMUXC_GPR->GPR26 = ((IOMUXC_GPR->GPR26 &
(~(IOMUXC_GPR_GPR26_GPIO_MUX1_GPIO_SEL_MASK))) /* Mask bits to zero which are setting */
| IOMUXC_GPR_GPR26_GPIO_MUX1_GPIO_SEL(0x00U) /* GPIO1 and GPIO6 share same IO MUX function, GPIO_MUX1 selects one GPIO function: 0x00U */
);
IOMUXC_SetPinConfig(
IOMUXC_GPIO_AD_B0_10_GPIO1_IO10,
// IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 PAD functional properties : */
0x10B0U); /* Slew Rate Field: Slow Slew Rate
Drive Strength Field: R0/6
Speed Field: medium(100MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
IOMUXC_SetPinConfig(
IOMUXC_GPIO_AD_B0_10_ARM_TRACE_SWO, /* GPIO_AD_B0_10 PAD functional properties : */
0x90B1U); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/6
Speed Field: medium(100MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Up
Hyst. Enable Field: Hysteresis Disabled */
}
/***********************************************************************************************************************
* EOF
**********************************************************************************************************************/
Thanks,
Sakis
Solved! Go to Solution.
Hi
Is it possible that
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B0_10_ARM_TRACE_SWO, /* GPIO_AD_B0_10 is configured as ARM_TRACE_SWO */
0U);
sets the pin to its ARM_TRACE_SWO (ALT 9) function rather than as GPIO (ALT 5)?
See https://www.utasker.com/iMX/iMXRT1060/iMX_RT_1060.xls
It also looks like you are configuring the same pin's characteristics twice.
Here's the equivalent setup in the uTasker project:
#define ARDUINO_D5 PIN_GPIO_AD_B0_10_GPIO1_IO10
void BOARD_InitPins(void)
{
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(1, (ARDUINO_D5), (0), (PORT_SRE_FAST | PORT_DSE_HIGH));
}
which is "hugely" less error prone than manually modifying the original config tool generated code!
Regards
Mark
@mjbcswitzerland , thank you so much for taking the time to look at this. You are absolutely correct, the configuration of:
IOMUXC_GPIO_AD_B0_10_ARM_TRACE_SWO, was effectively overriding the previous IOMUX setting, I spectacularly failed to see the connection between them.
As an FYI, I was running ZephyrOS on the board, configuring all the Arduino D port pins as outputs, I was seeing the same issue there. So to narrow down the problem, I just hacked the led blinky example to remove all other dependencies. I suspect even in the Zephyr Config the same/similar issue is also in effect.
Once again, thanks for looking into it.
Regards,
Sakis
Hi
Is it possible that
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B0_10_ARM_TRACE_SWO, /* GPIO_AD_B0_10 is configured as ARM_TRACE_SWO */
0U);
sets the pin to its ARM_TRACE_SWO (ALT 9) function rather than as GPIO (ALT 5)?
See https://www.utasker.com/iMX/iMXRT1060/iMX_RT_1060.xls
It also looks like you are configuring the same pin's characteristics twice.
Here's the equivalent setup in the uTasker project:
#define ARDUINO_D5 PIN_GPIO_AD_B0_10_GPIO1_IO10
void BOARD_InitPins(void)
{
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(1, (ARDUINO_D5), (0), (PORT_SRE_FAST | PORT_DSE_HIGH));
}
which is "hugely" less error prone than manually modifying the original config tool generated code!
Regards
Mark