MC60 "custom_gpio_cfg.h"

Hi, I want to use “custom_gpio_cfg.h” to initialize the GPIO.
In the file “custom_gpio_cfg.h” I expose the output configuration:


#if 1 // If needed, config GPIOs here
GPIO_ITEM(PINNAME_CTS, PINDIRECTION_OUT, PINLEVEL_HIGH, PINPULLSEL_PULLUP)
GPIO_ITEM(PINNAME_RTS, PINDIRECTION_OUT, PINLEVEL_HIGH, PINPULLSEL_PULLUP)
#endif

#endif //CUSTOM_GPIO_CFG_H

But after compiling the project and flashing the module, I don’t see that these pins are initialized.

What am I doing wrong or did I forget to do something?

Dear Sad

Please provide detailed feedback on the module model and firmware version you are using.

There is an example of GPIO used in the SDK on the official website for your reference.

// Specify a GPIO pin
Enum_PinName  gpioPin = PINNAME_NETLIGHT;
// Define the initial level for GPIO pin
Enum_PinLevel gpioLvl = PINLEVEL_HIGH;
// Initialize the GPIO pin (output high level, pull up)
Ql_GPIO_Init(gpioPin, PINDIRECTION_OUT, gpioLvl, PINPULLSEL_PULLUP);
APP_DEBUG("<-- Initialize GPIO pin (PINNAME_STATUS): output, high level, pull up -->\r\n");
// Get the direction of GPIO
APP_DEBUG("<-- Get the GPIO direction: %d -->\r\n", Ql_GPIO_GetDirection(gpioPin));
// Get the level value of GPIO
APP_DEBUG("<-- Get the GPIO level value: %d -->\r\n\r\n", Ql_GPIO_GetLevel(gpioPin));
// Set the GPIO level to low after 500ms.
APP_DEBUG("<-- Set the GPIO level to low after 500ms -->\r\n");
Ql_Sleep(500);
Ql_GPIO_SetLevel(gpioPin, PINLEVEL_LOW);
APP_DEBUG("<-- Get the GPIO level value: %d -->\r\n\r\n", Ql_GPIO_GetLevel(gpioPin));
// Set the GPIO level to high after 500ms.
APP_DEBUG("<-- Set the GPIO level to high after 500ms -->\r\n");
Ql_Sleep(500);
Ql_GPIO_SetLevel(gpioPin, PINLEVEL_HIGH);
APP_DEBUG("<-- Get the GPIO level value: %d -->\r\n", Ql_GPIO_GetLevel(gpioPin));

Thanks Grey,
but I would like to use the file “custom_gpio_cfg.h” to initialize the GPIO.

I am using the MC60. Version: MC60CAR01A12

Dear Sad

Not sure what you mean. The “custom_gpio_cfg.h” file is an encapsulation function declaration and cannot be operated.

Hi Grey,
The documentation on the MC60 says that I can do GPIO initialization using the “custom_gpio_cfg.h” file or use the API.

In OpenCPU, there are two ways to initialize GPIOs. One is to configure initial GPIO list in custom_gpio_cfg.h, please refer to Chapter 4.3; the other way is to call GPIO related APIs to initialize after App starts.

So, I’m interested in how to do GPIO initialization using the “custom_gpio_cfg.h” file?
It’s not quite clear to me how this needs to be done correctly.

Dear Sad

May I ask what document you specifically read that you can use “custom_gpio_cfg.h” to initialize GPIO?Specific chapter catalogue feedback.Thank you.

Hi Grey,

In the document “Quectel_MC60-OpenCPU_Series_User_Guide_V2.0” in paragraph 5.7.2.3. GPIO Initial Configuration about this is written.

Dear Sad

You changed the “custom_gpio_cfg. H” file by calling "GPIO_ITEM(PINNAME_CTS, PINDIRECTION_OUT, PINLEVEL_HIGH, PINPULLSEL_PULLUP)

GPIO_ITEM(PINNAME_RTS, PINDIRECTION_OUT, PINLEVEL_HIGH, PINPULLSEL_PULLUP)" but no GPIO is initialized.These two statements modify the GPIO default state so that the level is reversed when used for power control, but to actually use the GPIO reversal, use the “Ql_GPIO_Init” function.