Error while using the uart library

Screenshot%20from%202019-10-14%2009-05-282222 Screenshot%20from%202019-10-14%2009-05-31222

I’m trying to create a GSM patch but XOD keep throwing me errors. Can anyone help? Thanks in advance.

We aren’t likely to be able to help without knowing what the errors are…

This is the error:

Compilation failed
Command /opt/XOD\ IDE/resources/arduino-cli --config-file=/tmp/arduino-cli5xSgvD/.cli-config.yml compile --fqbn arduino:avr:nano:cpu=atmega328old --verbose /tmp/xod_temp_sketchbookpRxNSF/xod_1571018677266_sketch failed with code 1
The generated C++ code contains errors. It can be due to a bad node implementation or if your board is not compatible with XOD runtime code. The original compiler error message is above. Fix C++ errors to continue. If you believe it is a bug, report the problem to XOD developers.

look

1 Like

I’ve been summoned quang-huy!

Apparently that you’re trying to send SMS text message to a mobile phone. I have not tried but the sequence of commands seems clear. Try to use the gabbapeople/sim7020 library:

  1. Set sending to the text mode.
AT+CMGF=1
  1. Module answers OK
  2. Send SMS to the mobile number.
AT+CMGS="+85291234567"
  1. Module answers >
  2. Enter msg and the terminal sequence ^Z to to send a message.
HELLO WORLD!!! ^Z 
  1. Module answers OK and additional + system info msg.

The patch looks something like this:

1 Like

Thanks a lot gabbapeople!
I have tried your patch, although I still got this error:

Compilation failed
Command /opt/XOD\ IDE/resources/arduino-cli --config-file=/tmp/arduino-clibKNpAY/.cli-config.yml compile --fqbn arduino:avr:nano:cpu=atmega328old --verbose /tmp/xod_temp_sketchbook37lrDS/xod_1571054199034_sketch failed with code 1
The generated C++ code contains errors. It can be due to a bad node implementation or if your board is not compatible with XOD runtime code. The original compiler error message is above. Fix C++ errors to continue. If you believe it is a bug, report the problem to XOD developers.

If you have some time to spill, here is my project file:
Mai1 (1).xodball (48.2 KB)

Can you compile it to test out if my error is Machine based or not?

You are only posting the last part that doesn’t include the actual error message. You need to scroll up to see the original error message.

Which patch exactly do you want to test?
That one that is stored at you xodball Mai1 (1).xodball with the sms name cannot be compiled as it is absolutely not finished.
Try to assemble the patch from the screenshot that I attached and compile it.

Here it is:

Begin compiling code for the board Arduino Nano :package:

Using board ‘nano’ from platform in folder: /home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21
Using core ‘arduino’ from platform in folder: /home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21

Detecting libraries used…

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/sketch/xod_1571061876490_sketch.ino.cpp -o /dev/null

Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
-> candidates: [Wire@1.0]

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/sketch/xod_1571061876490_sketch.ino.cpp -o /dev/null

Alternatives for LiquidCrystal_I2C.h: [LiquidCrystal_I2C]
ResolveLibrary(LiquidCrystal_I2C.h)
-> candidates: [LiquidCrystal_I2C]

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/sketch/xod_1571061876490_sketch.ino.cpp -o /dev/null

Alternatives for LiquidCrystal.h: [LiquidCrystal@1.0.4]
ResolveLibrary(LiquidCrystal.h)
-> candidates: [LiquidCrystal@1.0.4]

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal/src /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/sketch/xod_1571061876490_sketch.ino.cpp -o /dev/null

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal/src /home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src/Wire.cpp -o /dev/null

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal/src /home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src/utility/twi.c -o /dev/null

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal/src /tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C/LiquidCrystal_I2C.cpp -o /dev/null

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal/src /tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal/src/LiquidCrystal.cpp -o /dev/null

Generating function prototypes…

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal/src /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/sketch/xod_1571061876490_sketch.ino.cpp -o /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/preproc/ctags_target_for_gcc_minus_e.cpp

/home/lehuy/xod/packages/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c+±kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/preproc/ctags_target_for_gcc_minus_e.cpp

Compiling sketch…

/home/lehuy/xod/packages/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/cores/arduino -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/variants/eightanaloginputs -I/home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire/src -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C -I/tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal/src /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/sketch/xod_1571061876490_sketch.ino.cpp -o /tmp/arduino-sketch-4C0C5587BED25E0D62A8BC9E55921DEF/sketch/xod_1571061876490_sketch.ino.cpp.o

/tmp/xod_temp_sketchbook37lrDS/xod_1571061876490_sketch/xod_1571061876490_sketch.ino: In function ‘void xod::xod__uart__uart_1::evaluate(xod::xod__uart__uart_1::Context)’:
/tmp/xod_temp_sketchbook37lrDS/xod_1571061876490_sketch/xod_1571061876490_sketch.ino:3770:53: error: ‘Serial1’ was not declared in this scope
state->uart = new (state->mem) HardwareUart(Serial1, (uint32_t)getValue<input_BAUD>(ctx));
^

Multiple libraries were found for “Wire.h”
Used: /home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire
Multiple libraries were found for “LiquidCrystal_I2C.h”
Used: /tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C
Multiple libraries were found for “LiquidCrystal.h”
Used: /tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal

Using library Wire at version 1.0 in folder: /home/lehuy/xod/packages/packages/arduino/hardware/avr/1.6.21/libraries/Wire
Using library LiquidCrystal_I2C in folder: /tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal_I2C (legacy)
Using library LiquidCrystal at version 1.0.4 in folder: /tmp/xod_temp_sketchbook37lrDS/libraries/LiquidCrystal

Error: exit status 1
Compilation failed.
Compilation failed
Command /opt/XOD\ IDE/resources/arduino-cli --config-file=/tmp/arduino-clibKNpAY/.cli-config.yml compile --fqbn arduino:avr:nano:cpu=atmega328old --verbose /tmp/xod_temp_sketchbook37lrDS/xod_1571061876490_sketch failed with code 1
The generated C++ code contains errors. It can be due to a bad node implementation or if your board is not compatible with XOD runtime code. The original compiler error message is above. Fix C++ errors to continue. If you believe it is a bug, report the problem to XOD developers.

I have recreate that exactly and get an error about Serial1 not being declared, I’m starting to wondering that instead of uart-1 I should have use uart-soft because that’s how I understand it to work with TX, RX and all of that good stuff.

the error is here in Serial1

Yep, there is an error compiling for Arduino Nano because Nano do Not has Hardware UART interface named serial1 only just serial.

The screenshot is just an example.

Make a new Software UART connection.
Wire your module to another board pins, use the soft-uart node and leave serial Hardware interface for debugging only.

This is the only error I see. Very likely it is related to gabbapeople’s comment that the patch is not finished.

Yeah, here is my final patch:

It did compile, which is a good start, but nothing happen, I’ve read somewhere that the TX and RX of soft-uart are backwards, tried that, uploaded some example code in C, it worked, so my board is not broken.
Is there anyway that I can debug it like write something on the serial monitor?

Summoning, quang-huy!

I’ve made some improvements in the gabbapeople/sim7020 specially for you.
Look for a few new nodes and the example patch example-send-sms to send SMS by pressing a button.

Tested it using: Arduino Uno, SIM800C, Software UART.

Patch:

Debug:

Hardware:

Result:

Try it!