Skip to content

Commit

Permalink
Sim7600E HW Power Pin to define
Browse files Browse the repository at this point in the history
Add define for use HW/SW GSM mode power and ring indicator
  • Loading branch information
digitecomg committed Jul 1, 2024
1 parent 5fb294f commit c111bf8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ SIM7600::SIM7600(NetInterface *_interface, uint32_t _low_baud_rate, uint32_t _hi
void SIM7600::initPins(bool _set_direction)
{
if(_set_direction) {
pinMode(enable_power_pin, OUTPUT);
if (enable_power_pin) pinMode(enable_power_pin, OUTPUT);
pinMode(power_pin, OUTPUT);
pinMode(ring_indicator_pin, INPUT);
if(ring_indicator_pin) pinMode(ring_indicator_pin, INPUT);
}
// digitalWrite(enable_power_pin, LOW);
if (enable_power_pin) digitalWrite(enable_power_pin, LOW);
digitalWrite(power_pin, LOW);
}

Expand Down Expand Up @@ -185,7 +185,7 @@ sim7600_status_t SIM7600::switchOff(uint8_t power_off_method)
cereg_stat = CREG_STAT_UNKNOWN;

uartDeInit();
// digitalWrite(enable_power_pin, LOW);
if (enable_power_pin) digitalWrite(enable_power_pin, LOW);
digitalWrite(power_pin, LOW);
uartInitConfig(low_baud_rate);

Expand Down Expand Up @@ -246,7 +246,7 @@ sim7600_status_t SIM7600::switchModem(bool is_switching_on)
case SIM7600_POWER_ENABLE:
uartDeInit();
digitalWrite(power_pin, HIGH);
// digitalWrite(enable_power_pin, HIGH);
if (enable_power_pin) digitalWrite(enable_power_pin, HIGH);
uartInitConfig(low_baud_rate);

delay_ms = SIM7600_POWER_ON_STABILIZATION_DELAY_MS;
Expand Down Expand Up @@ -342,7 +342,7 @@ sim7600_status_t SIM7600::switchModem(bool is_switching_on)
// retry
else if ((++retry) < SIM7600_GENERIC_RETRY_COUNT_MAX)
{
// digitalWrite(enable_power_pin, LOW);
if (enable_power_pin) digitalWrite(enable_power_pin, LOW);
digitalWrite(power_pin, LOW);
is_error = false;
sim7600_status = SIM7600_BUSY;
Expand Down
2 changes: 2 additions & 0 deletions platformio/stima_v4/master/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
#define ENABLE_USBSERIAL (true)
/// @brief Enable SIM7600E interface
#define ENABLE_SIM7600E (MODULE_TYPE == STIMA_MODULE_TYPE_MASTER_GSM)
/// @brief Enable SIM7600E powerPin Hw mode
#define ENABLE_GSM_POWER_PIN (false)

// Enable (Wdt Task and Module) and relative Function (Stack, Info ecc...)
/// @brief Enable WatchDog Task and Module
Expand Down
4 changes: 3 additions & 1 deletion platformio/stima_v4/master/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,10 @@ void init_wire()
Spi2.begin();
#endif

// Start EN Pow GSM ready to SET
#if (!ENABLE_GSM_POWER_PIN)
// Start EN Pow GSM ready to SET, unused Control HW mode
digitalWrite(PIN_GSM_EN_POW, HIGH);
#endif
}

/// @brief Setup RTC HW && LowPower Class STM32
Expand Down
5 changes: 5 additions & 0 deletions platformio/stima_v4/master/src/tasks/modem_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ void ModemTask::Run() {
break;
}

// Check mode use power PIN Controller HW/SW
#if (ENABLE_GSM_POWER_PIN)
sim7600 = SIM7600(interface, PPP0_BAUD_RATE_DEFAULT, PPP0_BAUD_RATE_MAX, PIN_GSM_EN_POW, PIN_GSM_PW_KEY, PIN_GSM_RI);
#else
sim7600 = SIM7600(interface, PPP0_BAUD_RATE_DEFAULT, PPP0_BAUD_RATE_MAX, 0, PIN_GSM_PW_KEY, PIN_GSM_RI);
#endif

TRACE_VERBOSE_F(F("MODEM_STATE_INIT -> MODEM_STATE_WAIT_NET_EVENT\r\n"));
state = MODEM_STATE_WAIT_NET_EVENT;
Expand Down

0 comments on commit c111bf8

Please sign in to comment.