Smart Home Automation Forum
SIM7600E AT command transparently transmitted to ESP32 Arduino code and BIN firmware - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=66)
+--- Forum: G1 (https://www.kincony.com/forum/forumdisplay.php?fid=67)
+--- Thread: SIM7600E AT command transparently transmitted to ESP32 Arduino code and BIN firmware (/showthread.php?tid=7175)



SIM7600E AT command transparently transmitted to ESP32 Arduino code and BIN firmware - admin - 12-06-2024

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.
   
   
   
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);
    }
  }
}
BIN file download to ESP32-S3 directly:

.zip   7-GSM-Test-extend-pins.ino.merged.zip (Size: 184.13 KB / Downloads: 16)