UART1 writes only "A"
Posted: Sun Aug 06, 2017 4:16 pm
Hi,
I have ESP32 from WeMos. Using uart0 for DEBUG thourgh USB. I configured uart1 to GPIO4(RX), GPIO2(tx). Plugged uart1 to USB serial converter.
Both uarts running at 115200bps. Uart1 should work as communication betweern AI Thinker A7 (GSM module). I'm basicly trying to write "AT\r". What I can see is only "AA...". I also tested GSM module it works (with USB-serial) (in this point, GSM module is not attached!). uart1 is attached to USB-Serial.
If I change in my program
to
I can see correct output. There must be definitely some problem with uart1.
Serial monitors: Arduino IDE
Configuration:
Any idea what's my problem? Thanks
I have ESP32 from WeMos. Using uart0 for DEBUG thourgh USB. I configured uart1 to GPIO4(RX), GPIO2(tx). Plugged uart1 to USB serial converter.
Both uarts running at 115200bps. Uart1 should work as communication betweern AI Thinker A7 (GSM module). I'm basicly trying to write "AT\r". What I can see is only "AA...". I also tested GSM module it works (with USB-serial) (in this point, GSM module is not attached!). uart1 is attached to USB-Serial.
If I change in my program
Code: Select all
uart_write_bytes(UART_NUM_1, (const char*)buffer, len);
Code: Select all
uart_write_bytes(UART_NUM_0, (const char*)buffer, len);
Serial monitors: Arduino IDE
Configuration:
Code: Select all
#define UART_BUFF_SIZE 256
#define UART_2_TXD GPIO_NUM_2
#define UART_2_RXD GPIO_NUM_4
extern "C" void app_main()
{
// Flash
nvs_flash_init();
// log
esp_log_level_set("*", ESP_LOG_NONE);
// UART
uart_config_t serialConfig =
{
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = UART_HW_FLOWCTRL_CTS_RTS
};
uart_set_pin(UART_NUM_0, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
uart_param_config(UART_NUM_0, &serialConfig);
uart_driver_install(UART_NUM_0, UART_BUFF_SIZE * 2, UART_BUFF_SIZE * 2, 0, NULL, 0);
uart_flush(UART_NUM_0);
// UART 2
uart_config_t serialConfig2 =
{
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = UART_HW_FLOWCTRL_CTS_RTS
};
uart_set_pin(UART_NUM_1, UART_2_TXD, UART_2_RXD, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
uart_param_config(UART_NUM_1, &serialConfig2);
uart_driver_install(UART_NUM_1, UART_BUFF_SIZE * 2, UART_BUFF_SIZE * 2, 0, NULL, 0);
uart_flush(UART_NUM_1);
// Tasks
xTaskCreate(&mainTask, "mainTask", 4096, NULL, 7, NULL);
}