简体   繁体   中英

Simulink external mode and Arduino Mega 2560

I'm stuck with Simulink Arduino Target in MATLAB 2012a. Simulink can compile my model and download it to the hardware. It seems to work, but when I do have a scope in my simulation, activating the external mode (for tuning my model and tracing the values) causes Simulink to crash ("Segmentation Violation", but the most time it just hangs without any error). It crashes the same way if I disconnect the usb-cable during external mode.

I'm using the Arduino Mega 2560 R3 Hardware, Matlab 2012b on Win 7 64 bit and Win XP.

Any help is welcome, the matlab forum doesn't give any useful answer (at least so far).

I could reproduce the same error you've described in your post when using a sample time in the Analog Input block which was different to the sample time in the Simulation Settings pane. In other words, there is a good chance that one of the Arduino blocks has a different sample time to the global sample timing --- and this is an issue for the Arduino support package.

Normally (in xPC Target) you just get an error message if the sample time does not make sense (non multiple of the global or faster) but a slower multiple is not an issue. Here I've found that the input block needed the same sampling as the global model to work.

(Matlab 2012b, Win 7 x64, Arduino Mega 2560 R3, external mode)

Gergely

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM