CPX Stalls
Posted: Thu Apr 07, 2022 4:20 pm
I am using the latest aideck-esp-firmware, aideck-gap8-examples (with the wifi_jpeg_streamer), and crazyflie-firmware (i.e., all main/master branches). So far the demo works fine, and I get about 10fps when using opencv-viewer.py.
However, once I add a very simple functionality in the crazyflie-firmware app layer to send some data STM32 -> GAP8, I observe communication stalls for WiFi. In particular, the frame rate is initially also 10fps and quickly (after 10sec) drops to 0.1 fps. If I enable UART logging on the ESP32 the issue magically disappears (but the framerate also drops to about 2fps). To me it seems like an issue with either flow control or even buffer sizes (my StatePacket_t is small, about 19 Bytes). Increasing the RX Buffer on the GAP8 (from 5 to 20) does not help. Reducing the TASK_FREQ from 10 to 1 helps (but the bandwidth should be sufficient to handle a frequency of at least 10 Hz).
Any thoughts?
However, once I add a very simple functionality in the crazyflie-firmware app layer to send some data STM32 -> GAP8, I observe communication stalls for WiFi. In particular, the frame rate is initially also 10fps and quickly (after 10sec) drops to 0.1 fps. If I enable UART logging on the ESP32
Code: Select all
esp_log_level_set("ROUTER", ESP_LOG_DEBUG);
Any thoughts?
Code: Select all
#define TASK_FREQ 10
typedef struct
{
// some data
} __attribute__((packed)) StatePacket_t;
// static StatePacket_t cf_state;
static CPXPacket_t cpx_packet;
void appMain()
{
uint32_t lastWakeTime;
//Wait for the system to be fully started to start stabilization loop
systemWaitStart();
cpxInitRoute(CPX_T_STM32, CPX_T_GAP8, CPX_F_APP, &cpx_packet.route);
cpx_packet.dataLength = sizeof(StatePacket_t);
StatePacket_t* state_packet = (StatePacket_t*)&cpx_packet.data;
vTaskDelay(10000); // wait until WiFi is connected
lastWakeTime = xTaskGetTickCount();
while (1)
{
vTaskDelayUntil(&lastWakeTime, F2T(TASK_FREQ));
// Updating state data
// ...
cpxSendPacket(&cpx_packet, /*timeout*/ 10 /* ms */);
}
}