Important: Please read the Qt Code of Conduct -

[SOLVED] PCAN QList Error when using a USB hub

  • Hello,
    I'm using PCAN to generate and send CAN Messages. Everything worked till now, I could create and send Messages. And I could see all my send CAN Messages on the PCAN-View Tool.
    My problem now is that I pluged in a USB hub where I have two serial devices pluged in.
    Now I get: ASSERT failure in QList<T>::at: "index out of range" when I call a PCAN libary function.

    QPair<bool, BYTE> Simulation::checkUSBChannel()
        int iBuffer;
        TPCANStatus state;
        for(BYTE i = 0; i < 8; i++)
            state = CANDriver->GetValue(handleArr[i],  //when I call this function I get the error
                                        (void*)&iBuffer, sizeof(iBuffer));
            if((state == PCAN_ERROR_OK) && (iBuffer == PCAN_CHANNEL_AVAILABLE))
                return QPair<bool, BYTE>(true, handleArr[i]);
        return QPair<bool, int>(false, 0);
    TPCANStatus PCANBasicClass::GetValue(
            BYTE Channel,
            BYTE Parameter,
            void *Buffer,
            DWORD BufferLength)
        if(!functionLoaded) //the function gets loaded from the dll file
            return PCAN_ERROR_UNKNOWN;
        //and when i call this the QList error occures
        return (TPCANStatus)m_pGetValue(Channel, Parameter, Buffer, BufferLength); 

    I also get this error when I call the PCAN initialize function.
    When I only plug in the PCAN USBstick into the hub it works too, but as soon as I plug in one of my serial devices anywhere on my PC I get that error again. The PCAN Applications are working no mather what I plug in and where.

    I have absolutly no clue what is wrong.
    If some one has any idea what could be wrong, please answer.
    Thanks to everyone

  • I think I solved it. I pluged the electricity source into the USB hub and now it is working (still don't really know why). I will do some more testing, if it still works I will change the topic to [soved].

Log in to reply