Arduino Simulink external mode error

조회 수: 3 (최근 30일)
Rikard Ottemark
Rikard Ottemark 2017년 4월 20일
댓글: Rikard Ottemark 2017년 5월 15일
I am using MATLAB R2017a with "Simulink Support Package for Arduino Hardware" (version 17.1.0), and try to get external mode through the wifi shield of my Arduino Mega working. I am following the example provided by Mathworks, and can get the model to run through external mode when using the serial communication. However, when I switch to wifi mode, the code generation fails.
Here is the relevant information that I get:
"### Creating standalone executable "../arduino_communication.elf" ..."
C:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-gcc -w -Os -Wl,--gc-sections,--relax -mmcu=atmega2560 -o ../arduino_communication.elf MW_digitalio.o arduino_communication.o arduino_communication_data.o ext_svr.o updown.o ext_work.o rtiostream_utils.o hooks.o WInterrupts.o wiring.o wiring_analog.o wiring_digital.o wiring_pulse.o wiring_shift.o abi.o CDC.o HardwareSerial.o HardwareSerial0.o HardwareSerial1.o HardwareSerial2.o HardwareSerial3.o PluggableUSB.o IPAddress.o new.o Print.o Stream.o Tone.o USBCore.o WMath.o WString.o MW_ArduinoHWInit.o io_wrappers.o arduinoAVRScheduler.o rtiostream_interface.o rtiostream_wifi.o SPI.o WiFi.o WiFiClient.o WiFiServer.o WiFiUdp.o server_drv.o spi_drv.o wifi_drv.o ert_main.o -lm
rtiostream_interface.o: In function `ExtCloseConnection':
C:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common/rtiostream_interface.c:414: undefined reference to `receivedSyncByteE'
collect2.exe: error: ld returned 1 exit status
gmake: *** [../arduino_communication.elf] Error 1
The part of the C file that contains the undefined reference to 'receivedSyncByteE' looks like this:
#if (defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_SAM_DUE)) && !defined(_ROTH_LEONARDO_)
receivedSyncByteE = false;
#endif
The only other place in the file where 'receivedSyncByteE' is found is rows 68-70:
#if (defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_SAM_DUE)) && !defined(_ROTH_LEONARDO_)
extern volatile boolean_T receivedSyncByteE;
#endif
I don't know much about C programming, but since it is being defined using "extern", I figure that the problem is not in this file, but rather in some other (missing?) file that is supposed to define 'receivedSyncByteE'. Is this assumption correct? If so, does anyone have an idea of how to continue solving this?

채택된 답변

Biswa Dhal
Biswa Dhal 2017년 5월 15일
Hi Rikard,
This is a known issue and has already been fixed in "Simulink Support Package for Arduino Hardware" v17.1.1.
Please download the latest version and you should be good to go.
Thanks, Biswa
  댓글 수: 1
Rikard Ottemark
Rikard Ottemark 2017년 5월 15일
Thank you for that information! Updating the support package solved the problem for me.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Rikard Ottemark
Rikard Ottemark 2017년 4월 20일
The comment in the beginning of the C file which causes the error looks like this:
/*
* ExtCloseConnection() sets this to FALSE (to signal the low layer rtiostream)
* on an external mode disconnection.
*
* rtIOStreamRecv() reads a few spurious bytes before receiving valid data on its
* first call during external mode start or connect. Setting receivedSyncByteE
* to FALSE forces rtIOStreamRecv() to look for the first character 'e' in 'ext-mode',
* which is the first valid external mode packet. All preceding bytes are rejected and
* subsequent bytes including the string 'ext-mode' are forwarded.
*
* For a more detailed description refer to the
* comments in the associated rtiostream_serial_daemon.c/cpp file.
*/
I cannot find any file named rtiostream_serial_daemon, so perhaps that is a good place to start. However, I don't get any hits on Google when searching for that name.

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by