LollosoSi / rf24tunlink

Point to Point TUN link via NRF24L01 radio modules
0 stars 1 forks source link

Error message #2

Closed kokoory closed 3 weeks ago

kokoory commented 1 month ago

Hello, I have installed successfully as mentioned. But I have an error like picture. 1 and 2 occurred same error. IMG_3352

LollosoSi commented 1 month ago

Hi, I've added a proper readme for version 2. Everything is in the main branch now launching with arguments 1 and 2 is no longer a thing, now you should use config files as explained in the readme

I recommend using the four-RF24 setup, but if you wish to use just two here's a launch example that should get you started Primary device: sudo ./rf24tunlink presets/tunlink_config.txt presets/arq_config.txt presets/radio_single_config.txt presets/primary Secondary device: sudo ./rf24tunlink presets/tunlink_config.txt presets/arq_config.txt presets/radio_single_config.txt presets/secondary

Let me know if there are other issues in the way

kokoory commented 1 month ago

edited: finally, I could send and receive a video. But link is disconnected after sometime. thanks too much!

  1. to cmake . and make, I added set (CMAKE_CXX_FLAGS "-lstdc++fs -std=c++17") at Cmake_list
  2. ce_0_pin is gpio 24 not 25.
  3. rf24tunlink2 is command, not rf24tunlilnk
  4. what is below message?

sudo ./rf24tunlink2 presets/tunlink_config.txt presets/arq_config.txt presets/radio_single_config.txt presets/secondary Relative directory: /home/denny/rf24tunlink rf24tunlink 2 BETA Version 0.1 Opening file: presets/tunlink_config.txt Loaded 4 entries and removed 11 extra lines Opening file: presets/arq_config.txt Loaded 12 entries and removed 35 extra lines Opening file: presets/radio_single_config.txt Loaded 26 entries and removed 80 extra lines Opening file: presets/secondary Loaded 3 entries and removed 8 extra lines Printing all settings: Type Name Value bool display_telemetry no bool auto_ack yes bool primary no bool dynamic_payloads no bool ack_payloads yes bool use_tuned_arq_wait no bool use_activity_led no string address 192.168.10.2 string destination 192.168.10.1 string netmask 255.255.255.0 string iname arocc string csv_out_filename
string tunnel_handler tun string packetizer arq string radio_handler singlerf24 string address_0_1 nn1 string address_0_2 nn2 string address_0_3 nn3 string address_1_1 nn4 string address_1_2 nn5 string address_1_3 nn6 string pico_device_file /dev/ttyACM0 string uart_device_file /dev/ttyUSB0 uint8 csv_divider 44 uint8 payload_size 32 uint8 data_bytes 31 uint8 ecc_bytes 1 uint8 data_rate 1 uint8 radio_power 0 uint8 crc_length 1 uint8 radio_delay 1 uint8 radio_retries 15 uint8 channel_0 10 uint8 channel_1 120 uint8 address_bytes 3 uint8 bits_id 2 uint8 bits_segment 5 uint8 bits_lastpacketmarker 1 uint16 minimum_arq_wait 5 uint16 maximum_frame_time 5000 uint16 empty_packet_delay 10 uint32 spi_speed 12000000 uint32 uart_baudrate 9600 integer ce_0_pin 24 integer csn_0_pin 0 integer ce_1_pin 26 integer csn_1_pin 12 integer irq_pin_radio0 5 integer irq_pin_radio1 6 integer tx_queuelength 500 integer activity_led_gpio 0 double tuned_arq_wait_singlepacket 3.000000 RSCodec settings applied. Bits: 8, Data Bytes: 31, ECC Bytes: 1 RSCodec settings applied. Bits: 8, Data Bytes: 31, ECC Bytes: 1 Worker tun thread is disabled for this instance Worker send radio thread is disabled for this instance Factory destructor Interface 'arocc' will have IP '192.168.10.2', Destination '192.168.10.1', mask '255.255.255.0', MTU '928' Opening Interface Packetout starting .... Setting IP and MASK .... Setting MTU .... Setting tx_queuelength .... Setting interface UP .... Setting Destination IP .... Configuration finished radio -> ROLE: 0 read: nn2 : 7237170 write nn1 channel: 120 Attached Interrupt ================ SPI Configuration ================ CSN Pin = /dev/spidev0.0 CE Pin = Custom GPIO24 SPI Frequency = 12 Mhz ================ NRF Configuration ================ Channel = 10 (~ 2410 MHz) Model = nRF24L01+ RF Data Rate = 2 MBPS RF Power Amplifier = PA_MIN RF Low Noise Amplifier = Enabled CRC Length = 8 bits Address Length = 3 bytes Static Payload Length = 32 bytes Auto Retry Delay = 500 microseconds Auto Retry Attempts = 15 maximum Packets lost on current channel = 0 Retry attempts made for last transmission = 0 Multicast = Disabled Custom ACK Payload = Enabled Dynamic Payloads = Enabled Auto Acknowledgment = Enabled Primary Mode = RX TX address = 0x6e6e31 pipe 0 (closed) bound = 0x6e6e31 pipe 1 ( open ) bound = 0x6e6e32 pipe 2 (closed) bound = 0xc3 pipe 3 (closed) bound = 0xc4 pipe 4 (closed) bound = 0xc5 pipe 5 (closed) bound = 0xc6 Radio has failure. C1 201, C2 0, C3 0 Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED Packet EXPIRED

LollosoSi commented 1 month ago
  1. Could you elaborate why add those flags? The project compiles as is on my Pis.
    Just noticed some performance flags are commented out in the CMakeLists.txt
    (add_compile_options(-Ofast -Wall -march=native -fno-signed-zeros -fno-trapping-math -frename-registers -funroll-loops)

  2. You can use any GPIO for the radio CE. Make sure you don't swap CE and CSN because CSN must be connected to the RPI CE pins

  3. Correct, will update the readme. Thanks

  4. Not sure what you mean. Packets expire when no ACK is received after maximum_frame_time. The resend timer fires after minimum_arq_wait or if use_tuned_arq_wait=yes then tuned_arq_wait_singlepacket x segments in the packet.

You can get expired packets if the signal is lost or the link is misconfigured, say the resend timer is too fast or too slow. If the radio is disconnected (either physically or a crash due to a too high SPI frequency) that also qualifies as an interrupted link

Please edit your config to use 4000000 as spi_speed (I am editing this config too in the repo)

Other notes:

Are you using the Pi camera? I have experimented live streaming with both Pi camera and USB webcams, I can share some commands.

LollosoSi commented 1 month ago

Here is a representation of the errors in close range, before RS ECC was implemented
Just out of my room
Here is one test done after implementing the RS ECC
RS ECC

kokoory commented 1 month ago

Thanks you fo r your reply.

  1. If I don't set the flag. The errors occur.

    ~/rf24tunlink $ make [ 7%] Building CXX object CMakeFiles/rf24tunlink2.dir/main.cpp.o In file included from /home/denny/rf24tunlink/main.cpp:4: /home/denny/rf24tunlink/Settings.h: In constructor ‘Settings::Settings()’: /home/denny/rf24tunlink/Settings.h:23:9: error: ‘std::filesystem’ has not been declared 23 | std::filesystem::path cwd = std::filesystem::current_path(); | ^~~~~~ /home/denny/rf24tunlink/Settings.h:24:40: error: ‘cwd’ was not declared in this scope 24 | printf("Relative directory:\t%s\n", cwd.string().c_str()); | ^~~ In file included from /home/denny/rf24tunlink/timer_handlers.h:10, from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /home/denny/rf24tunlink/utils.h: In function ‘uint64_t current_millis()’: /home/denny/rf24tunlink/utils.h:11:15: error: ‘std::chrono’ has not been declared 11 | return (std::chrono::duration_cast < std::chrono::milliseconds > (std::chrono::system_clock::now().time_since_epoch()).count()); | ^~ /home/denny/rf24tunlink/utils.h:11:44: error: ‘std::chrono’ has not been declared 11 | return (std::chrono::duration_cast < std::chrono::milliseconds > (std::chrono::system_clock::now().time_since_epoch()).count()); | ^~ /home/denny/rf24tunlink/utils.h:11:73: error: ‘std::chrono’ has not been declared 11 | d::chrono::duration_cast < std::chrono::milliseconds > (std::chrono::system_clock::now().time_since_epoch()).count()); | ^~

In file included from /home/denny/rf24tunlink/main.cpp:13: /home/denny/rf24tunlink/packetizers/Packetizer.h: In member function ‘bool Packetizer<tun_message_class, radio_message_class>::receive_radio(radio_message_class&)’: /home/denny/rf24tunlink/packetizers/Packetizer.h:145:21: error: missing template arguments before ‘lock’ 145 | std::lock_guard lock(radio_in_mtx); | ^~~~ /home/denny/rf24tunlink/packetizers/Packetizer.h: In member function ‘bool Packetizer<tun_message_class, radio_message_class>::receive_radio(std::deque&)’: /home/denny/rf24tunlink/packetizers/Packetizer.h:154:21: error: missing template arguments before ‘lock’ 154 | std::lock_guard lock(radio_in_mtx); | ^~~~ /home/denny/rf24tunlink/packetizers/Packetizer.h: In member function ‘void Packetizer<tun_message_class, radio_message_class>::worker_tun()’: /home/denny/rf24tunlink/packetizers/Packetizer.h:170:23: error: missing template arguments before ‘lock’ 170 | std::unique_lock lock(tun_in_mtx); | ^~~~ /home/denny/rf24tunlink/packetizers/Packetizer.h:180:11: error: overloaded function with no contextual type information 180 | lock.unlock(); | ^~ /home/denny/rf24tunlink/packetizers/Packetizer.h: In member function ‘void Packetizer<tun_message_class, radio_message_class>::worker_packet()’: /home/denny/rf24tunlink/packetizers/Packetizer.h:195:23: error: missing template arguments before ‘lock’ 195 | std::unique_lock lock(radio_in_mtx); | ^~~~ /home/denny/rf24tunlink/packetizers/Packetizer.h: In member function ‘void Packetizer<tun_message_class, radio_message_class>::worker_sendradio()’: /home/denny/rf24tunlink/packetizers/Packetizer.h:273:23: error: missing template arguments before ‘lock’ 273 | std::unique_lock lock(radio_worker_mtx); | ^~~~ In file included from /home/denny/rf24tunlink/main.cpp:21: /home/denny/rf24tunlink/packetizers/harq/HARQ.h: At global scope: /home/denny/rf24tunlink/packetizers/harq/HARQ.h:49:67: error: use of deleted function ‘TimedFrameHandler::TimedFrameHandler(const TimedFrameHandler&)’ 49 | TimedFrameHandler packet_outgoing_tfh = TimedFrameHandler(1000,1); | ^ In file included from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /home/denny/rf24tunlink/timer_handlers.h:24:7: note: ‘TimedFrameHandler::TimedFrameHandler(const TimedFrameHandler&)’ is implicitly deleted because the default definition would be ill-formed: 24 | class TimedFrameHandler { | ^~~~~ /home/denny/rf24tunlink/timer_handlers.h:24:7: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = std::thread; _Dp = std::default_delete]’ In file included from /usr/include/c++/10/bits/locale_conv.h:41, from /usr/include/c++/10/locale:43, from /usr/include/c++/10/iomanip:43, from /home/denny/rf24tunlink/rs_codec/ReedSolomon/ReedSolomon.h:4, from /home/denny/rf24tunlink/rs_codec/RSCodec.h:9, from /home/denny/rf24tunlink/main.cpp:5: /usr/include/c++/10/bits/unique_ptr.h:468:7: note: declared here 468 | unique_ptr(const unique_ptr&) = delete; | ^~~~~~ In file included from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /home/denny/rf24tunlink/timer_handlers.h:24:7: error: use of deleted function ‘std::mutex::mutex(const std::mutex&)’ 24 | class TimedFrameHandler { | ^~~~~ In file included from /usr/include/c++/10/mutex:43, from /home/denny/rf24tunlink/timer_handlers.h:16, from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /usr/include/c++/10/bits/std_mutex.h:94:5: note: declared here 94 | mutex(const mutex&) = delete; | ^~~~~ In file included from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /home/denny/rf24tunlink/timer_handlers.h:24:7: error: use of deleted function ‘std::condition_variable::condition_variable(const std::condition_variable&)’ 24 | class TimedFrameHandler { | ^~~~~ In file included from /home/denny/rf24tunlink/timer_handlers.h:17, from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /usr/include/c++/10/condition_variable:94:5: note: declared here 94 | condition_variable(const condition_variable&) = delete; | ^~~~~~ In file included from /home/denny/rf24tunlink/main.cpp:22: /home/denny/rf24tunlink/packetizers/arq/ARQ.h:31:75: error: use of deleted function ‘TimedFrameHandler::TimedFrameHandler(const TimedFrameHandler&)’ 31 | medFrameHandler etfh = TimedFrameHandler(1000,this->empty_packet_delay); | ^

/home/denny/rf24tunlink/packetizers/arq/ARQ.h:55:67: error: use of deleted function ‘TimedFrameHandler::TimedFrameHandler(const TimedFrameHandler&)’ 55 | TimedFrameHandler packet_outgoing_tfh = TimedFrameHandler(1000,1); | ^ /home/denny/rf24tunlink/main.cpp: In function ‘void test()’: /home/denny/rf24tunlink/main.cpp:61:26: error: use of deleted function ‘PicoRF24::PicoRF24(const PicoRF24&)’ 61 | PicoRF24 prf = PicoRF24(); | ^ In file included from /home/denny/rf24tunlink/main.cpp:18: /home/denny/rf24tunlink/radio/picorf24/PicoRF24.h:72:7: note: ‘PicoRF24::PicoRF24(const PicoRF24&)’ is implicitly deleted because the default definition would be ill-formed: 72 | class PicoRF24 : public RadioInterface { | ^~~~ /home/denny/rf24tunlink/radio/picorf24/PicoRF24.h:72:7: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = std::thread; _Dp = std::default_delete]’ In file included from /usr/include/c++/10/bits/locale_conv.h:41, from /usr/include/c++/10/locale:43, from /usr/include/c++/10/iomanip:43, from /home/denny/rf24tunlink/rs_codec/ReedSolomon/ReedSolomon.h:4, from /home/denny/rf24tunlink/rs_codec/RSCodec.h:9, from /home/denny/rf24tunlink/main.cpp:5: /usr/include/c++/10/bits/unique_ptr.h:468:7: note: declared here 468 | unique_ptr(const unique_ptr&) = delete; | ^~~~~~ In file included from /home/denny/rf24tunlink/main.cpp:18: /home/denny/rf24tunlink/radio/picorf24/PicoRF24.h:72:7: error: use of deleted function ‘std::mutex::mutex(const std::mutex&)’ 72 | class PicoRF24 : public RadioInterface { | ^~~~ In file included from /usr/include/c++/10/mutex:43, from /home/denny/rf24tunlink/timer_handlers.h:16, from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /usr/include/c++/10/bits/std_mutex.h:94:5: note: declared here 94 | mutex(const mutex&) = delete; | ^~~~~ /home/denny/rf24tunlink/main.cpp: In function ‘int main(int, char)’: /home/denny/rf24tunlink/main.cpp:232:20: error: missing template arguments before ‘lock’ 232 | std::unique_lock lock(sleep_mutex); | ^~~~ /home/denny/rf24tunlink/main.cpp:233:42: error: no matching function for call to ‘std::condition_variable::wait(, main(int, char)::<lambda()>)’ 233 | cv.wait(lock, [&]{return stop_program;}); | ^ In file included from /home/denny/rf24tunlink/timer_handlers.h:17, from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /usr/include/c++/10/condition_variable:104:5: note: candidate: ‘void std::condition_variable::wait(std::unique_lock&)’ 104 | wait(unique_lock& lock) noexcept; | ^~~~ /usr/include/c++/10/condition_variable:104:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/condition_variable:108:7: note: candidate: ‘template void std::condition_variable::wait(std::unique_lock&, _Predicate)’ 108 | wait(unique_lock& __lock, _Predicate p) | ^~~~ /usr/include/c++/10/condition_variable:108:7: note: template argument deduction/substitution failed: /home/denny/rf24tunlink/main.cpp:233:42: note: cannot convert ‘std::lock’ (type ‘’) to type ‘std::unique_lock&’ 233 | cv.wait(lock, [&]{return stop_program;}); | ^ In file included from /home/denny/rf24tunlink/main.cpp:13: /home/denny/rf24tunlink/packetizers/Packetizer.h: In instantiation of ‘void Packetizer<tun_message_class, radio_message_class>::worker_tun() [with tun_message_class = Message; radio_message_class = Message]’: /home/denny/rf24tunlink/packetizers/Packetizer.h:222:96: required from ‘void Packetizer<tun_message_class, radio_message_class>::apply_settings(const Settings&) [with tun_message_class = Message; radio_message_class = Message]’ /home/denny/rf24tunlink/main.cpp:198:38: required from here /home/denny/rf24tunlink/packetizers/Packetizer.h:171:17: error: no matching function for call to ‘std::condition_variable::wait(, Packetizer<tun_message_class, radio_message_class>::worker_tun<Message, Message>::<lambda()>)’ 171 | tun_cv.wait(lock, [&] { | ~~~^~~~ 172 | return !running_wtun || !incoming_tun.empty(); | ~~~~~~~~~~ 173 | }); | ~~
In file included from /home/denny/rf24tunlink/timer_handlers.h:17, from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /usr/include/c++/10/condition_variable:104:5: note: candidate: ‘void std::condition_variable::wait(std::unique_lock&)’ 104 | wait(unique_lock& lock) noexcept; | ^~~~ /usr/include/c++/10/condition_variable:104:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/condition_variable:108:7: note: candidate: ‘template void std::condition_variable::wait(std::unique_lock&, _Predicate)’ 108 | wait(unique_lock& __lock, _Predicate p) | ^~~~ /usr/include/c++/10/condition_variable:108:7: note: template argument deduction/substitution failed: In file included from /home/denny/rf24tunlink/main.cpp:13: /home/denny/rf24tunlink/packetizers/Packetizer.h:171:17: note: cannot convert ‘std::lock’ (type ‘’) to type ‘std::unique_lock&’ 171 | tun_cv.wait(lock, [&] { | ~~~^~~~ 172 | return !running_wtun || !incoming_tun.empty(); | ~~~~~~~~~~ 173 | }); | ~~
/home/denny/rf24tunlink/packetizers/Packetizer.h: In instantiation of ‘void Packetizer<tun_message_class, radio_message_class>::worker_packet() [with tun_message_class = Message; radio_message_class = Message]’: /home/denny/rf24tunlink/packetizers/Packetizer.h:223:100: required from ‘void Packetizer<tun_message_class, radio_message_class>::apply_settings(const Settings&) [with tun_message_class = Message; radio_message_class = Message]’ /home/denny/rf24tunlink/main.cpp:198:38: required from here /home/denny/rf24tunlink/packetizers/Packetizer.h:196:19: error: no matching function for call to ‘std::condition_variable::wait(, Packetizer<tun_message_class, radio_message_class>::worker_packet<Message, Message>::<lambda()>)’ 196 | radio_cv.wait(lock, [&] { | ~~~^~~~~~ 197 | return !running_wpk || !incoming_packets.empty(); | ~~~~~~~~~~~~~ 198 | }); | ~~
In file included from /home/denny/rf24tunlink/timer_handlers.h:17, from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /usr/include/c++/10/condition_variable:104:5: note: candidate: ‘void std::condition_variable::wait(std::unique_lock&)’ 104 | wait(unique_lock& lock) noexcept; | ^~~~ /usr/include/c++/10/condition_variable:104:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/condition_variable:108:7: note: candidate: ‘template void std::condition_variable::wait(std::unique_lock&, _Predicate)’ 108 | wait(unique_lock& __lock, _Predicate p) | ^~~~ /usr/include/c++/10/condition_variable:108:7: note: template argument deduction/substitution failed: In file included from /home/denny/rf24tunlink/main.cpp:13: /home/denny/rf24tunlink/packetizers/Packetizer.h:196:19: note: cannot convert ‘std::lock’ (type ‘’) to type ‘std::unique_lock&’ 196 | radio_cv.wait(lock, [&] { | ~~~^~~~~~ 197 | return !running_wpk || !incoming_packets.empty(); | ~~~~~~~~~~~~~ 198 | }); | ~~
/home/denny/rf24tunlink/packetizers/Packetizer.h: In instantiation of ‘void Packetizer<tun_message_class, radio_message_class>::worker_sendradio() [with tun_message_class = Message; radio_message_class = Message]’: /home/denny/rf24tunlink/packetizers/Packetizer.h:224:101: required from ‘void Packetizer<tun_message_class, radio_message_class>::apply_settings(const Settings&) [with tun_message_class = Message; radio_message_class = Message]’ /home/denny/rf24tunlink/main.cpp:198:38: required from here /home/denny/rf24tunlink/packetizers/Packetizer.h:274:26: error: no matching function for call to ‘std::condition_variable::wait(, Packetizer<tun_message_class, radio_message_class>::worker_sendradio<Message, Message>::<lambda()>)’ 274 | radio_worker_cv.wait(lock, [&] { | ~~~~^~~~ 275 | return !running_wrd || !queued_out_frames.empty() || !queued_out_messages.empty(); | ~~~~~~~~~~~~~~~~~~ 276 | }); | ~~
In file included from /home/denny/rf24tunlink/timer_handlers.h:17, from /home/denny/rf24tunlink/activity_led.h:11, from /home/denny/rf24tunlink/main.cpp:7: /usr/include/c++/10/condition_variable:104:5: note: candidate: ‘void std::condition_variable::wait(std::unique_lock&)’ 104 | wait(unique_lock& lock) noexcept; | ^~~~ /usr/include/c++/10/condition_variable:104:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/condition_variable:108:7: note: candidate: ‘template void std::condition_variable::wait(std::unique_lock&, _Predicate)’ 108 | wait(unique_lock& __lock, _Predicate p) | ^~~~ /usr/include/c++/10/condition_variable:108:7: note: template argument deduction/substitution failed: In file included from /home/denny/rf24tunlink/main.cpp:13: /home/denny/rf24tunlink/packetizers/Packetizer.h:274:26: note: cannot convert ‘std::lock’ (type ‘’) to type ‘std::unique_lock&’ 274 | radio_worker_cv.wait(lock, [&] { | ~~~~^~~~ 275 | return !running_wrd || !queued_out_frames.empty() || !queued_out_messages.empty(); | ~~~~~~~~~~~~~~~~~~ 276 | }); | ~~
make[2]: [CMakeFiles/rf24tunlink2.dir/build.make:82: CMakeFiles/rf24tunlink2.dir/main.cpp.o] 오류 1 make[1]: [CMakeFiles/Makefile2:95: CMakeFiles/rf24tunlink2.dir/all] 오류 2 make: *** [Makefile:103: all] 오류(This is Error in korean) 2


  1. When I use two RFs, the above error occurred, but four RF is good. Not any more errors occurred.

I want to stream pi camera using nrf24 set the date rate in 1Mbps over a distance of 2km. Sure, I want to use 14dbi antenna at one point. I try to test in the field changing variables, I will let you know.

LollosoSi commented 1 month ago

What system, board and g++ are you using? Mine:

andrea@andreapi4:~/tunlink-compile-test/rf24tunlink $ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/12/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-14)

Here everything compiles with or without set(CMAKE_CXX_FLAGS "-lstdc++fs -std=c++17") in CMakeLists.txt, just with more warnings.

In order to land such long range communication you must check a couple things first:

I've already tested this command for streaming to the primary device of the link: rpicam-vid -t 0 --inline --level 4.2 -b 50k --framerate 24 --width 480 --height 360 --codec libav --libav-video-codec h264_v4l2m2m -o udp://192.168.10.1:5000 Edit bitrate and resolution to fit your needs. Consider the worst case scenario first (must work in 250Kbps modulation, then you tune it up). Later on, we could always consider including some kind of speed negotiation based on packet latency and signal losses.

Then in the receiver RPi, I rerouted the packets to the local network via UDP: sudo socat udp-listen:5000,reuseaddr,fork udp-datagram:239.255.0.1:5001,sp=5000 Note that you can't do this in things like phone hotspots and these might add latency. It's best to use your home network or use the receiving RPi as access point

And in the machine(s) where I wanted to watch the stream: ffplay udp://@239.255.0.1:5001 -fflags nobuffer -flags low_delay -framedrop

To enable RPi as hotspot I put together this bash script and seems to work with low enough latency (RPi 4):

#!/bin/bash

# Stop dnsmasq service
systemctl stop dnsmasq

# Delete any existing connection named TEST-AP
nmcli con delete TEST-AP

# Add a new Wi-Fi connection in Access Point mode
nmcli con add type wifi ifname wlan0 mode ap con-name TEST-AP ssid TEST autoconnect false

# Configure Wi-Fi settings
nmcli con modify TEST-AP wifi.band bg
nmcli con modify TEST-AP wifi.channel 3
nmcli con modify TEST-AP wifi.cloned-mac-address 00:12:34:56:78:9a

# Configure Wi-Fi security
nmcli con modify TEST-AP wifi-sec.key-mgmt wpa-psk
nmcli con modify TEST-AP wifi-sec.proto rsn
nmcli con modify TEST-AP wifi-sec.group ccmp
nmcli con modify TEST-AP wifi-sec.pairwise ccmp
nmcli con modify TEST-AP wifi-sec.psk "mypassword"

# Configure IP settings
nmcli con modify TEST-AP ipv4.method shared ipv4.address 192.168.4.1/24
nmcli con modify TEST-AP ipv6.method disabled

# Bring up the connection
nmcli con up TEST-AP

# Set the transmit power of the wlan0 interface to a low value (e.g., 1 dBm)
iw dev wlan0 set txpower fixed 100

# Enable multicast on wlan0 interface
# ip link set dev wlan0 multicast on

ip route add 224.0.0.0/4 dev wlan0
kokoory commented 1 month ago

Thanks. you are expert in RF!

I will test you mentioned! Thanks very much!

rpi4 and kernel info

Here is my g++ verison. Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/10/lto-wrapper Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.1 20210110 (Debian 10.2.1-6)

LollosoSi commented 1 month ago

I wish! This is just the result of my trial and error process. Big hole in the RF field for me ATM. I try to save your (and future everyone's) time in order to progress with the project quicker. This driver will help with lots of applications: first thought, telemetry; but also RC cars, drones, or connecting remote places as you're doing.

Looks like you're on older distro and g++, would recommend upgrading and see if you still get the error

Thank you for your interest, keep me updated!

LollosoSi commented 3 weeks ago

Any updates? Will appreciate any feedback. Did you accomplish the long range transmission? Let's open a discussion on the subject in the section of this repo

kokoory commented 3 weeks ago

Now, I try to test in the room. because in south korea is rainy season. next week I will test in the field about 2km range. But, the video transmission you mentioned I could not play camera video. In the receiver, any streaming is not coming. So, now I am ising vlc to streaming usb camera. In the weekend, I will test again and let u know.

LollosoSi commented 3 weeks ago

No problem, take your time

Try using a specific address, mind this will translate in a longer set up time when you go testing in the field. And don't forget that android hotspots block multicast. Note that rpicam-vid has a bug and deadlocks on low bitrates, the command I've given should avoid this problem. You can use this one for the Pi Camera only. For USB Webcams you need a different command.


USB Cameras give worse results than the Pi Camera and require more bandwidth because you're forced to use h263 instead of h264. I recommend troubleshooting the Pi Camera stream since you own one, but if you wish to stream using USB webcams here are a couple commands I have tested:

  1. Pick one of these for streaming to the secondary node

ffmpeg -f v4l2 -framerate 30 -video_size 176x144 -i /dev/video0 -c:v h263 -b:v 50k -tune zerolatency -f rtp "rtp://192.168.10.2:5000?pkt_size=128"

ffmpeg -f v4l2 -framerate 30 -video_size 176x144 -i /dev/video0 -c:v h263 -b:v 75k -tune zerolatency -g 8 -f rtp "rtp://192.168.10.2:5000

These commands will output a SDP file to the console, you need to edit and copy the contents to the device where you wish to see the stream: edit the target address from 192.168.10.2 to the computer address, edit the port (5000) to the port where you want to receive the stream (5001) then save as something like stream.sdp

Here is how an sdp file might look like:

v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=video 5004 RTP/AVP 96 98 102
  1. Redirect the packets from the secondary node to your computer through the local network: sudo socat udp-listen:5000,reuseaddr,fork udp:192.168.1.40:5001 (edit the address)

  2. Open the stream using ffplay: ffplay -noborder -strict experimental -avioflags direct -vf setpts=0 -fflags nobuffer -flags low_delay -probesize 32 -analyzeduration 0 -sync ext -protocol_whitelist file,crypto,udp,rtp -reorder_queue_size 0 -i stream.sdp

LollosoSi commented 1 week ago

Just tested the "remote" PCBs and completed the activity LED feature.

Should fit your application perfectly, especially the LED will tell you when it's catching ACKs, while in the field

The included power supply ic should be plenty for two radio modules and will allow to run on max power Plus, you can configure an action button for whatever purpose (say, start stop video stream, request a frame, ping, anything)

You will likely need to solder a couple joints, while the hardest part can be done through the PCB manufacturer

https://github.com/user-attachments/assets/c5bcd3a6-dd55-40e4-a1c0-5dfbccd29a38

kokoory commented 1 week ago

Oh great!, I will test for 2km with my friend. I will let you know.

LollosoSi commented 1 week ago

Oh great!, I will test for 2km with my friend. I will let you know.

Sure! Instruct your friend to use the scripts power_bitrate_config.sh and ecc_config.sh, will be easier to establish the link this way

These will work after the service is installed

When launching both scripts, if you don't see the activity LED blink once, re-issue the command