Main Site Documentation

Bluetooth interface ArgumentException


#1

Hi all,

I got a FEZ Domino with the Bluetooth Interface from the catalog and I’m trying to run the sample code as listed on http://www.fezzer.com/project/249/bluetooth-interface/. However, on my initialization line of the SerialPort

var bluetooth = new SerialPort("COM12", 9600, Parity.None, 8, StopBits.One);

I’m getting an ArgumentException error:

    #### Exception System.ArgumentException - 0xfd000000 (1) ####
    #### Message: 
    #### Microsoft.SPOT.Hardware.NativeEventDispatcher::.ctor [IP: 0000] ####
    #### System.IO.Ports.SerialPort::.ctor [IP: 0030] ####
    #### ServoBluetoothClient.Program::Main [IP: 0017] ####
A first chance exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll

I successfully paired the Spp device with my laptop (I in fact tried two different laptops), but it always seems to throw that error. I can see the device under ‘Devices and Printers’ and in the properties of the Spp device, I can see the ‘Serial port (SPP) ‘Spp’ COM12’ item.

Any clues on how to resolve this error?

Thanks,
Rajen


#2

Domino doesn’t have COM12.

Check the pin-out

http://www.tinyclr.com/downloads/Domino/Broch_FEZ_Domino.pdf

It shows what pins can be used with what port (COM1, COM2). It also explains how to remap COM4 to An2 and An3 pins.


#3

I figured I should use COM12, as that’s the virtual COM port created on my computer, but I’m guessing your aiming at the fact that the bluetooth interface module is connected to my COM1 pins (Di0/Di1) on my Domino?

When I change COM12 to COM1 in my code, I get the exact same error, unfortunately.


#4

Can you please post an image of your connections?


#5

Image is attached. Please ignore the Di5 connection, as it is used for a servo at the moment.

Thanks,
Rajen


#6
var bluetooth = new SerialPort("COM12", 9600, Parity.None, 8, StopBits.One);

should be

SerialPort bluetooth = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);

#7

That also throws the same error, Eric.


#8

Did you add a reference to Microsoft.SPOT.Harware.SerialPort ?


#9

Yes I have, the project builds and deploys just fun.


#10

Ok, I just tried remapping the An2/An3 pins to COM4 and that seems to be working just fine. I guess that will do for now.

Thanks Architect and Eric!