RS485 issue - haipt2489 - 06-24-2026
Hi Kincony,
I have bought some of your B4M modules, and try to use the RS485 port.
I try to run the code here: https://www.kincony.com/forum/showthread.php?tid=8934
Code: /*
* Made by KinCony IoT: https://www.kincony.com
*
* RS485 Communication Test
*
* This program is a simple test for RS485 communication using ESP32-S3.
* It will send a message over RS485 and then read incoming messages.
* The TXD pin is defined as GPIO 18 and RXD pin is defined as GPIO 8.
*/
#include <HardwareSerial.h>
// Define RS485 pins
#define RS485_RXD 39
#define RS485_TXD 38
// Create a hardware serial object
HardwareSerial rs485Serial(1);
void setup() {
// Start serial communication for debugging
Serial.begin(115200);
while (!Serial);
// Initialize RS485 Serial communication
rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);
}
void loop() {
// Send a test message
rs485Serial.println("Hello from KinCony B8M!");
// Wait for a short period
delay(1000);
// Check if data is available to read
if (rs485Serial.available()) {
String receivedMessage = "";
while (rs485Serial.available()) {
char c = rs485Serial.read();
receivedMessage += c;
}
// Print the received message
Serial.print("Received: ");
Serial.println(receivedMessage);
} else
{
Serial.println("RS485 is not available");
}
// Wait before sending the next message
delay(2000);
}
but cannot receive the data from RS485 port. The log shows that port is not available.
Can you help me troubleshoot this issue?
Best regards,
Hai Pham
RE: RS485 issue - admin - 06-24-2026
take a photo of your arduino screen .
RE: RS485 issue - haipt2489 - 06-24-2026
RE: RS485 issue - admin - 06-24-2026
you can download firmware BIN file directly to test.
https://www.kincony.com/forum/attachment.php?aid=9018
RE: RS485 issue - haipt2489 - 06-24-2026
(06-24-2026, 11:18 AM)admin Wrote: you can download firmware BIN file directly to test.
https://www.kincony.com/forum/attachment.php?aid=9018
esptool --baud 921600 --before default-reset --after hard-reset write-flash -u --flash-mode dio --flash-freq 80m --flash-size 16MB 0x0 4-RS485-Test.ino.merged.bin
esptool v5.1.0
Connected to ESP32-S3 on /dev/ttyACM0:
Chip type: ESP32-S3 (QFN56) (revision v0.2)
Features: Wi-Fi, BT 5 (LE), Dual Core + LP Core, 240MHz, Embedded PSRAM 8MB (AP_3v3)
Crystal frequency: 40MHz
USB mode: USB-Serial/JTAG
MAC: 28:84:85:85:e0:c8
Stub flasher running.
Changing baud rate to 921600...
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x003fffff...
Flash parameters set to 0x024f.
SHA digest in image updated.
Wrote 4194304 bytes at 0x00000000 in 21.9 seconds (1530.5 kbit/s).
Hash of data verified.
Hard resetting via RTS pin...
RE: RS485 issue - admin - 06-24-2026
tomorrow i will test, then feedback to you.
RE: RS485 issue - admin - 06-25-2026
Code: /*
* Made by KinCony IoT: https://www.kincony.com
*
* RS485 Communication Test
*
* This program is a simple test for RS485 communication using ESP32-S3.
* It will send a message over RS485 and then read incoming messages.
* The TXD pin is defined as GPIO 18 and RXD pin is defined as GPIO 8.
*/
#include <HardwareSerial.h>
// Define RS485 pins
#define RS485_RXD 39
#define RS485_TXD 38
// Create a hardware serial object
HardwareSerial rs485Serial(1);
void setup() {
// Start serial communication for debugging
Serial.begin(115200);
while (!Serial);
// Initialize RS485 Serial communication
rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);
Serial.println("RS485 Test Start");
}
void loop() {
// Send a test message
rs485Serial.println("Hello from KinCony");
// Wait for a short period
delay(1000);
// Check if data is available to read
if (rs485Serial.available()) {
String receivedMessage = "";
while (rs485Serial.available()) {
char c = rs485Serial.read();
receivedMessage += c;
}
// Print the received message
Serial.print("Received: ");
Serial.println(receivedMessage);
}
// Wait before sending the next message
delay(2000);
}
make sure you have enabled "USB-CDC-On boot" option.
|