12-06-2024, 01:27 AM
function: Use KinCony G1 module to transparently transmit AT commands of SIM7600 4G module to gpio13 and gpio14 of esp23-s3. So that KinCony Controller can connect with extend G1 4G module by KCS v3 firmware.
[attachment=6635]
[attachment=6636]
[attachment=6586]
BIN file download to ESP32-S3 directly:
[attachment=6587]
[attachment=6635]
[attachment=6636]
[attachment=6586]
Code:
#include <HardwareSerial.h>
// Define hardware serial ports
HardwareSerial SimSerial(1); // Use hardware serial port 1 (GPIO9 and GPIO10)
HardwareSerial ExtendSerial(2); // Use hardware serial port 2 (GPIO13 and GPIO14)
void setup() {
// Initialize the extended serial port (hardware serial port 2)
ExtendSerial.begin(115200, SERIAL_8N1, 13, 14); // RX=GPIO13, TX=GPIO14
while (!ExtendSerial) {
; // Wait for the extended serial port to connect
}
// Initialize the SIM7600 serial port (hardware serial port 1)
SimSerial.begin(115200, SERIAL_8N1, 9, 10); // RX=GPIO9, TX=GPIO10
}
void loop() {
// If data is received from the extended serial port, forward it to the SIM7600 module
if (ExtendSerial.available()) {
while (ExtendSerial.available()) {
char data = ExtendSerial.read();
SimSerial.write(data);
}
}
// If data is received from the SIM7600 module, forward it to the extended serial port
if (SimSerial.available()) {
while (SimSerial.available()) {
char data = SimSerial.read();
ExtendSerial.write(data);
}
}
}
[attachment=6587]