Hi @GarageDirt ,
Every GPIO, you can control it.
To your mentioned SDK project, about the detail GPIO code, please check the pin_mux.c in the board folder, you can find the GPIO definition:
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_04_GPIO9_IO03, /* GPIO_AD_04 is configured as GPIO9_IO03 */
0U); /* Software Input On Field: Input Path is determined by functionality */
The board .h also define it:
#ifndef BOARD_USER_LED_GPIO
#define BOARD_USER_LED_GPIO GPIO9
#endif
#ifndef BOARD_USER_LED_GPIO_PIN
#define BOARD_USER_LED_GPIO_PIN (3U)
#endif
This code will configure the detail pins:
GPIO_PinInit(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, &led_config);
So, if you want to change the pin, just add your related GPIO pin in the pinmux, then do the same like the above code.
Wish it helps you!
If you still have questions about it, please kindly let me know.
Kerry
Hi Kerry, I got your reply but I am not understanding the actual steps needed to control I/O.
I can see in pin_mux.c and board.h, the code you referred to. It's there. I don't know how it got there. To make it easier for me, tell me how to do the following:
Right now, the green led is flashing. Let's say I want to add code to make the red led flash at the same time. What actual lines of code do I add to make this happen? I mean, the actual things I need to type and where to type them.
Hi @GarageDirt ,
Please keep patient, as it is really very simple, I give you the thought, you need to learn it at first.
1. add code to make the red led flash at the same time.
You need to check the board schematic, check which detail GPIO pin it is connected to your mentioned red led, just like the green led, it also has the GPIO number.
2. Define your red led GPIO pin function the pinmux.c
3. In our main code, initialize the GPIO for your red led.
Please learn it and do it by yourself.
If you still have questions about it, please kindly let me know.
Best Regards,
kerry
Ok, here is what I did, starting with the igpio_led_cm7 program, and your instructions.
What I did... Checking schematic I find green led is pin M13 with label GPIO_AD_04 for the green led and L14 with label GPIO_AD_26 for the red led.
Next, I go to ConfigTools to add the red led to the pins list. I add GPIO_AD_26 to the list of 7 items that are already there. I DO NOTE that GPIO_AD_04 for the green led is NOT THERE. Why not? The green led flashes when you run the code, it flashes. Shouldn't it be on the pins list?
What I did.... I go to pin_mux.c and see there are four items in the BOARD_InitPins list.
I do see that GPIO_AD_04 the pin for a green led is there. So, what I did is type in the following:
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_26_GPIO9_IO03, 0U); // code for red led
Now, there are 5 items on the list.
The first line of code after main(void) is:
gpio_pin_config_t led_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
Am I supposed to modify that? If so, in what way?
Next, in main(void) I see BOARD_InitPins, when I look inside that, I can see all 5 items on the list, including code for both red and green leds.
I don't know what else to do now, so I try Build....
I get 3 errors.... too few arguments to function IOMUXC_SetPinMux. What do I do now... it is exactly the same as the code for the green led.
Extreme frustration continues.
Hi @GarageDirt
Check my reply in your another post:
https://community.nxp.com/t5/i-MX-RT/Both-LED-s/td-p/1295019
Which I already share my testing project with the MCUXpresso IDE, it works OK.
If you still have issues about it, please kindly let me know.
Kerry