EasySMU and Matlab

I'm having a lot of trouble getting the EasySMU to work with Matlab. I did some manual serial debugging and compared the serial commands on the TX and RX lines when sent from MatLab (which doesn't work), and from the Arduino serial monitor (which does work). The commands are bit for bit identical, and yet the Arduino works, but Matlab does not. I did make two observations:

  1. When the Arduino serial monitor sends a write command, the SMU sends a 5 byte command back. For example, if I sent the command CH0:VOL 1, the Arduino returns the string 1.000. With Matlab, the SMU only returns the last byte of that string.
  2. I also noticed that there is a 0.5 V drop on the TX line when Matlab sends a command, but not when Arduino sends one.

I've attached the Matlab script below. Does anyone have any idea what is going on?

dev = serialport('COM30',9600);
cmd = ['CH0:VOL 1' char(13) newline];
write(dev,cmd, 'STRING');


Top Replies