ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Cannot use catkin build with Arduino Nano Every

asked 2023-06-26 01:21:57 -0600

skpy gravatar image

I am using rosserial to communicate with my Arduino and I configured it to be able to compile directly the program with catkin build. I followed the tutorial here. It works perfectly with Arduino Uno, but when I switched to Arduino Nano Every, the building crashed. I do not know the board id of this Arduino. If I use nano the compilation crashes after some time, if I use nona4809 or every, it crashes straight (Invalid Arduino board ID (nona4809), aborting.).

If I compile the program with the Arduino IDE, it works fine. I can get the data with rosserial.

Here is the compilation error message:

make[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

make[7]: *** [CMakeFiles/hello-upload.dir/build.make:57: CMakeFiles/hello-upload] Error 1
make[6]: *** [CMakeFiles/Makefile2:110: CMakeFiles/hello-upload.dir/all] Error 2
make[5]: *** [CMakeFiles/Makefile2:117: CMakeFiles/hello-upload.dir/rule] Error 2
make[4]: *** [Makefile:131: hello-upload] Error 2
make[3]: *** [CMakeFiles/sensor_arduino_pkg_firmware_hello-upload.dir/build.make:57: CMakeFiles/sensor_arduino_pkg_firmware_hello-upload] Error 2
make[2]: *** [CMakeFiles/Makefile2:780: CMakeFiles/sensor_arduino_pkg_firmware_hello-upload.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:787: CMakeFiles/sensor_arduino_pkg_firmware_hello-upload.dir/rule] Error 2
make: *** [Makefile:474: sensor_arduino_pkg_firmware_hello-upload] Error 2
cd /home/project/build/sensor_arduino_pkg; catkin build --get-env sensor_arduino_pkg | catkin env -si  /usr/bin/make sensor_arduino_pkg_firmware_hello-upload --jobserver-auth=3,4; c

Without error messages, it is a bit hard to understand. My CMakeLists.txt file is same as the one in the tutorial, besides the BOARD and the file name:

cmake_minimum_required(VERSION 2.8.3)
project(sensor_arduino_pkg)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)

include_directories(${ROS_LIB_DIR})

# Remove this if using an Arduino without native USB (eg, other than Leonardo)
add_definitions(-DUSB_CON)


generate_arduino_firmware(hello
  SRCS data.cpp ${ROS_LIB_DIR}/time.cpp
  BOARD nano
  PORT /dev/ttyACM0
)

How can I make work catkin build with Arduino Nano Every?

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-26 23:43:54 -0600

Guess Giant gravatar image

First off, the error

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

indicates that the Nano Every is not replying, so do check that the physical connection is secured and PORT is accurately reflected in the CMakelists.txt.

Next, for the mention of BOARD id, nano should not work because the Nano Every uses a different processor! This means that use of nona4809 is required.

Now, there is mention that board id nona4809 is not found. I will hazard a guess that cmake is looking in the wrong directory for the nona4809 board. Do ensure that the directory where the boards.txt for Nano Every (e.g. ~/.arduino15/packages/arduino/hardware/megaavr/1.8.7) is properly set in CMakelists.txt using the register_hardware_platform(HARDWARE_PLATFORM_PATH) function.

edit flag offensive delete link more

Comments

Hello, thank you for your answer. I was expecting to be a processor difference between nano and very. I tried the command, but the compilation still fails for the same reason (Invalid Arduino board ID (nona4809), aborting.).

I don't know if it should be added in specific order in the CMakeLists.txt. I tried before the include and the add_definitions. Here is the line I added:

register_hardware_platform(~/.arduino15/packages/arduino/hardware/megaavr/1.8.8)

I checked the folder exists and the boards.txt has the nona4809 definition.

skpy gravatar image skpy  ( 2023-06-28 20:04:40 -0600 )edit

When compiling, are there any other warnings or error that pops up? I don't think cmake supports tilde as home directory, so the ~ should be replaced with $ENV{HOME}.

Guess Giant gravatar image Guess Giant  ( 2023-06-29 09:46:02 -0600 )edit

I tried without the tilde, and replaced it with the variable without success (I also tried to write the path in full). I do not have any meaningful error messages before the compilation. Here is a part of the message:

Errors << sensor_arduino_pkg:make /home/scapy/catkin_ws/project/logs/sensor_arduino_pkg/build.make.007.log CMake Error at /opt/ros/noetic/share/rosserial_arduino/arduino-cmake/cmake/Platform/Arduino.cmake:833 (message): Invalid Arduino board ID (nona4809), aborting. Call Stack (most recent call first): /opt/ros/noetic/share/rosserial_arduino/arduino-cmake/cmake/Platform/Arduino.cmake:988 (get_arduino_flags) /opt/ros/noetic/share/rosserial_arduino/arduino-cmake/cmake/Platform/Arduino.cmake:1047 (setup_arduino_library) /opt/ros/noetic/share/rosserial_arduino/arduino-cmake/cmake/Platform/Arduino.cmake:510 (setup_arduino_libraries) CMakeLists.txt:16 (generate_arduino_firmware)

skpy gravatar image skpy  ( 2023-06-29 18:49:34 -0600 )edit

That is indeed strange. Have you tried deleting the build in the devel/build folder before trying again? When I tried it (albeit without any attached hardware), it complains of avr-g++: error: device-specs/specs-atmega4809: No such file or directory instead. It finds the nona4809 part, but fails because of gcc instead.

Guess Giant gravatar image Guess Giant  ( 2023-06-30 04:03:29 -0600 )edit

I did a catkin clean and now I have the same error as you. Is there a way to solve this problem?

skpy gravatar image skpy  ( 2023-07-02 19:54:15 -0600 )edit

Unfortunately, no, I am not able to help any further. But I do suggest opening an issue in rosserial to see if anyone there might be able to help. From what I have gathered, the original Arduino-CMake-Toolchain has not been maintained since 2012, and it has since bounced around different maintainers (latest may be from technyon in 2022). The version of Arduino-CMake-Toolchain bundled with rosserial_arduino looks largely unchanged since 2014. Given that Arduino Nano Every came out in 2019... I am not surprised that the toolchain did not work out of the box...

Guess Giant gravatar image Guess Giant  ( 2023-07-02 21:10:22 -0600 )edit

Thanks for your help! I will open an issue to see. So far I will continue to use Arduino IDE.

skpy gravatar image skpy  ( 2023-07-03 00:24:50 -0600 )edit

Question Tools

Stats

Asked: 2023-06-26 01:21:57 -0600

Seen: 156 times

Last updated: Jun 28 '23