Comments (13)
I have update code (add description)
Plz pull again.
thank you.
from rak3172_canopus.
My whatsapp:
https://wa.me/84969809444
from rak3172_canopus.
Hi @duyle1402 ,
Because you tested the code with UART2 (UART2 <=> USB) and it works fine, the problem lies in the UART1 <=> RS485 conversion.
Check some of the following conditions:
-What Baud rate are you operating at? The circuit board uses 1nF capacitors combined with 56k resistors to take care of auto DE and RE so it is actually designed to work well at baud rates of 4800 - 115200, I think it will cover almost all speeds. popular that we often use.
-Have you enabled power for the RS485 block? Help me determine accurately using a meter (VOM). If there is no power (3.3V) at the RS485 terminal, try connecting 3.3V power on the I2C terminal to the RS485 terminal (use wire). Because there exists a hardware error regarding power activation on version 1.
from rak3172_canopus.
Thanks a Nam for quickly reply,
Here is my code I tested with Uart1 and it's work, i had ENABLE for RS485 block.
`#define BUFFER_SIZE 64
// Rak define
#define LED PA8
#define mA_PIN PB3
#define VSS_PIN PB5
#define VRS_PIN PB12
#define PWR_ON LOW
#define PWR_OFF HIGH
void setup() {
pinMode(LED, OUTPUT);
pinMode(VRS_PIN, OUTPUT);
digitalWrite(VRS_PIN, PWR_ON); //On power Vrs485
pinMode(VSS_PIN, OUTPUT);
digitalWrite(VSS_PIN, PWR_ON); //On power Vsensor
// Khởi tạo cổng serial với tốc độ baud là 9600
Serial.begin(115200); // uart 2 for minitor
Serial1.begin(9600); // uart 1
}
void loop() {
// check data
if (Serial1.available() > 0) {
// create receive buffer
char receivedData[BUFFER_SIZE];
int i = 0; // Biến chỉ mục cho buffer
while (Serial1.available() > 0) {
receivedData[i] = Serial1.read();
i++;
delay(10);
}
// end of receive data by null
receivedData[i] = '\0';
// print data
Serial.print("Received: ");
Serial.println(receivedData);
}
// send data to computer
if (Serial1.available() > 0)
{
Serial1.println("data from rak through uart 1");
delay(1000);
}
}
`
Result:
from rak3172_canopus.
So, how about Read/Write with Modbus poll now bro?
If it still not work, jelp me take some picture like this:
from rak3172_canopus.
Wait me a minutes and I will update result soon,
from rak3172_canopus.
I sill cant read data,
Here modbus's display images
2. Images wiring
3. I had follow the orgial modbus slave lib at https://github.com/Trialcommand/Arduino-Modbus-RTU-Slave
And I see that you change _frameDelay = 5; //24000/_baud;
The others is same as this lib, I guest this is problem of Rak and RUI3 or We are missing some thing important
from rak3172_canopus.
Cuz you recieved character correct in side RAK, and transmit from Modbus Poll success. It mean Rx of RAK work good.
So I beliver it related to DE-RE or Tx of RAK.
Can you see both led on board (led tx and rx of modbus, color blue) flicker?
A 15sec video of how the leds blink would be helpful to me.
from rak3172_canopus.
from rak3172_canopus.
Hi a Nam,
To facilitate communication, I can connect with you via zalo or whatapp and we will post the results after solving the problem so everyone can follow along if they encounter the same problem?
from rak3172_canopus.
Sloved: At these moments, the newer version we can download is 4.1.0, try Update RUI3 version to the 4.1.1 (not stable version), I think Rak Team will release this version soon.
Can follow this link to download: https://forum.rakwireless.com/t/rui3-best-practice-collection-of-rui3-example-code/11256
After update RUI3 version, this example will work.
Thanks, a Nam for helping.
from rak3172_canopus.
I am experiencing an issue with the Canopus version 1 board. The Modbus Master example code available on GitHub is not working, and my own code that uses the frames is also not working. I could not find the library you mentioned when I tried to download it.
from rak3172_canopus.
Dear @sl446,
Nice to know you.
Since this topic is closed, could you help me open a new issue and add some descriptive information like the status of the modbus Tx and Rx leds working?
The correct connection diagram is A to A, B to B and the register address you want to read, along with your code.
This will make it easier to track for those who encounter similar problems in the future.
I have received your feedback via email and whatsaap, since you need to solve it quickly, I hope it can be done via anydesk to reduce your waiting time.
from rak3172_canopus.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rak3172_canopus.