I'm working with this example with ESP-IDF V4.3.2:
https://github.com/espressif/esp-idf/tr ... l/mb_slave
I have the Modbus slave running as one of my threads. When I interlace with a test program, I get the following:
When I try to get my slave polled at 10 Hz (100 ms), I get a UART event queue full, which I don't know how to clear.
I've modified the example by separating the initialization functions and the code running functions, which I've put into their own "Modbus_start()" function, which is what gets passed into the xTaskCreate function.
Code: Select all
if(event & (MB_EVENT_HOLDING_REG_WR | MB_EVENT_HOLDING_REG_RD))
{
// Get parameter information from parameter queue
ESP_ERROR_CHECK(mbc_slave_get_param_info(®_info, MB_PAR_INFO_GET_TOUT));
ESP_LOGI(SLAVE_TAG, "HOLDING %s (%u us), ADDR:%u, TYPE:%u, INST_ADDR:0x%.4x, SIZE:%u",
rw_str,
(uint32_t)reg_info.time_stamp,
(uint32_t)reg_info.mb_offset,
(uint32_t)reg_info.type,
(uint32_t)reg_info.address,
(uint32_t)reg_info.size);
}
What are some ways to avoid the UART event queue full or clear it, and how can I make sure my Modbus device gets the data from the ESP32, as it is critical to the application?
Thank you!