-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in Flashing firmware on STM32 Discovery Board #167
Comments
Well I guess, it could be because I am running Ubuntu in a virtual box and I am not able to access usb port on it. |
Yes, it seems like your USB port is not been found. Try using Ubuntu in your local machine or using Docker. Please close when you flash your board. |
I have Ubuntu 18.04 in my local machine and Foxy needs 20.04, that is why I was using a virtual box. Is it possible to flash the firmware from Ubuntu 18.04 which I already built-in 20.04, if I copy the firmware folder? or it has to be the same version? For Docker, I will need the same version as well? |
Also, I tried using one of my old computers and installed Ubuntu 20 on it. However, I am getting an error at the step below which I was not getting in the other computer. I tried searching this issue online and implemented all possible solutions presented but I had no success. Afterwards, I formatted the computer and installed Ubuntu again and got the same error. So, is this something related to your scripts or there is a problem in my computer? Note that everything else works fine, I installed ROS2, pip, colon, etc. I am not sure how to get rid of this error. Please see if you can help. Otherwise I will have to do it on a different computer as it was working before on other computer. kashish@kashish:~/uros_ws$ ros2 run micro_ros_setup create_firmware_ws.sh zephyr discovery_l475_iot1 Creating firmware for zephyr platform discovery_l475_iot1 Reading package lists... Done E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) E: Unable to lock directory /var/lib/apt/lists/ W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied) |
So I was able to fix the USB problem with the Virtual Box and was able to flash the firmware to the board. Here is the output of the micro_ros_agent: gnclab@gnclab:~/uros_ws$ ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/serial/by-id/usb-STMicroelectronics_STM32_STLink_0671FF3134354D5043075629-if02 -v6 Press CTRL+C to exit [1596589044.582841] info | TermiosAgentLinux.cpp | init | running... | fd: 3 [1596589044.582998] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6 Now, how should I test the micro-ros app installed on the board? Do I need to change the jumper connection on the back of the board after the flash process? When I type ros2 topic list, I don't see anything any topics. |
Which transport did you choose in the configuration step? Can you paste here the commands you follow to create, configure, build and flash you board? |
I used the same commands you pasted in #121 in the last comment. |
source /opt/ros/$ROS_DISTRO/setup.bash Agent installation |
ok, so you have to connect your board using the USB OTG (the unconnected in your images) and you have to change the power jumper to Now, when you do a |
Ok, I don't have a USB OTG right now, I will have to order it. So a serial connection like what we did with Olimex Board (a wire connected to tx rx of board) will not work? |
You dont need to have an USB OTG cable, use the same cable as you used for flashing. It works for me. |
Well that is a micro-usb cable, they have different size. |
I will try if that works and update you tomorrow, thanks! |
For us, it works with a micro-USB cable. |
Thanks @pablogs9 , it worked! So, now how do I run Wifi example? I mean how will the board connect to the wifi? |
Wifi is experimental in this board, I have not completely polish the Wifi transport so it works but not as smoothly as expected. You can try with this configuration step: Remember to set your SSID and PSK in the source code before building: https://github.com/micro-ROS/zephyr_apps/blob/b37c48ff2f0d8a937b9c27a66962c977baaad67a/apps/int32_wifi_publisher/src/main.c#L58 In any case, if you want to use wireless transports I strongly recommend you to buy the new supported ESP32. This super cheap board works really well with wifi, serial and serial-usb transports and FreeRTOS: https://www.mouser.es/ProductDetail/Espressif-Systems/ESP32-DevKitC-32E?qs=GedFDFLaBXFpgD0kAZWDrQ%3D%3D |
Thanks for the reply! In the configure_firmware step you posted above, IP should be the IP address of the computer in which the agent is running, and what should be the agent port? I can certainly buy another board but I don't think the given board is as powerful as ST Discovery board. In the end, I want to put MCU on a robot and want to work it wirelessly. I saw that ST board has other sensors as well so I guess I will have to connect the two MCU together in the end. But I worry about that later, the first goal is to make it work wirelessly. But in any case, have you also tried working with the RF module (sub-GHz module) installed on the ST board. I guess there are also NRF24L01+(2.5 GHz) modules available very cheap these days, have you tried integrating those? |
The IP is the IP of the computer, right. The port is the port where the agent is listening, remember that the command for running the agent in UDP mode is: |
@pablogs9 Do I need additional CMakeLists.txt or is there any other error? gnclab@gnclab:~/uros_ws$ ros2 run micro_ros_setup configure_firmware.sh int32_wifi_publisher -t udp -i 10.0.2.15 -p 8888 Configuring firmware for zephyr platform discovery_l475_iot1 Configured udp mode with agent at 10.0.2.15:8888 gnclab@gnclab:~/uros_ws$ ros2 run micro_ros_setup build_firmware.sh Crosscompiled environment: cleaning path Building firmware for zephyr platform discovery_l475_iot1 Selected app: int32_wifi_publisher Specific config for transport not found. Using prj.conf. ERROR: /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher doesn't contain a CMakeLists.txt FATAL ERROR: refusing to proceed without --force due to above error Can we create a file similar to other apps? But I am not sure that why this folder is missing this file. |
Hello @kashishdhal, sorry for the delay. Indeed, Is it possible for you to add both missing files (take this as reference) in order to test it and if it works PR them? Thanks |
sure, I will try to add the files and update you, thanks! |
Hello @pablogs9 , Sorry for the delay in response. I tried to build firmware and got an error. I will explain what I did: I looked at the However, I was not sure about the
Here is the output: In file included from /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/utils.h:20, from /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/rmw_client.c:15: /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/./types.h:63:3: error: unknown type name 'uxrUDPTransport' 63 | uxrUDPTransport transport; | ^~~~~~~~~~~~~~~ /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/./types.h:64:3: error: unknown type name 'uxrUDPPlatform' 64 | uxrUDPPlatform udp_platform; | ^~~~~~~~~~~~~~ In file included from /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/./types.h:31, from /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/utils.h:20, from /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/rmw_client.c:15: /home/gnclab/uros_ws/firmware/mcu_ws/build/rmw_microxrcedds/include/rmw_microxrcedds_c/config.h:15:41: error: 'UXR_CONFIG_UDP_TRANSPORT_MTU' undeclared here (not in a function); did you mean 'UXR_CONFIG_SERIAL_TRANSPORT_MTU'? 15 | #define RMW_UXRCE_MAX_TRANSPORT_MTU UXR_CONFIG_UDP_TRANSPORT_MTU | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/gnclab/uros_ws/firmware/mcu_ws/build/rmw_microxrcedds/include/rmw_microxrcedds_c/config.h:15:41: note: in definition of macro 'RMW_UXRCE_MAX_TRANSPORT_MTU' 15 | #define RMW_UXRCE_MAX_TRANSPORT_MTU UXR_CONFIG_UDP_TRANSPORT_MTU | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/./types.h:73:40: note: in expansion of macro 'RMW_UXRCE_MAX_BUFFER_SIZE' 73 | uint8_t input_reliable_stream_buffer[RMW_UXRCE_MAX_BUFFER_SIZE]; | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/utils.h:20, from /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/rmw_client.c:15: /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/./types.h:223:33: warning: ISO C forbids zero-size array 'custom_subscriptions' [-Wpedantic] 223 | extern rmw_uxrce_subscription_t custom_subscriptions[RMW_UXRCE_MAX_SUBSCRIPTIONS]; | ^~~~~~~~~~~~~~~~~~~~ /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/./types.h:226:28: warning: ISO C forbids zero-size array 'custom_services' [-Wpedantic] 226 | extern rmw_uxrce_service_t custom_services[RMW_UXRCE_MAX_SERVICES]; | ^~~~~~~~~~~~~~~ /home/gnclab/uros_ws/firmware/mcu_ws/uros/rmw_microxrcedds/rmw_microxrcedds_c/src/./types.h:229:27: warning: ISO C forbids zero-size array 'custom_clients' [-Wpedantic] 229 | extern rmw_uxrce_client_t custom_clients[RMW_UXRCE_MAX_CLIENTS]; | ^~~~~~~~~~~~~~ make[6]: *** [CMakeFiles/rmw_microxrcedds.dir/build.make:92: CMakeFiles/rmw_microxrcedds.dir/src/rmw_client.c.obj] Error 1 make[5]: *** [CMakeFiles/Makefile2:81: CMakeFiles/rmw_microxrcedds.dir/all] Error 2 make[4]: *** [Makefile:144: all] Error 2 --- Failed <<< rmw_microxrcedds [0.96s, exited with code 2] Summary: 13 packages finished [19.5s] 1 package failed: rmw_microxrcedds 14 packages had stderr output: microcdr microxrcedds_client rcutils rmw rmw_microxrcedds rosidl_adapter rosidl_cmake rosidl_default_runtime rosidl_parser rosidl_runtime_c rosidl_typesupport_c rosidl_typesupport_interface rosidl_typesupport_microxrcedds_c tinydir_vendor 43 packages not processed make[3]: *** [Makefile:57: colcon_compile] Error 2 make[3]: Leaving directory '/home/gnclab/uros_ws/firmware/zephyr_apps/microros_extensions' make[2]: *** [CMakeFiles/microroslib_project.dir/build.make:115: microros_extensions/src/microroslib_project-stamp/microroslib_project-build] Error 2 make[2]: Leaving directory '/home/gnclab/uros_ws/firmware/build' make[1]: *** [CMakeFiles/Makefile2:2285: CMakeFiles/microroslib_project.dir/all] Error 2 make[1]: Leaving directory '/home/gnclab/uros_ws/firmware/build' make: *** [Makefile:87: all] Error 2 FATAL ERROR: command exited with status 2: /usr/bin/cmake --build /home/gnclab/uros_ws/firmware/build When I change the
I get the following output: /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:24:9: error: unknown type name 'u32_t' 24 | u32_t mgmt_event, struct net_if *iface) | ^~~~~ /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c: In function 'main': /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:49:6: error: 'wifi_mgmt_event_handler' undeclared (first use in this function); did you mean 'net_mgmt_event_handler_t'? 49 | wifi_mgmt_event_handler, | ^~~~~~~~~~~~~~~~~~~~~~~ | net_mgmt_event_handler_t /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:49:6: note: each undeclared identifier is reported only once for each function it appears in /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:74:3: warning: implicit declaration of function 'usleep'; did you mean 'k_usleep'? [-Wimplicit-function-declaration] 74 | usleep(10000); | ^~~~~~ | k_usleep /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:90:2: warning: passing argument 3 of 'rclc_publisher_init_default' makes pointer from integer without a cast [-Wint-conversion] 90 | RCCHECK(rclc_publisher_init_default( | ^~~~~~~ | | | int In file included from /home/gnclab/uros_ws/firmware/mcu_ws/install/include/rclc/rclc.h:30, from /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:13: /home/gnclab/uros_ws/firmware/mcu_ws/install/include/rclc/publisher.h:52:41: note: expected 'const rosidl_message_type_support_t *' {aka 'const struct rosidl_message_type_support_t *'} but argument is of type 'int' 52 | const rosidl_message_type_support_t * type_support, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~ make[2]: *** [CMakeFiles/app.dir/build.make:79: CMakeFiles/app.dir/src/main.c.obj] Error 1 make[2]: Leaving directory '/home/gnclab/uros_ws/firmware/build' make[1]: *** [CMakeFiles/Makefile2:2313: CMakeFiles/app.dir/all] Error 2 make[1]: Leaving directory '/home/gnclab/uros_ws/firmware/build' make: *** [Makefile:87: all] Error 2 FATAL ERROR: command exited with status 2: /usr/bin/cmake --build /home/gnclab/uros_ws/firmware/build It would be great if you can guide me! Thanks! |
We have updated this app for you, check here: micro-ROS/zephyr_apps#19 I can build it successfully, please remember to do this in the configuration step:
The WiFi SSID and PSK can be set up in Then you can do the build step as usual. Please give me feedback about your progress. Thanks! Please remember that WiFi support for this board is experimental and I had some troubles with connection stability when I implemented it. |
Hello @pablogs9 , Thanks a ton for the update! I tried compiling it with the new files provided by you but I am still getting error. Do I need to delete the firmware directory and do all over again? Here is the output: /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:24:9: error: unknown type name 'u32_t' 24 | u32_t mgmt_event, struct net_if *iface) | ^~~~~ /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c: In function 'main': /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:49:6: error: 'wifi_mgmt_event_handler' undeclared (first use in this function); did you mean 'net_mgmt_event_handler_t'? 49 | wifi_mgmt_event_handler, | ^~~~~~~~~~~~~~~~~~~~~~~ | net_mgmt_event_handler_t /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:49:6: note: each undeclared identifier is reported only once for each function it appears in /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:74:3: warning: implicit declaration of function 'usleep'; did you mean 'k_usleep'? [-Wimplicit-function-declaration] 74 | usleep(10000); | ^~~~~~ | k_usleep /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:90:2: warning: passing argument 3 of 'rclc_publisher_init_default' makes pointer from integer without a cast [-Wint-conversion] 90 | RCCHECK(rclc_publisher_init_default( | ^~~~~~~ | | | int In file included from /home/gnclab/uros_ws/firmware/mcu_ws/install/include/rclc/rclc.h:30, from /home/gnclab/uros_ws/firmware/zephyr_apps/apps/int32_wifi_publisher/src/main.c:13: /home/gnclab/uros_ws/firmware/mcu_ws/install/include/rclc/publisher.h:52:41: note: expected 'const rosidl_message_type_support_t *' {aka 'const struct rosidl_message_type_support_t *'} but argument is of type 'int' 52 | const rosidl_message_type_support_t * type_support, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~ make[2]: *** [CMakeFiles/app.dir/build.make:79: CMakeFiles/app.dir/src/main.c.obj] Error 1 make[2]: Leaving directory '/home/gnclab/uros_ws/firmware/build' make[1]: *** [CMakeFiles/Makefile2:2313: CMakeFiles/app.dir/all] Error 2 make[1]: Leaving directory '/home/gnclab/uros_ws/firmware/build' make: *** [Makefile:87: all] Error 2 FATAL ERROR: command exited with status 2: /usr/bin/cmake --build /home/gnclab/uros_ws/firmware/build If wifi doesn't work as expected then I can use an onboard computer for serial connection. However, I will surely try to make this work! Although I had a quick question: Can I run the micro-ros agent in ROS2 Dashing or it is mandatory to use ROS2 Foxy for micro-ros agent? I will flash the Foxy micro-ros code in the MCU. Will there be any communication issue or it would be fine? Secondly, I want to learn how to create custom apps for my board. What would be recommended way of going through that process? Should I look at all the apps, how they have been created? or if you recommend any other way of doing that? Is there any document available which I can have a look? Please let me know about it! Thanks! |
Hello @kashishdhal:
Please let us know if you have any other doubt. |
Hello @pablogs9, Thanks for the reply and sharing the tutorials! I will go through them as time allows! I can build wifi app successfully now with the clean environment. Secondly, I have ROS2 Foxy installed, but it is installed on a Virtual Box and I am not able to ping that computer from my local computer. However, I have installed ROS2 Dashing (and micro-ros Dashing) on my local computer. So that is what I asked, if I can run the micro-ros agent in ROS2 Dashing not to have communication problems. Another question, Can I run Docker for ROS2 Foxy in Ubuntu 18.04? I am not familiar with docker and don't know how much time it will take to learn the functionality of docker. |
Regarding compatibility, I'm not sure about it because they have changed major version for FastDDS between Dashing and Foxy and we use it in the agent. Probably XRCE-DDS (middleware of micro-ROS between client and agent) is not problematic because there is no significant changes. So you can try. Regarding Docker, of course, you can run a Docker image of Ubuntu 20.04 and ROS 2 Foxy on top of 18.04 (in fact, this is my setup until I have time to update my workstation to 20.04). I encourage you to try Docker because it can ease a lot some parts of the development and the learning curve is not so hard. Let me know your progress. Thanks! |
Okay thanks @pablogs9 , I will try learning Docker as well as running micro-ros on Dashing and let you know how it goes! |
Hello @pablogs9 , Thanks for all the help and sorry for the delayed response as I was a bit involved with my course work. I learnt the Docker and was able to flash the STM32 board using your micro-ros Docker image, it was super easy as compared to the Virtual Box. I also looked at the apps build by your team and rclc tutorials as suggested by you. Now, I want to create an app to send PWM commands to the motor. Can you please guide me on how to configure the PWM on this board? If there is any manual available which I can refer to, please provide me a link to that! or else if you have created any similar app, please provide a link to that. I will be thankful to you! |
Hello, @kashishdhal I guess that this is off-topic from micro-ROS. I guess that Zephyr documentation will be super useful for you: https://docs.zephyrproject.org/latest/reference/peripherals/pwm.html Hope that your project goes well, and sorry for the inconvenience. Remember to keep us updated about your project with micro-ROS! |
Hello @pablogs9 , Thanks for the reply! For one of my robots currently, I am using Arduino+ROS-SERIAL. I was thinking to replace it with STM32 Disco+Micro-ROS. For that, I would need to send PWM command to control the motor + capability of reading the encoders in the board. I will read the Zephyr documentation for PWM and how about reading the encoders? I am reading the encoder channels in hardware interrupt in arduino. What would be my best bet here? Also, do you recommend exploring the Arduino+Micro-ROS repository for that? Please let me know. Regards, |
Hello @pablogs9 ,
I followed your instructions as in #121 and I was able to build the firmware. However, while flashing it gave me an error.
These are my connections:
And here is the output, please help:
The text was updated successfully, but these errors were encountered: