iMX1060: Toggling GPIO3, Pin6 and Pin2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX1060: Toggling GPIO3, Pin6 and Pin2

1,665 Views
farid_mabrouk
Contributor II

I am wondering why I could not not toggle GPIO3, pin 6 and 2 , while I was able to toggle pin 0 on iMX RT1062 MCU. Below are my initialization. I am assuming all pins on a signal GPIO share same clock. Am I right?

void BOARD_InitPins(void) {
  CLOCK_EnableClock(kCLOCK_Iomuxc);           /* iomuxc clock (iomuxc_clk_enable): 0x03U */

  /* GPIO configuration of FlexSPI_D3_B on GPIO_SD_B1_00 (pin L5) */
  gpio_pin_config_t FlexSPI_D3_B_config = {
      .direction = kGPIO_DigitalOutput,
      .outputLogic = 0U,
      .interruptMode = kGPIO_NoIntmode
  };
  /* Initialize GPIO functionality on GPIO_SD_B1_00 (pin L5) */
  GPIO_PinInit(GPIO3, 0U, &FlexSPI_D3_B_config);

  /* GPIO configuration of FlexSPI_D1_B on GPIO_SD_B1_02 (pin M3) */
  gpio_pin_config_t FlexSPI_D1_B_config = {
      .direction = kGPIO_DigitalOutput,
      .outputLogic = 0U,
      .interruptMode = kGPIO_NoIntmode
  };
  /* Initialize GPIO functionality on GPIO_SD_B1_02 (pin M3) */
  GPIO_PinInit(GPIO3, 2U, &FlexSPI_D1_B_config);

  /* GPIO configuration of FlexSPI_SS0 on GPIO_SD_B1_06 (pin L3) */
  gpio_pin_config_t FlexSPI_SS0_config = {
      .direction = kGPIO_DigitalOutput,
      .outputLogic = 0U,
      .interruptMode = kGPIO_NoIntmode
  };
  /* Initialize GPIO functionality on GPIO_SD_B1_06 (pin L3) */
  GPIO_PinInit(GPIO3, 6U, &FlexSPI_SS0_config);

  IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B1_06_GPIO3_IO06,        /* GPIO_SD_B1_06 is configured as GPIO3_IO06 */
      0U);                                    /* Software Input On Field: Input Path is determined by functionality */

  IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B1_00_GPIO3_IO00,        /* GPIO_SD_B1_00 is configured as GPIO3_IO00 */
      0U);                                    /* Software Input On Field: Input Path is determined by functionality */
  IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B1_02_GPIO3_IO02,        /* GPIO_SD_B1_02 is configured as GPIO3_IO02 */
      0U); 

  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_GPR->GPR28 = ((IOMUXC_GPR->GPR28 &
    (~(IOMUXC_GPR_GPR28_GPIO_MUX3_GPIO_SEL_MASK))) /* Mask bits to zero which are setting */
      | IOMUXC_GPR_GPR28_GPIO_MUX3_GPIO_SEL(0x00U) /* GPIO3 and GPIO8 share same IO MUX function, GPIO_MUX3 selects one GPIO function: 0x00U */
    );

}

main()

{

    while (1)
    {
        delay();
        GPIO_PortToggle(GPIO3, 1u<<2);
        GPIO_PortToggle(GPIO3, 1u<<6);
        GPIO_PortToggle(GPIO3, 1u<<0);

}

Any comments?

Thank you!

Labels (1)
0 Kudos
Reply
7 Replies

1,467 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Andre marcus,

   I help you create one MCUXpresso IDE project, it is based on the SDK_2.7.0_EVK-MIMXRT1060, you can debug it directly, the code runs from the internal RAM.

   So you can debug it directly, then check the related two pins.

   If you have the official MIMXRT1060-EVK board, you can test u33 pin1, it is GPIO_SD_B1_06, GPIO3_IO06.

   Please test it on your side.

   If this code also can't make it works, I think you also need to check the hardware side, as this code works OK on my side.

Best Regards,

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

1,467 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Andre marcus,

    Which board you are using now? The NXP official MIMXRT1060-EVK or your own board?

    Do you try to add my code in the SDK led_blinky directly, don't add other code, whether it works or not?

    About GPIOs (BOOT_CFG2, bit[7-0]), these are the boot pin:    pastedImage_1.png

  You can find these pins not include your GPIO_SD_B1_06, GPIO3_IO06 and GPIO_SD_B1_02, GPIO3_02.

  The boot pin will influence the boot, but your said, your other code works, and the other GPIO also can toggle, and my code already be demonstrated works OK, so, now I also suspect your hardware, do you connect your  GPIO_SD_B1_06, GPIO3_IO06 and GPIO_SD_B1_02, GPIO3_02 to the other component in the hardware? Whether the hardware have problems or not?

   Please use the official SDK led_blinky code, and add my code to that project, you can run it from internal RAM and debug it, whether it works ok or not?

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

1,467 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Andre marcus

   Where you download the code? External flash? What's the flash you are using? Nor flash or hyper flash?

   Please check the RT reference manual, system boot chapter.

   You will find the GPIO_SD_B1_02 and GPIO_SD_B1_06 is also the flexSPI pins, which is connected to the external flash.

   pastedImage_1.png

So, if your code is running in the external flash, and you change these pin function, it will influence the code running.

Then, I suggest you can download the code to the RAM, and make sure you didn't use these pins in the hardware, eg, connected to the other component, and test it again, it should works.

Wish it helps you!

If you still have questions about it, please kindly let me know.

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

1,467 Views
farid_mabrouk
Contributor II

Hi Kerry!

I am not using external flash. I am booting from the SDRAM. I am still unable to toggle these GPIOs. Please see attached a copy of my test source code.

0 Kudos
Reply

1,467 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Andre marcus,

  I have tested  GPIO_SD_B1_06, GPIO3_IO06 on my MIMXRT1060-EVK board, the gpio toggle works OK.

  I didn't test GPIO_SD_B1_02, GPIO3_02, because my board didn't fan out this pin.

  After checking your code, I find you didn't do the IOMUXC_SetPinConfig for the GPIO3_02 and GPIO3_06.

  Please check my code, and try it again on your side:

  //=================================GPIO_SD_B1_06,GPIO3_6========================================================
    gpio_pin_config_t USER_GPIO3_6_config = {
      .direction = kGPIO_DigitalOutput,
      .outputLogic = 0U,
      .interruptMode = kGPIO_NoIntmode
  };
    GPIO_PinInit(GPIO3, 6U, &USER_GPIO3_6_config);
    
  IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B1_06_GPIO3_IO06,        /* GPIO_SD_B1_06 is configured as GPIO1_IO09 */
      0U);                                    /* Software Input On Field: Input Path is determined by functionality */
  IOMUXC_GPR->GPR28 = ((IOMUXC_GPR->GPR28 &
    (~(IOMUXC_GPR_GPR28_GPIO_MUX3_GPIO_SEL_MASK))) /* Mask bits to zero which are setting */
      | IOMUXC_GPR_GPR28_GPIO_MUX3_GPIO_SEL(0x00U) /* GPIO1 and GPIO6 share same IO MUX function, GPIO_MUX1 selects one GPIO function: 0x00U */
    );
  IOMUXC_SetPinConfig(
      IOMUXC_GPIO_SD_B1_06_GPIO3_IO06,        /* GPIO_SD_B1_06 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 */    
  //=================================GPIO_SD_B1_02,GPIO3_2========================================================
  
      gpio_pin_config_t USER_GPIO3_2_config = {
      .direction = kGPIO_DigitalOutput,
      .outputLogic = 0U,
      .interruptMode = kGPIO_NoIntmode
  };
    GPIO_PinInit(GPIO3, 2U, &USER_GPIO3_2_config);
    
  IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B1_02_GPIO3_IO02,        /* GPIO_SD_B1_02 is configured as GPIO1_IO09 */
      0U);                                    /* Software Input On Field: Input Path is determined by functionality */
  IOMUXC_GPR->GPR28 = ((IOMUXC_GPR->GPR28 &
    (~(IOMUXC_GPR_GPR28_GPIO_MUX3_GPIO_SEL_MASK))) /* Mask bits to zero which are setting */
      | IOMUXC_GPR_GPR28_GPIO_MUX3_GPIO_SEL(0x00U) /* GPIO1 and GPIO6 share same IO MUX function, GPIO_MUX1 selects one GPIO function: 0x00U */
    );
  IOMUXC_SetPinConfig(
      IOMUXC_GPIO_SD_B1_02_GPIO3_IO02,        /* GPIO_SD_B1_02 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 */  
  
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, EXAMPLE_LED_GPIO_PIN, 0U);
            GPIO_PinWrite(GPIO3, 6, 0U);
            GPIO_PinWrite(GPIO3, 2, 0U);
            g_pinSet = false;
        }
        else
        {
           // GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 1U);
            GPIO_PinWrite(GPIO3, 6, 1U);
            GPIO_PinWrite(GPIO3, 2, 1U);
            g_pinSet = true;
        }
    }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This is my GPIO3_IO06 test result:

pastedImage_1.png

I have tested from the RAM directly:

pastedImage_2.png

Please use my above code and test GPIO3_IO06 and GPIO3_IO02 again.

Any test result, please kindly let me know.

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

1,466 Views
farid_mabrouk
Contributor II

I tried your suggestion, and I still cant toggle GPIO3, Pin6 and Pin2. Please see attached a copy of my code. Does the Config GPIOs (BOOT_CFG2, bit[7-0]) has anything to do with this, or just there is some internal fault with these GPIOs. I just cant understand why I was able to toggle GPIO3, Pin16: please see my code.

Cheers!

0 Kudos
Reply

1,466 Views
farid_mabrouk
Contributor II

Sorry I attached the wrong project. New one is attached!

0 Kudos
Reply