Jainesh
Newbie

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.
I have attached all the necessary code files.
Arduino Receiver code -
Current Output on Arduino Serial Monitor.
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.
I have attached all the necessary code files.
Arduino Receiver code -
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 setup() { Serial.begin(9600); Serial.println("Uart Transmission"); } void loop() { while (Serial.available()) { uint8_t received = Serial.read(); // Serial.println("Received: "); Serial.println(received,HEX); } }
Current Output on Arduino Serial Monitor.
Attachments
-
7 in Soil Sensor Datasheet.pdf352.1 KB · Views: 214
-
GW1NSR Chips Datasheet.pdf1.8 MB · Views: 142
-
T-FPGA-V1.0 CORE.pdf853.6 KB · Views: 124
-
BaudRateGenerator2.txt506 bytes · Views: 101
-
CRC_16.txt2.6 KB · Views: 86
-
UART.txt4.7 KB · Views: 101
-
Uart8Receiver.txt2.9 KB · Views: 98
-
Uart8Transmitter.txt2.5 KB · Views: 108
Last edited by a moderator: