Raspberry PiGeneral

About RS485 Wind Direction Transmitter

userHead kksp12y 2023-02-01 22:38:00 178 Views2 Replies

Hello, I'm an undergraduate student who encountered an error while running the sensor. 

I referred to "https://wiki.dfrobot.com/RS485_Wind_Direction_Transmitter_SKU_SEN0482" and copied it perfectly.
However, "Segmentation fault" is output.

This picture shows the wind and RS485 in use.

This is a picture of the wiring of the RS485


I used the code without changing anything.

This is the link that contains the code.

https://github.com/DFRobotdl/RS485_Wind_Direction_Transmitter

 

The GCC version is 8.4.0.
Segment fault has once been executed without being displayed.
This was done by running 1000 times in a row.
But it's not good news.
Wind Direction: [null] appears until the wind gauge moves.

When the wind gauge moves, Segment fault appears immediately and the code ends.

Please give me a solution.
 

2023-02-20 14:34:51

A "Segmentation fault" error typically occurs when a program attempts to access a memory location that it is not allowed to 

 

A "Segmentation fault" error typically occurs when a program attempts to access a memory location that it is not allowed to access. 

 

To troubleshoot the issue, you can try the following steps:

 

Check the wiring: Verify that the wiring is correct by double-checking the pin connections of the sensor with your circuit board.

 

Check the serial communication settings: Verify that the serial communication settings (baud rate, parity, and stop bits) are correctly set in the code.

Debug the code: Try to identify any potential issues in the code that could be causing the segmentation fault error. You can use a debugger or add print statements in the code to narrow down the issue.

 

Try a different sensor: If none of the above steps work, you can try a different sensor to see if the issue persists. If it does not, it could indicate that there is a problem with the original sensor.

userHeadPic bidrohini.bidrohini
2023-02-20 11:24:08

Hi

A segmentation fault (often shortened to SIGSEGV) is a particular error condition that can occur during the operation of computer software. A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a read-only location, or to overwrite part of the operating system).

Could you please check the memory management of your Raspberry Pi? It could be an error related to your board.

Looking forward to your reply.

userHeadPic NeloKin