Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] PCAN QList Error when using a USB hub
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] PCAN QList Error when using a USB hub

Scheduled Pinned Locked Moved General and Desktop
pcan
2 Posts 1 Posters 721 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tecnova
    wrote on last edited by Tecnova
    #1

    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
                                        PCAN_CHANNEL_CONDITION,
                                        (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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Tecnova
      wrote on last edited by
      #2

      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].

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved