MaJerle / lwcell

Lightweight cellular modem host AT library
MIT License
413 stars 154 forks source link

I am not getting any response with sim7600e #61

Closed sushant-ht closed 3 years ago

sushant-ht commented 3 years ago

i am trying to use lwgsm library with esp32 and sim7600e, and i am facing problem, i get

Cannot initialize LwGSM

i have changed following steps in Library

/ Defines ESP uart number to use /

define GSM_UART_NUM UART_NUM_1

ESP_ERROR_CHECK(uart_set_pin(GSM_UART_NUM, 26, 25, 0, 0));

i had written an uart routine to check AT command with same UART setting i do get AT response from modem. i have insert a debug line in uart events routine, this line is never invoked

case UART_DATA:
            **printf("[UART DATA]: %d", event.size);**
          uart_get_buffered_data_len(GSM_UART_NUM, &buffer_len);
MaJerle commented 3 years ago

Code you are showing is not library specific.

sushant-ht commented 3 years ago

i modified lwgsm_ll_esp32.c

`/**

/*

if !DOXYGEN

/ Define TAG for log messages /

define TAG "lwGSM"

/ Defines ESP uart number to use / #define GSM_UART_NUM UART_NUM_1

if !defined(LWGSM_USART_DMA_RX_BUFF_SIZE)

define LWGSM_USART_DMA_RX_BUFF_SIZE 0x1000

endif / !defined(LWGSM_USART_DMA_RX_BUFF_SIZE) /

if !defined(LWGSM_MEM_SIZE)

define LWGSM_MEM_SIZE 0x1000

endif / !defined(LWGSM_MEM_SIZE) /

static QueueHandle_t gsm_uart_queue;

static uint8_t initialized = 0;

char* uart_buffer[LWGSM_USART_DMA_RX_BUFF_SIZE];

/**

static void uart_event_task(void *pvParameters) { uart_event_t event; size_t buffer_len;

if 1

printf("uart event started");

endif

for(;;) { //Waiting for UART event. if(xQueueReceive(gsm_uart_queue, (void * )&event, (portTickType)portMAX_DELAY)) {

    #if 1
    printf("uart[%d] event:", GSM_UART_NUM);
    #endif
  switch(event.type) {
    case UART_DATA:

      printf("[GSMUART DATA]: %d", event.size);

      uart_get_buffered_data_len(GSM_UART_NUM, &buffer_len);
      buffer_len = uart_read_bytes(GSM_UART_NUM, (void*) uart_buffer, buffer_len, portMAX_DELAY);
      ESP_LOG_BUFFER_HEXDUMP("<", uart_buffer, buffer_len, ESP_LOG_DEBUG);
      if (buffer_len) {
        #if LWGSM_CFG_INPUT_USE_PROCESS
          lwgsm_input_process(uart_buffer, buffer_len);
        #else
          lwgsm_input(uart_buffer, buffer_len);
        #endif
      }
      break;
    case UART_FIFO_OVF:
      ESP_LOGW(TAG, "UART_FIFO_OVF");
      uart_flush_input(GSM_UART_NUM);
      xQueueReset(gsm_uart_queue);
      break;
    case UART_BUFFER_FULL:
      ESP_LOGW(TAG, "UART_BUFFER_FULL");
      uart_flush_input(GSM_UART_NUM);
      xQueueReset(gsm_uart_queue);
      break;
    default:
      break;
  }
}

} vTaskDelete(NULL); } /**

} /**

/**

endif / !DOXYGEN /

`

sushant-ht commented 3 years ago

i have modified UART_event example from esp32 idf and it works well, i am atleast getting AT response here code and log snippet

` /* Configure parameters of an UART driver,

`I (15771) scan: [Command]: AT  I (15771) scan: uart[1] event: I (15771) scan: [UART DATA]: 9 I (15771) scan: [IN DATA] AT

OK

`

sushant-ht commented 3 years ago

It was solved It was my mistake as RESET line stayed LOW.