Arduino Simulink external mode error

3 visualizaciones (últimos 30 días)
Rikard Ottemark
Rikard Ottemark el 20 de Abr. de 2017
Comentada: Rikard Ottemark el 15 de Mayo de 2017
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?

Respuesta aceptada

Biswa Dhal
Biswa Dhal el 15 de Mayo de 2017
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 comentario
Rikard Ottemark
Rikard Ottemark el 15 de Mayo de 2017
Thank you for that information! Updating the support package solved the problem for me.

Iniciar sesión para comentar.

Más respuestas (1)

Rikard Ottemark
Rikard Ottemark el 20 de Abr. de 2017
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.

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by