Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit c473090

Browse files
committed
Fix reconnect_uart
1 parent c5a0a97 commit c473090

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

esp32/lte/lteppp.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ static void lteppp_print_states();
117117
DEFINE PUBLIC FUNCTIONS
118118
******************************************************************************/
119119

120-
void connect_lte_uart (void) {
121-
MSG("\n");
120+
void connect_lte_uart (bool reconnect) {
121+
MSG("connect_lte_uart\n");
122+
uart_driver_delete(LTE_UART_ID);
122123

123124
// initialize the UART interface
124125
uart_config_t config;
@@ -128,7 +129,8 @@ void connect_lte_uart (void) {
128129
config.stop_bits = UART_STOP_BITS_1;
129130
config.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS;
130131
config.rx_flow_ctrl_thresh = 64;
131-
config.use_ref_tick = false;
132+
// Use UART_SCLK_APB as originally use_ref_tick = false was used here
133+
config.source_clk = UART_SCLK_APB;
132134
uart_param_config(LTE_UART_ID, &config);
133135

134136
// configure the UART pins
@@ -153,6 +155,11 @@ void connect_lte_uart (void) {
153155

154156
uart_set_rts(LTE_UART_ID, false);
155157

158+
if (reconnect) {
159+
uart_set_hw_flow_ctrl(LTE_UART_ID, UART_HW_FLOWCTRL_CTS_RTS, 64);
160+
vTaskDelay(5);
161+
}
162+
156163
xTaskCreatePinnedToCore(TASK_UART_EVT, "LTE_UART_EVT", 2048 / sizeof(StackType_t), NULL, 12, &xLTEUartEvtTaskHndl, 1);
157164

158165
MSG("done\n");
@@ -481,7 +488,7 @@ static void TASK_LTE (void *pvParameters) {
481488
uint8_t at_trials = 0;
482489
static uint32_t thread_notification;
483490

484-
connect_lte_uart();
491+
connect_lte_uart(false);
485492

486493
modem_init:
487494
MSG("modem_init\n");

esp32/lte/lteppp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ extern bool lteppp_wait_at_rsp (const char *expected_rsp, uint32_t timeout, bool
123123
lte_modem_conn_state_t lteppp_get_modem_conn_state(void);
124124
void lteppp_set_modem_conn_state(lte_modem_conn_state_t state);
125125

126-
extern void connect_lte_uart (void);
126+
extern void connect_lte_uart (bool reconnect);
127127

128128
extern bool ltepp_is_ppp_conn_up(void);
129129

esp32/mods/modlte.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ STATIC mp_obj_t lte_debug_buff(void) {
15231523
STATIC MP_DEFINE_CONST_FUN_OBJ_0(lte_debug_buff_obj, lte_debug_buff);
15241524
#endif
15251525
STATIC mp_obj_t lte_reconnect_uart (void) {
1526-
connect_lte_uart();
1526+
connect_lte_uart(true);
15271527
lteppp_disconnect();
15281528
lte_obj.init = false;
15291529
return mp_const_none;

0 commit comments

Comments
 (0)