Simulink connection problem.

I have a problem connecting to Arduino when setting it up for use with Simulink. When I use arduino.Prefs.searchForComPort no COM-port is found. I have no problem connecting to the Arduino for use from the command line (that is, a = arduino('COM3') works fine). Anyone any idea?

What happens if you search for all COM ports by running the following from the MATLAB command Window?

regCmd=['reg query '...
'HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM'];
[s, regCmdOutput]=system(regCmd)

searchForComPort is looking in the returned output for a string '\Device\VCP0' for the Arduino COM Port. Does regCmdOutput contain this string?

Can you skip the searchForComPort step and just use

arduino.Prefs.setComPort('COM3')

Thanks for your response.

I ran the matlab command you provided, with the following result:

s = 0
regCmdOutput = HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM\Device\USBSER000 REG_SZ COM3

I already tried setting the COM-port directly (using arduino.Prefs.setComPort('COM3') ), but with no luck.

If I try to build the example file demo_arduino_serial_communication provided with the arduino target, the last few lines of the build-process read:

### If your target board has TX and RX LED you should see them flashing ...
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
avrdude done. Thank you.
### Real-Time Workshop build procedure for model: 'demo_arduino_serial_communication' aborted due to an error.,

and Simulink complains:
The call to arduino_make_rtw_hook, during the after_make hook generated the following error: Download failed. Check your serial connection and and run the command arduino.Prefs.getMcu to check you have specified the correct MCU.

I believe the MCU is set correctly (atmega328p, using Arduino Uno).

I had a lot of problems getting Simulink to build the demo-file in the first place, apparently because I am using 64-bit Matlab. Any chance that could be causing this problem too?

It works fine for me with 64-bit Windows. Are you using version 018 of the Arduino software? I recall there was an update for the USB driver not long ago maybe this is having an effect.

I am using version 021 of the Arduino software. You suggest going back to version 018? Thanks a lot for your help.