1

I'm trying to access a buttonbox to record subject responses in matlab, but I can't access the usb port or the device attached. I've tried a lot of variations of the following code. what I currently have is:

    port = serial ('COM2', 'BaudRate', 19200);
    handle = CMUBox('Open', 'pst', port);

I keep getting all error messages either that I'm using the wrong argument type (referring to the 3rd arg 'port' in the second line) or that no such serial port device exists (again referring to 'port').

Any ideas?

S.G.
  • 13
  • 2

1 Answers1

1

The input to CMUbox should be the port name, like 'COM2', not a port object, like the variable port. See the CMUBox docs for more details.

PS - Make sure that "COM2" is a correct port number. Often (not always) with Windows only COM3 and higher will be valid external devices.

mhopeng
  • 1,063
  • 1
  • 7
  • 17
  • 1
    COM-anything will not be a correct port name in OS X, if that's what the OP is using. – horchler Feb 19 '16 at 21:44
  • I changed the code to: `handle = CMUBox('Open', 'pst', 'COM4');` & got the error msg: Error in function OpenSerialPort: Usage error Error opening serial port device COM4 - No such serial port device exists! (2) [ENOENT]. Error using IOPort Usage: [handle, errmsg] = IOPort('OpenSerialPort', port [, configString]); Error in CMUBox (line 507) box.port = IOPort('OpenSerialPort', portName, ['InputBufferSize=51840000 HardwareBufferSizes=32768,32768 Terminator=0 ReceiveLatency=0.0001 ' pString]); I tried w/ all ports (using windows btw) – S.G. Feb 22 '16 at 15:44
  • Sounds like a driver issue. Are you using a serial-to-USB converter? Did you install drivers for it, and reboot? Docs for CMUbox and the PST device have some guidance on this. – mhopeng Feb 23 '16 at 15:44