He intentado llamar a una función de inicio pero, como resultado, termina en un bucle sin fin tonto. Estoy utilizando los módulos ESP32DevKit y M95 GSM en un circuito personalizado. El código relacionado se muestra a continuación.
ESP_LOGE("libM95Init","Step");
memset(client, 0, sizeof(m95_client));
ESP_LOGE("libM95Init","Step");
client->state = GSM_STATE_FIRST_INIT;
ESP_LOGE("libM95Init","Step");
//Configure UART1 parameters
uart_param_config(uart_num_gsm, &gsm_uart_config);
ESP_LOGE("libM95Init","Step");
//Set UART1 pins(TX: IO4, RX: I05, RTS: IO18, CTS: IO19)
uart_set_pin(uart_num_gsm, GSM_RXD, GSM_TXD, GSM_RTS, GSM_CTS);
ESP_LOGE("libM95Init","Step");
//Install UART driver (we don't need an event queue here)
//In this example we don't even use a buffer for sending data.
uart_driver_install(uart_num_gsm, M95_BUF_SIZE * 2, M95_BUF_SIZE * 2, 0, NULL, 0);
ESP_LOGE("libM95Init","Step");
atCmd_waitResponse("AT+QPOWD=0\r\n", GSM_OK_Str, NULL, strlen("AT+QPOWD=0\r\n"), 1000, NULL, 0);
ESP_LOGE("libM95Init","Step");
vTaskDelay(1000 / portTICK_RATE_MS);
ESP_LOGE("libM95Init","Step");
uint8_t my_buff[2048] = {0};
ESP_LOGE("libM95Init","Step");
uart_read_bytes(uart_num_gsm, my_buff, 2048, 100 / portTICK_RATE_MS);
ESP_LOGE("libM95Init","Step");
//GSM Power ON
libM95PowerBtnToggle(client);
ESP_LOGE("libM95Init","Step");
vTaskDelay(1000 / portTICK_RATE_MS);
ESP_LOGE("libM95Init","Step");
uart_flush(uart_num_gsm);
ESP_LOGE("libM95Init","Step");
ESP_LOGI(TAG,"GSM initialization start");
vTaskDelay(500 / portTICK_PERIOD_MS);
ESP_LOGE("libM95Init","Step");
if(!GSM_Cmd_Seq_Run(GSM_Init, GSM_InitCmdsSize))
{
client->state = GSM_STATE_INIT_FAIL;
}
ESP_LOGI(TAG,"GSM initialized.");
if(GSM_STATE_FIRST_INIT == client->state)
{
ESP_LOGI(TAG,"GPRS initialization start");
vTaskDelay(500 / portTICK_PERIOD_MS);
if(!GSM_Cmd_Seq_Run(GPRS_Init, GPRS_InitCmdsSize))
{
client->state = GSM_STATE_INIT_FAIL;
}
ESP_LOGI(TAG,"GPRS initialized");
}
Esta es la func. que he estado tratando de llamar. A continuación, cómo lo llamo desde main ().
// configure output GPIO
gpio_config_t io_conf;
//disable interrupt
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
//set as output mode
io_conf.mode = GPIO_MODE_INPUT_OUTPUT;
//bit mask of the pins that you want to set
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL_1_TO_32;
//disable pull-down mode
io_conf.pull_down_en = 0;
//enable pull-up mode
io_conf.pull_up_en = 0;
//configure GPIO with the given settings
gpio_config(&io_conf);
//QueueHandle_t clientQueue = xQueueCreate(1024,sizeof(char));
//if(clientQueue == NULL)
//{
//ESP_LOGE(TAG,"Client Queue Returned NULL");
//}
//enum gsm_state state = GSM_STATE_INIT_FAIL;
m95_client client;
//client.xSendingQueue = clientQueue;
//client.state = state;
libM95Init(&client);
/*TaskHandle_t xHandle = NULL;
xTaskCreate(&libM95Init, "libM95Init Func.", configMINIMAL_STACK_SIZE, &client, 2, &xHandle);
if(xHandle != NULL)
{
ESP_LOGE(TAG,"libM95Init() task returned NULL");
vTaskDelete(xHandle);
}*/