Using Emulator to write to a serial port?

Hello guys,
Anyone know how to test my application using the Emulator to write a serial device? FTDI ?

I noticed the emulator has a menu on top that says Emulator Serial Ports but I only see Com2 and my Device is hooked to Com5?

any idea?

th ebelow doesn’t give any exception but my code doesn’t talk to my serial device…


private static readonly SerialPort Esp = new SerialPort("COM2", 115200, Parity.None, 8, StopBits.One); 

and this gives an exception when the emulator starts: using COM5


private static readonly SerialPort Esp = new SerialPort("COM5", 115200, Parity.None, 8, StopBits.One);

Thanks

Did you try to change the COM-Port number inside the … hmmm… “Device-Manager” in your windows system ?
(Sorry, I only have a german windows. I don’t know the exact name in English windows and my English is… you can read it :-[ )

Good suggestion but that didn’t help!

I believe there is a xml configuration file for the emulator where you can equate the PC com port number to the emulated device com port number.

Thanks Mike I tried that but nothing happened…


C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.4\Tools\Microsoft.SPOT.Emulator.Sample.SampleEmulator.exe.emulatorconfig


    <PhysicalSerialPort id="COM5">
      <ComPortHandle>Usart5</ComPortHandle>
      <PhysicalPortName>COM5</PhysicalPortName>
      <BaudRate>115200</BaudRate>
    </PhysicalSerialPort>


Does anyone know if I need the following reference: as I can’t find it anywhere :frowning:


Using  Microsoft.SPOT.Emulator

Some ideas :

Can you connect to your device with a normal terminal program ?
(If you need to send some character sequences I prefer “docklight terminal” which has programmable buttons)

Do you have a tool to take a look at the serial lines (LED adapter or something else ) ?
No need to see every single bit, but blinking LEDs are very useful for a first check.

Do you have a second COM-Port and a adapter cable (in german its called “Null-Modem-Kabel”) to connect both COM-Ports and check your program output with a terminal program?

… and :

ask google for “rs232 spy cable” !
There are some schematics for a spy adapter. I am always using this sort of adapter (with additional LEDs) if I need to program and test a serial connection.

Any success with the emulator ? ???

nope… i resorted to the hardware… and called a day… but i’m interested in knowing how to get that done one day :slight_smile:

I believe there is a chapter in the book Expert .Net Micro Framework

that addresses this.