none
Higher serial ports in emulator RRS feed

  • Question

  • I want to use the emulator (v3) to run code that talks through two RS232 ports.  This would be through a virtual port on the PC that is mapped to in the emulator propertes box.  I have generated a CE image where I have selected the check boxes for the two extra serial ports in the Catalog Items view however when running the program in the emulator the return value of SerialPort.GetPortNames() is only "COM1".

    The virtual port mapping tool indicates that the emulator has connected to the port so my assumption is that the problem is in the CE image I generated.  I understand the lower com port can get used for debug so I really need to enable both the extra ports.  Has anyone had sucess getting these ports working in the emulator?

    Many thanks

    Monday, August 20, 2012 12:12 PM

Answers

  • Bruce, tomleijen

    Many thanks for your help, I believe I have the right settings now.  It did work yesterday, I just forgot to map port 1 and it seems to start numbering for the lowest mapped port.  Tomlejen, you are correct that I didn't need to change the CreateSerialObject funcion, simply use 0 for the DeviceArrayIndex for all the ports.  I now (finally) present the registry entries for the two additional serial ports.

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial2]
       "DeviceArrayIndex"=dword:0
       "Irq"=dword:17
       "MemBase"=dword:50004000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:3
       "ISTTimeouts"=dword:200
       "Prefix"="COM"
       "Dll"="serial_smdk2410.dll"
       "Order"=dword:0
       "Priority"=dword:0
       "Port"="COM2:"
       "DeviceType"=dword:0
       "FriendlyName"="COM2:"
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial3]
       "DeviceArrayIndex"=dword:0
       "Irq"=dword:0F
       "MemBase"=dword:50008000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:6 ; UART 0 Interrupt Sub Register shift bit.
       "ISTTimeouts"=dword:200    ; every 512 ticks checking Modem status.
       "Prefix"="COM"
       "Dll"="serial_smdk2410.dll"
       "Order"=dword:0
       "Priority"=dword:0
       "Port"="COM3:"
       "DeviceType"=dword:0
       "FriendlyName"="COM3:"
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00

    • Marked as answer by adam0 Wednesday, August 29, 2012 8:00 AM
    Wednesday, August 29, 2012 7:58 AM

All replies

  • Do you have registry settings for the extra serial ports, so that a driver will load?

    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com

    Monday, August 20, 2012 4:15 PM
    Moderator
  • I've tried adding them but I can't find what they should be anywhere.  I cobbled the following together from the serial port 1 and the membase from the irport registry examples.  Needless to say it didn't work.

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial2]
       "DeviceArrayIndex"=dword:0
       "Irq"=dword:1c
       "MemBase"=dword:50008000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:0
       "ISTTimeouts"=dword:200
       "Prefix"="COM"
       "Dll"="serial_smdk2410.dll"
       "Order"=dword:0
       "Priority"=dword:0
       "Port"="COM2:"
       "DeviceType"=dword:0
       "FriendlyName"="COM2:"
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00

    Tuesday, August 21, 2012 12:32 PM
  • I've got a little further, the smdk2410 refers to a board using the S3C2410 (datasheet: http://pdf1.alldatasheet.com/datasheet-pdf/view/84872/SAMSUNG/S3C2410A.html)

    Using the UART information there I get the following registry settings:

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial2]
       "DeviceArrayIndex"=dword:1
       "Irq"=dword:17
       "MemBase"=dword:50004000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:0 ; UART 0 Interrupt Sub Register shift bit.
       "ISTTimeouts"=dword:200    ; every 512 ticks checking Modem status.
       "Prefix"="COM"
       "Dll"="serial_smdk2410.dll"
       "Order"=dword:0
       "Priority"=dword:0
       "Port"="COM2:"
       "DeviceType"=dword:0
       "FriendlyName"="COM2:"
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial3]
       "DeviceArrayIndex"=dword:2
       "Irq"=dword:0F
       "MemBase"=dword:50008000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:0 ; UART 0 Interrupt Sub Register shift bit.
       "ISTTimeouts"=dword:200    ; every 512 ticks checking Modem status.
       "Prefix"="COM"
       "Dll"="serial_smdk2410.dll"
       "Order"=dword:0
       "Priority"=dword:0
       "Port"="COM3:"
       "DeviceType"=dword:0
       "FriendlyName"="COM3:"
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00

    COM2 now seems to work however nothing on COM3.  The IR port uses COM3 so I commented that out but it didn't seem to make any difference.

    Also using the standard COM1 it seems to get stuck when I write to it (the string comes out the port but the WriteLine function never returns, with no hardware flow control this confuses me, unless I have the IRQ wrong?).

    Any suggestions on why I can't get COM3 or why COM1 is acting up?

    Thanks

    Thursday, August 23, 2012 1:06 PM
  • (though I assume the COM1 is from debug type information trying to go through the same port)
    Thursday, August 23, 2012 1:28 PM
  • If you can, check the CreateSerialObject() function in your S3C2410 driver, this will give you some more information on what DeviceArrayIndex values you need to pick. The DeviceArrayIndex value is related to the configuration of the port, not necessarily the Index, if anything, it may give you a lead as to why COM1 starts acting up when you activate COM2.
    Sunday, August 26, 2012 10:24 PM
  • The CreateSerialObject only defined DeviceArrayIndex 0 and 1 and the 1 had a definition that appeared to be for the IR port (CPdd2410Serial2 though I didn't find these actual definitions).  I have now changed the function to the following:

    CSerialPDD * CreateSerialObject(LPTSTR lpActivePath, PVOID pMdd,PHWOBJ pHwObj, DWORD DeviceArrayIndex)
    {
        CSerialPDD * pSerialPDD = NULL;
        switch (DeviceArrayIndex) {
          case 0:
            pSerialPDD = new CPdd2410Serial1(lpActivePath,pMdd, pHwObj);
            break;
          case 1:
            pSerialPDD = new CPdd2410Serial1(lpActivePath,pMdd, pHwObj);
            break;
          case 2:
            pSerialPDD = new CPdd2410Serial1(lpActivePath,pMdd, pHwObj);
            break;
        }
        if (pSerialPDD && !pSerialPDD->Init()) {
            delete pSerialPDD;
            pSerialPDD = NULL;
        }    
        return pSerialPDD;
    }
    Also I have gone through the device emulator code (http://www.microsoft.com/en-us/download/details.aspx?id=10865) and the datasheet again and the InterruptBitsShift registry settings should be 0, 3 and 6 for the three ports respectively.

    Now I see COM1 comes out Serial Port 2, COM 2 comes out Serial port 3 and COM3 doesn't work.  I'm guessing now I'm looking at the port reallocation from the debug mode? (I have switched off KITL to make the emulator work so I should try to change this if it is really the case).

    Tuesday, August 28, 2012 2:41 PM
  • Looks like you didn't need to change any of the code in CreateSerialObject... case 0, 1 and 2 now all do the exact same thing. I would go back to your original code and change the DeviceArrayIndex value for all three ports to the same value matching whichever case calls: pSerialPDD = new CPdd2410Serial1(lpActivePath,pMdd, pHwObj);

    I would look at your MemBase value.

    The MemBase value determines which hardware registers your driver writes to/reads from. Since some of your ports are working it seems that you have selected the right MemBase values, only they are linked to the wrong serial port driver. If you change your COM3 MemBase to 50004000 (the value you had for COM2), put the MemBase you entered for COM1 in the COM2 entry and figure out what MemBase you need for COM1. If you are certain that you have selected the right MemBase values, you will need to look at the mapping of the ports of your emulator.

    Wednesday, August 29, 2012 4:14 AM
  • Look at Page 11-10 of that datahseet you linked to:

    UART SPECIAL REGISTERS
    UART LINE CONTROL REGISTER
    There are three UART line control registers including ULCON0, ULCON1, and ULCON2 in the UART block.
    Register Address R/W Description Reset Value
    ULCON0 0x50000000 R/W UART channel 0 line control register 0x00
    ULCON1 0x50004000 R/W UART channel 1 line control register 0x00
    ULCON2 0x50008000 R/W UART channel 2 line control register 0x00

    It looks like you have used these values for your MemBase, so you will probably have to look at your emulator

    • Edited by tomleijen Wednesday, August 29, 2012 4:21 AM
    Wednesday, August 29, 2012 4:17 AM
  • Bruce, tomleijen

    Many thanks for your help, I believe I have the right settings now.  It did work yesterday, I just forgot to map port 1 and it seems to start numbering for the lowest mapped port.  Tomlejen, you are correct that I didn't need to change the CreateSerialObject funcion, simply use 0 for the DeviceArrayIndex for all the ports.  I now (finally) present the registry entries for the two additional serial ports.

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial2]
       "DeviceArrayIndex"=dword:0
       "Irq"=dword:17
       "MemBase"=dword:50004000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:3
       "ISTTimeouts"=dword:200
       "Prefix"="COM"
       "Dll"="serial_smdk2410.dll"
       "Order"=dword:0
       "Priority"=dword:0
       "Port"="COM2:"
       "DeviceType"=dword:0
       "FriendlyName"="COM2:"
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial3]
       "DeviceArrayIndex"=dword:0
       "Irq"=dword:0F
       "MemBase"=dword:50008000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:6 ; UART 0 Interrupt Sub Register shift bit.
       "ISTTimeouts"=dword:200    ; every 512 ticks checking Modem status.
       "Prefix"="COM"
       "Dll"="serial_smdk2410.dll"
       "Order"=dword:0
       "Priority"=dword:0
       "Port"="COM3:"
       "DeviceType"=dword:0
       "FriendlyName"="COM3:"
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00

    • Marked as answer by adam0 Wednesday, August 29, 2012 8:00 AM
    Wednesday, August 29, 2012 7:58 AM