Mission plannner showing `No space available to send`

This function prints “no space available to send”. when connected to BLDC motor.

Can someone explain how _can_iface->flush_tx() works ?

Also what this function is doing ret = _can_iface->select(read_select, write_select, &out_frame, timeout);

bool QP_VecrosCAN::write_frame(AP_HAL::CANFrame &out_frame, uint64_t timeout)
{
    // wait for space in buffer to send command
    bool read_select = false;
    bool write_select = true;
    bool ret;
    _can_iface->flush_tx();
    hal.scheduler->delay_microseconds(500);
    do
    {
        ret = _can_iface->select(read_select, write_select, &out_frame, timeout);
        // GCS_SEND_TEXT(MAV_SEVERITY_INFO," return ret: %d", ret ); 
        if ( !ret || !write_select)
        {
            // delay if no space is available to send

            hal.scheduler->delay_microseconds(700);
            GCS_SEND_TEXT(MAV_SEVERITY_INFO, "no space available to send");
        }
    } while (!ret || !write_select);
    // send frame and return success
    return (_can_iface->send(out_frame, timeout, AP_HAL::CANIface::AbortOnError) == 1);
}```