Pages: [1]   Go Down
Author Topic: Recognizing the UNO on a com port  (Read 2030 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 59
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi:

I had a windows service developed for recognizing the Arduino board when it's plugged into a PC.  I have a couple of project using the Due, Lilypad and UNO.  It's similar to when a person plugs in a board and the IDE knows which ports are being made available on that device.  I have no problem getting the com port for the Due and Lilypad to be recognized, but for some reason the UNO remains silent.  Is there something new about the way the UNO uses a com port or announces itself to the system that prevents it from working compared to the Due?

Thanks,

Icek
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you saying that the Uno fails to respond after data has been written to it from the PC?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 59
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, the UNO works fine.  What I am saying is that for some reason the Due is able to announce itself tot he PC, but the UNO remains silent.  Yet when I launch the IDE it will recognize the port the UNO is on and I am able upload the code to it without a problem.  With the Due I am able to register it being connected to the PC and have it assigned a port.  With the UNO I don't see it.  I was just wondering if there is something new about the way an UNO connects to the PC on its serial port that causes it not to appear.

Icek
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Due is able to announce itself tot he PC, but the UNO remains silent

Annonce itself?  In what way?  WM_DEVICECHANGE message?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 59
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I believe that is what we are using.

Icek
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Two things...

1. WM_DEVICECHANGE message is WAY outside the realm of the Arduino.  While I'm willing to try and help, I suspect I'm alone.  You may be better served by soliciting for advice on a Windows development forum.

2. In my experience, every USB insertion results in a WM_DEVICECHANGE message being broadcast.  I believe Configuration Manager is responsible for broadcasting the message so it is unlikely that the "new" Uno driver is causing the problem.  The Uno uses a different driver so the WM_DEVICECHANGE message parameters may be different.  If I were in your shoes, I'd start with the WM_DEVICECHANGE message handler.  First ensure that the message makes it to your handler when an Uno is inserted.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 59
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, thanks for your help and advice.

Icek
Logged

Manipur
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Hardware Enthusiasts
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I have installation problem. I could find only COM1 as serial Port. I think I have not properly done the installation when I first connect the Arduino Duemilanove board to my PC. Can anyone please suggest how can I bring the USB Serial port of the Board so that I can download my code to the board.

Thanks
Yumnam Kirani Singh
Logged

Tellus
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Asking on a Win32 forum isn't going to lead anywhere if UNO is misbehaving.

What type of notification are you requesting for your WM_DEVICECHANGE?
It makes a difference how you ask. Try using the GUID method.
Here's a little code that works for me, but I don't own a UNO (yet)
so I haven't tested on it. For more info on WM_DEVICECHANGE,
look it up on MSDN, it's fairly well documented.

HTH // L.

First, global stuff.
Code:
#include <dbt.h> // Needed for DEV_BROADCAST_PORT
HDEVNOTIFY          hDevNfy = 0;

Then the request, for example in WM_CREATE/WM_INITDIALOG.

Code:
    DEV_BROADCAST_DEVICEINTERFACE devFilter;
#ifndef GUID_CLASS_COMPORT
    DEFINE_GUID( GUID_CLASS_COMPORT,
        0x86e0d1e0L, 0x8089, 0x11d0, 0x9c,0xe4,0x08,0x00,0x3e,0x30,0x1f,0x73 );
#endif
    // Request notifications when COM ports are added/removed
    memset( &devFilter, 0, sizeof(devFilter) );
    devFilter.dbcc_size = sizeof(devFilter);
    devFilter.dbcc_devicetype = DBT_DEVTYP_PORT;
    devFilter.dbcc_classguid = GUID_CLASS_COMPORT;
    hDevNfy = RegisterDeviceNotification(
        hWnd, &devFilter, DEVICE_NOTIFY_WINDOW_HANDLE
        );

Then the response, in your window proc.

Code:
        case WM_DEVICECHANGE:
        {
            PDEV_BROADCAST_PORT pDevPort;
            pDevPort = (PDEV_BROADCAST_PORT) lp;
            if (!pDevPort) return TRUE; // Allow config changes
            if (pDevPort->dbcp_devicetype == DBT_DEVTYP_PORT)
                switch( wp )
                {
                case DBT_DEVICEARRIVAL: {
                    AddComPortItem( hComList, pDevPort->dbcp_name );
                    const char* const S_ComAdd = "COM port added - %s\n";
                    SB_SetText( hStatBar,2,strfmt( S_ComAdd, pDevPort->dbcp_name ));
                    DPrint( S_ComAdd, pDevPort->dbcp_name );
                  } return TRUE;
               
                case DBT_DEVICEREMOVECOMPLETE: {
                    RemoveComPortItem( hComList, pDevPort->dbcp_name );
                    const char* const S_ComRem = "COM port removed - %s\n";
                    SB_SetText( hStatBar,2,strfmt( S_ComRem ,pDevPort->dbcp_name ));
                    DPrint( S_ComRem, pDevPort->dbcp_name );
                  } return TRUE;
                }
            return TRUE;
        } // WM_DEVICECHANGE
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I have installation problem

@yumnam...

Please post problems with installation in this section...
http://arduino.cc/forum/index.php/board,2.0.html
Logged

Chile
Offline Offline
Edison Member
*
Karma: 35
Posts: 1251
Arduino rocks?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Which service is failing to detect the uno?

You can see in Windows devices that the uno is creating the COM port, so it might be a failure in your application. If you don't require a constant monitoring, I suggest to use a simple approach like this (C#):

Code:
private void UpdateSerialPortList()
{
    ClearSerialPortList();
    String[] ports = SerialPort.GetPortNames();

    if (originalPorts.Length == 0)
        originalPorts = ports;

    foreach (String s in SmartSort(ports))
    {
        ToolStripMenuItem i = new ToolStripMenuItem(s + ((Array.IndexOf(originalPorts, s) == -1) ? " (new)":""));
        i.Tag = "port_" + s;
        i.Click += new System.EventHandler(connectToToolStripMenuItem_Click);

        connectToToolStripMenuItem.DropDownItems.Add(i);
    }
}
« Last Edit: February 17, 2011, 08:37:44 pm by eried » Logged

My website: http://ried.cl

Pages: [1]   Go Up
Jump to: