-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AT command answer too fast loosing start characters #831
Comments
i don't think setting a delay is a good solution. Could you please provide the following details to find out what happened.
|
Here the answer to your questions:
This is my interrupt logic: void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size) {
/* This Data Receiving from User-Terminal driver */
if (huart->Instance == USART2) {
// Save RX Data
memcpy(main_buffer, uart_dma_rx_buffer, Size);
size_t eeprom_command_prefix_length = strlen(EEPROM_COMMAND_PREFIX);
if (strncmp( (char*)main_buffer, EEPROM_COMMAND_PREFIX, eeprom_command_prefix_length) == 0) {
eeprom_command_to_be_processed_length = Size - eeprom_command_prefix_length;
memcpy(eeprom_command_to_be_processed, main_buffer + eeprom_command_prefix_length, eeprom_command_to_be_processed_length + 1);
}else{
char *s = "Terminal -> Target\n";
HAL_UART_Transmit(&UART_TERMINAL, (uint8_t*) s, strlen(s), 10);
HAL_UART_Transmit(&UART_WIFI, uart_dma_rx_buffer, Size, 10);
}
// activate RX DAM Interrupt again
HAL_UARTEx_ReceiveToIdle_DMA(&UART_TERMINAL, uart_dma_rx_buffer, UART_BUFFER_DMA_SIZE);
}
/* This is ESP32 Wifi Data Receiving Driver */
if (huart->Instance == USART1) {
/* terminate incoming data */
memset(&esp_dma_rx_buffer[Size], '\0', 1);
memcpy(at_command_response, esp_dma_rx_buffer, Size);
if (strstr((char*) esp_dma_rx_buffer, "+MQTTSUBRECV:")) {
myprintf("Put Fifo\n");
/* new style with cube talk and nonPeriodicTask handler
* save incoming data to fifo, handle later in super loop */
wifi_module_mssg_t element;
element.eventType = eUART_WIFI_REQUEST;
element.len = Size + 1;
memcpy(element.mssg, esp_dma_rx_buffer, element.len);
circular_buf_put(&wifi_fifo, &element);
}
/* Loop Back - Echo Data To Terminal (UART2) */
HAL_UART_Transmit(&UART_TERMINAL, esp_dma_rx_buffer, Size, 10);
/* restart UART RX DMA Interrupt again */
HAL_UARTEx_ReceiveToIdle_DMA(&UART_WIFI, esp_dma_rx_buffer, ESP_BUFFER_DMA_SIZE);
}
/* this is Modbus Client (Master) Receive Driver */
if (huart->Instance == UART4) {
//app_HomeCube_UART4_Callback(Size);
}
} |
@cjoecker Sorry, I am not familiar with your MCU test code. I suggest that as a test, before communicating between the ESP32 module and the MCU, you can try to first communicate between the ESP32 module and a PC to see if it works properly, ensuring that your ESP32 module itself and the AT software are not the issue. |
@ustccw we tried with a USB-TTL Serial Modul FT232RL FTDI without flow control and it worked correctly. |
Good to know~ it seems that the AT firmware and the ESP32 module itself are fine. The issue lies with the MCU side, so you will need to troubleshoot the relevant problems on the MCU side~ |
I will check my MCU then closely. I will close the issuer for now. Thanks for your support. |
Answers checklist.
General issue report
I have a problem with the
esp32
answering some commands and I don't get some of the start characters. For example, see the answering time of these logs for the serial communication:Here, the answer to
AT
should beOK
but it is often responding just withK
. It is happening with other commands also likeAT+CIPSNTPTIME?
orAT+CWJAP?
.Is there a way to setup a delay to the
esp32
answers? Or am I doing something wrong so I don't get all the characters from theinterrupt
?The text was updated successfully, but these errors were encountered: