none
Adding Serial (COM) Ports to Answer file in ICE RRS feed

  • Question

  • Serial/COM ports are still one of the most popular and favorite hardware device amongst Embedded developers. I am having a hard time getting the COM ports to add automatically during IBW installation phase in WES7.

    Current Scenario:

    My x86 (32-bit) target board has 4 standard on-board COM ports (which uses standard Windows COM port driver). Windows 7/WES7 does not automatically detect these COM ports. So I have to manually add them and assign IRQs and Base Address by running "Add new hardware wizard" through C:\>hdwwiz.exe command which is fine. After I added all the COM ports on a standard Windows 7 install on my target board I ran the tap.exe to generate the PMQ file. Then I created an unattended Answer File, imported the PMQ file and added other necessary drivers (standard procedure for building Image using Answer file) in ICE. After that I created a IBW image by "Tools->Create Media->Create IBW Image From Answer File". After copying everything on the IBW bootable USB drive, the installation went smoothly and I got my WES7 desktop on my target device. So far everything looks good...

    Problem:

    When I went to the Device Manager I found that none of the serial ports were detected/added automatically in spite of generating a PMQ file when all the ports were installed in Windows 7. How do I make sure that my COM ports get installed automatically with correct base addresses and IRQ during the IBW wizard.

    Thanks!


    I do blog at http://blogs.koolwal.net
    Tuesday, July 27, 2010 7:40 PM

Answers

  • Guys just solved the problem!!!!!! After adding this additional Registry keys everything works great!

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\PORTS\0000\LogConf]
    "ForcedConfig"=hex(08):01,00,00,00,ff,ff,ff,ff,00,00,00,00,00,00,00,00,02,00,\
      00,00,01,00,05,00,f8,03,00,00,00,00,00,00,08,00,00,00,02,03,01,00,04,00,00,\
      00,04,00,00,00,ff,ff,ff,ff

    What I noticed was that if I uncheck the box "Automatically Assign Settings" in the COM3 Resources properties in Device Manager and restart the system the COM3 was working. So I diffed the system again with Registry monitor and noticed what got changed when I un-check that box and indeed that was the last piece of missing puzzle....:D

    Now hopefully I can do this for the other 3 COM ports..:D

    Thank you KNARZ and Sean for all the help!

     


    I do blog at http://blogs.koolwal.net
    • Marked as answer by techgeek12345 Monday, August 2, 2010 8:48 PM
    Monday, August 2, 2010 8:47 PM

All replies

  • TAP will detect the device, but not the specific driver setting details.

    1. Are the COM ports part of the chipset or a seperate PCI card?
    2. Other necessary drivers - Do you have the Multi-port Serial Adapters Driver package in the answer file?

    -Sean

     

     


    www.sjjmicro.com / www.seanliming.com, Book Author - XP Embedded Advanced, XPe Supplemental Toolkit, WEPOS / POS for .NET Step-by-Step
    Thursday, July 29, 2010 3:51 PM
    Moderator
  • TAP will detect the device, but not the specific driver setting details.

    1. Are the COM ports part of the chipset or a seperate PCI card?
    2. Other necessary drivers - Do you have the Multi-port Serial Adapters Driver package in the answer file?

    -Sean

    1. Are the COM ports part of the chipset or a seperate PCI card?

    Neither. These COM ports based of off LPC bus (very similar to ISA).

    2. Other necessary drivers - Do you have the Multi-port Serial Adapters Driver package in the answer file?

    Yes. I do have that package installed but does not make a difference.

     


    I do blog at http://blogs.koolwal.net
    Thursday, July 29, 2010 4:11 PM
  • If the device is not PnP, most likely you will have to manually add them in WES 7 as you did for Windows 7.

    If only registry keys are being setup behind the scenes, you might be able to just import a .REG file with the proper settings.

    -Sean

     


    www.sjjmicro.com / www.seanliming.com, Book Author - XP Embedded Advanced, XPe Supplemental Toolkit, WEPOS / POS for .NET Step-by-Step
    Thursday, July 29, 2010 8:56 PM
    Moderator
  • If only registry keys are being setup behind the scenes, you might be able to just import a .REG file with the proper settings.

    Sean - Yes they are not PNP type ports. I liked the idea of adding a synchronous command (may be during OOBE phase) to execute the reg (reg IMPORT filename.reg) command which will add the appropriate registry keys. I think registry entries might be the only thing that gets added to the system when the COM port is installed through device manager.

    What would be the best way (any tool) to capture the newly added registry keys when I install the COM ports? I would probably first try just adding one COM port to the system and then capture the changes and see if that approach works. If it works I will use that method for rest of the COM ports.

    Another approach would be to use devcon.exe command to install the COM ports but I don't know how to specify the Base Address and IRQ when using the command. I posted a query few days back on the Windows 7 forums regarding the devcon usage but no reply so far.


    I do blog at http://blogs.koolwal.net
    Thursday, July 29, 2010 9:12 PM
  • Here is what I found on the utility - http://support.microsoft.com/kb/311272/en-us

    I developed a utility called Component Helper that takes before and after snap shots of a system. It compares the snap shots to find the file and registry differences. It was designed for XPe component development. http://www.sjjmicro.com/XPES_Tools_R2.html It could work in this instance, but it requires .NET 1.1 to be installed on Windows 7, which are not 100% compatible. .NET 1.1 can be installed. There could be a similar tool that might do the trick.

    -Sean

     

     

     


    www.sjjmicro.com / www.seanliming.com, Book Author - XP Embedded Advanced, XPe Supplemental Toolkit, WEPOS / POS for .NET Step-by-Step
    Friday, July 30, 2010 6:24 AM
    Moderator
  • Here is what I found on the utility - http://support.microsoft.com/kb/311272/en-us


    Hi Sean,

    Yes I did find that page initially and from there I got the idea to install the COM ports by running the following command:

     

    C:\Administrator>devcon /r install C:\windows\inf\msports.inf *PNP0500

    However, the only problem with the above command is that, I don't know how to assign resource like base Addresses and IRQ for the installed COM ports using the above command. I tried searching on the Internet if we can pass Base Address and IRQ as parameters to the above command but nothing comes up. Simply by giving the above command we can see the COM port listed in the device manager but with the yellow bang because it needs the proper resources (Base Address and IRQ) to be assigned which I have to do it manually right now and which is the only problem with the devcon command.

    I will try the registry/snapshot approach today and will let you know how it goes.

    Many thanks for staying with me on this topic!

     

     


    I do blog at http://blogs.koolwal.net
    Friday, July 30, 2010 7:27 AM
  • So I diff'd the system using Active Registry Monitor before and after installing just one COM port as per the plan. I named the diff'd registry as COMInstall.reg and I tried to import into my WES7 image to test if it does installs the COM port. However I keep getting error messages like:

     

    Cannot import REG: Error accessing the registry.

     

    when I try to import the registry using the command (as Administrator):

     

    reg import C:\COMInstall.reg

     

    To verify that I am not encountering any permission issue I just took a very small subset of the above registry file and tried to add it and it worked which proves that there is no permission issue rather something wrong in the registry file.

    Here is the COMInstall.reg file that I am having problem with. Can somebody please tell me what's wrong with the file? I am really not a Windows Registry expert and hence I depend on tools like Active Registry Monitor.

    Thanks!

     


    I do blog at http://blogs.koolwal.net
    Monday, August 2, 2010 5:55 AM
  • I think this are permission problems, you try to write in "Enum\Root\Ports", if i remeber right, this never worked out fine without setting permissions. I cleaned your file - http://www.file-upload.net/download-2717179/COMInstall_edit.reg.html

    Monday, August 2, 2010 3:00 PM
  • There is allot in there, and there looks to be some extra items not needed.

    try regedit /s c:\COMInstall.reg

    What was the small subset that worked?

    -Sean


    www.sjjmicro.com / www.seanliming.com, Book Author - XP Embedded Advanced, XPe Supplemental Toolkit, WEPOS / POS for .NET Step-by-Step
    Monday, August 2, 2010 3:30 PM
    Moderator
  • There is allot in there, and there looks to be some extra items not needed.

    try regedit /s c:\COMInstall.reg

    What was the small subset that worked?

    -Sean


    www.sjjmicro.com / www.seanliming.com, Book Author - XP Embedded Advanced, XPe Supplemental Toolkit, WEPOS / POS for .NET Step-by-Step


    I already tried the regedit /s command but the same error message. The small subset that worked and by "worked" I mean at least it added those entries in the system registry but obviously those aren't enough to get it going. So at least that proves that there is no system permission issue.

    I am going to try KANRZ's modified registry file now...


    I do blog at http://blogs.koolwal.net
    Monday, August 2, 2010 4:22 PM
  • I stripped out the resources you don't need. e.g. rdyboost. ControlSet001 and Current are (in this case) the same. so only current is needed.

    it still will fail if you don't change permessions or run it as system account. (psexec makes system account possible) if you wan't to script permission changes, you can to that with regini.exe, beware the syntax is not that easy. ;)

    Monday, August 2, 2010 4:56 PM
  • I stripped out the resources you don't need. e.g. rdyboost. ControlSet001 and Current are (in this case) the same. so only current is needed.

    it still will fail if you don't change permessions or run it as system account. (psexec makes system account possible) if you wan't to script permission changes, you can to that with regini.exe, beware the syntax is not that easy. ;)

    So I tried to run the command using psexec like this:

    C:\>psexec reg import C:\COMInstall_edit.reg

    and I got the following error message:

    reg command exited with error code 1

    Using the original command (reg import) on this edited reg file gives the same error message:

    Cannot import REG: Error accessing the registry.
    Any ideas what else is missing?


    I do blog at http://blogs.koolwal.net
    Monday, August 2, 2010 6:14 PM
  • may you should take a look in command line switchtes for psexec

    psexec -s reg import

    -s Run remote process in the System account.

    Monday, August 2, 2010 6:39 PM
  • Yes, the -s argument made the registry file to be added to the system. After restarting the system, the COM port gets listed under Device Manager but with a yellow bang again because it still needs the resources to be set manually which is the same behaviour as running the devcon command as mentioned before in my post:

    C:\Administrator>devcon /r install C:\windows\inf\msports.inf *PNP0500
    Thank you KNARZ for all your help so far. Really appreciate it!.


    I do blog at http://blogs.koolwal.net
    Monday, August 2, 2010 7:08 PM
  • Guys just solved the problem!!!!!! After adding this additional Registry keys everything works great!

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\PORTS\0000\LogConf]
    "ForcedConfig"=hex(08):01,00,00,00,ff,ff,ff,ff,00,00,00,00,00,00,00,00,02,00,\
      00,00,01,00,05,00,f8,03,00,00,00,00,00,00,08,00,00,00,02,03,01,00,04,00,00,\
      00,04,00,00,00,ff,ff,ff,ff

    What I noticed was that if I uncheck the box "Automatically Assign Settings" in the COM3 Resources properties in Device Manager and restart the system the COM3 was working. So I diffed the system again with Registry monitor and noticed what got changed when I un-check that box and indeed that was the last piece of missing puzzle....:D

    Now hopefully I can do this for the other 3 COM ports..:D

    Thank you KNARZ and Sean for all the help!

     


    I do blog at http://blogs.koolwal.net
    • Marked as answer by techgeek12345 Monday, August 2, 2010 8:48 PM
    Monday, August 2, 2010 8:47 PM
  • I know this is an old thread, but I had the same issue; I was trying to add a non PNP serial com device to my configuration, but could not perform this on the final image because my application runs as the shell.  I was able to successfully install the com device using the methods above, but I wanted to summarize the steps for the sake of someone having to do the same thing.  Sorry, that this is so long; it attempts to be comprehensive.

    1) Installed WES7 with the full distribution share on my target device.

    2) Downloaded Active Registry Monitor. The page provides a link to a zip file.

    3) Install and run the Active Registry Monitor (ARM) application on the target.  Note that this is a 30 day trial installation.  Also, upon start-up it will scan the entire registry; this will take a moment.

    4) Using the ARM application, save the current registry to the desktop (or wherever).

    5) Go into the device manager and select: Action-->Add Legacy Hardware and click 'Next'.

    6) Select the "Install the hardware that I manually select from a list (Advanced)" radio button and click 'Next'.

    7) Select "Ports (COM & LPT)" from the list and click 'Next'.

    8) Select "(Standard port types)" and "Communication Port" from the lists and click 'Next'.

    9) Click 'Next' and 'Finish" when complete.

    10) Now that the COM device is installed, double-click it in the device manager list. It will likely have a yellow '!" symbol next to it.

    11) Click on the 'Resources' tab and click on the "Set Configuration Manually" button.

    12) Uncheck the "Use automatic settings" checkbox and set the appropriate "I/O Range" and 'IRQ' values (depending upon your requirements and resource availability*).

    * Note that mine complained that the resources I needed were currently in use by ACPI.  However, this was not a problem and it worked itself out upon reboot.

    13) Return to the ARM application and open registry configuration you saved in a prior step.

    14) From the ARM application, select the "HKEY_LOCAL_MACHINE" tree node.

    15) Click on the "Compare with current registry" button.  This will open a new dialog window.  Note that the button does not actually say "Compare..." just mouse over and it will pop-up its function.

    16) Click the "Save to Redo files" button and save it to desktop (this will save the .reg file that you need.)

    17) Copy the .reg file onto a flash drive (or whatever) and save on you development machine in an OEM folder directory created by you such as: "C:\Program Files (x86)\Windows Embedded Standard 7\DSSP1\$OEM$ Folders\Reg\$OEM$\$1"

    18) Once the .reg file has been copied to that path, double-click on the new "$OEM$ Folders->Reg" entry using ICE to add it to your answer file.

    19) This will add a 'PathsAndCredentials' containing your 'Reg' folder to the 'OemFolderPaths' in the 'Setup_x86' package.  Be sure to update the credentials with the appropriate username and password.

    20) Add a 'RunSynchronous' command to the 'Deployment_x86' package - pass 4 (Specialize).

    21) Edit the 'Path' value to indicate the command to be executed. Mine was: C:\Add_COM3_Port.reg

    22) Finally, be sure to set the 'Order' value (depending upon the number of entries you already have), and set the credentials to the appropriate username and password.

    Good Luck!

    Thursday, November 6, 2014 8:03 PM