Connecting 7 in 1 Soil Sensor with GW1NSR-4C using UART

#7705071
Rate this post
useful
not useful

Hello,

I am trying to make a UART connection between the GW1NSR-4C Chip(LilyGO T-FPGA board) and the 7 in 1 Soil Sensor. The Soil Sensor follows the RTU Modbus Protocol, requires CRC error check, and by default, the baud rate is 9600.

I have to use the Gowin EDA software to program the GW1NSR-4C chip(C6/I5 Speed Grade)

The GW1NSR-4C chip on the LilyGO T-FPGA board is connected to a 27 MHz crystal oscillator which I am using to generate the baud rate. I have defined the UART.v file as the top module and I also have a Transmitter and a Receiver module with a CRC_16 module.

I need help with the code, as currently, I am trying to build the code to send the request frame to the sensor for all 7 parameters then receive back the response frame and further calculate the parameter values.

Currently, I am trying to just work on the transmitter part of the code and check the request frame output by connecting Arduino via UART and printing on the serial monitor. But the problem is in the current code, whatever data I am sending is sent twice, and after implementation of the CRC in the code, all the data sent is 0(sent twice). I don't know what to do and am I in urgent need to complete this project.

Can somebody help?

Please let me know if any more details are needed to be shared.

Attached files:
#7705383
Rate this post
useful
not useful

Jainesh wrote:

I am trying to make a UART connection between the GW1NSR-4C Chip(LilyGO T-FPGA board) and the 7 in 1 Soil Sensor. The Soil Sensor follows the RTU Modbus Protocol, requires CRC error check, and by default, the baud rate is 9600.

So you try to build a RS-232 (UART) <-> RS-485 (Modbus) bridge?

There are USB adaptors and even Modbus gateways (Modbus to UART/Ethernet/Wifi/...) available.

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now