Issues with softSerial

Hi!

We have been doing several tests with the Cubecell HTCC-AB01, the softSerial library and an RS-485 module. When trying to turn off the Vext and the GPIOs of the softSerial the device crashes, what can be possible?

Can you print the serial port or send out the source code?
We need more information to facilitate locating the cause of the error.

void loop() {

switch (deviceState) {

case DEVICE_STATE_INIT: {

  generateDeveuiByChipID();

  printDevParam();

  LoRaWAN.init(loraWanClass, loraWanRegion);

  deviceState = DEVICE_STATE_JOIN;

  break;

}

case DEVICE_STATE_JOIN: {

  LoRaWAN.join();

  break;

}

case DEVICE_STATE_SEND: {

  prepareTxFrame(appPort);

  LoRaWAN.send();

  deviceState = DEVICE_STATE_CYCLE;

  break;

}

case DEVICE_STATE_CYCLE: {

  // Schedule next packet transmission

  txDutyCycleTime = (appTxDutyCycle) + randr(0, APP_TX_DUTYCYCLE_RND);

  LoRaWAN.cycle(txDutyCycleTime);

  deviceState = DEVICE_STATE_SLEEP;

  break;

}

case DEVICE_STATE_SLEEP: {

  pinMode(GPIO1, OUTPUT);

  pinMode(GPIO2, OUTPUT);

  digitalWrite(GPIO1, LOW);

  digitalWrite(GPIO2, LOW);

  digitalWrite(Vext, HIGH);

  LoRaWAN.sleep();

  break;

}

default: {

  deviceState = DEVICE_STATE_INIT;

  break;

}

}

}




static void prepareTxFrame(uint8_t port) {

uint16_t batteryVoltage = getBatteryVoltage();

u64_bytes valueCount;

numByte = 6;

digitalWrite(Vext, LOW);

delay(100);

modbus485.begin(9600);

requestData(temp_S, VWC_S, EC_S, salinity_S, sensor1);

appDataSize = 30;

appData[0] = (uint8_t)(batteryVoltage >> 8);

appData[1] = (uint8_t)batteryVoltage;

appData[2] = (uint8_t)(count >> 24);

appData[3] = (uint8_t)(count >> 16);

appData[4] = (uint8_t)(count >> 8);

appData[5] = (uint8_t)count;

}

What is the specific manifestation of device crash? What information is printed on the serial port?

In the begin function of the software serial port, there are interrupts about the pins. When the pin is pulled low, the interrupt is triggered, and the interrupt needs to be turned off first.