Skip to content

Commit 72901a9

Browse files
cedrickkukela-cdadbridge
authored andcommitted
fixing onboard modem init bug on mts dragonfly l471
1 parent c98f402 commit 72901a9

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

targets/TARGET_STM/TARGET_STM32L4/TARGET_MTS_DRAGONFLY_L471QG/onboard_modem_api.c

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,57 @@ void onboard_modem_init()
4646
gpio_init_inout(&gpio, RADIO_PWR, PIN_OUTPUT, PushPullNoPull, 1);
4747
gpio_init_inout(&gpio, BUF_EN, PIN_OUTPUT, OpenDrainNoPull, 0);
4848
gpio_init_inout(&gpio, MDMRST, PIN_OUTPUT, OpenDrainNoPull, 1);
49+
gpio_init_inout(&gpio, MDMPWRON, PIN_OUTPUT, OpenDrainNoPull, 1);
4950
}
5051

5152
void onboard_modem_deinit()
5253
{
5354
gpio_t gpio;
5455

5556
// Back into reset
56-
gpio_init_inout(&gpio, RADIO_PWR, PIN_OUTPUT, PushPullNoPull, 0);
57-
gpio_init_inout(&gpio, BUF_EN, PIN_OUTPUT, OpenDrainNoPull, 1);
5857
gpio_init_inout(&gpio, MDMRST,PIN_OUTPUT, OpenDrainNoPull, 0);
58+
gpio_init_inout(&gpio, BUF_EN, PIN_OUTPUT, OpenDrainNoPull, 1);
59+
gpio_init_inout(&gpio, RADIO_PWR, PIN_OUTPUT, PushPullNoPull, 0);
5960
}
6061

62+
63+
64+
6165
void onboard_modem_power_up()
6266
{
6367
#if defined(TARGET_UBLOX_C030_R410M)
6468
/* keep the power line low for 1 seconds */
6569
press_power_button(1000000);
6670
#else
6771
/* keep the power line low for 50 microseconds */
68-
press_power_button(1000000);
72+
gpio_t gpio;
73+
gpio_init_in(&gpio, MON_1V8);
74+
75+
if(gpio_is_connected(&gpio) != 0 && gpio_read(&gpio) != 0) {
76+
unsigned int i = 0;
77+
while(i < 5)
78+
{
79+
press_power_button( 2000000);
80+
wait_ms(1000);
81+
onboard_modem_deinit();
82+
wait_ms(1000);
83+
onboard_modem_init();
84+
wait_ms(250);
85+
86+
if(gpio_is_connected(&gpio) != 0 && gpio_read(&gpio) == 0)
87+
{
88+
break;
89+
}
90+
i++;
91+
}
92+
}
93+
94+
press_power_button( 2000000);
95+
6996
#endif
7097

7198
/* give modem a little time to respond */
72-
wait_ms(100);
99+
wait_ms(500);
73100
}
74101

75102
void onboard_modem_power_down()
@@ -79,7 +106,7 @@ void onboard_modem_power_down()
79106
press_power_button(1500000);
80107
#else
81108
/* keep the power line low for 1 seconds */
82-
press_power_button(1500000);
109+
press_power_button(300000);
83110
#endif
84111
}
85112

targets/targets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@
21822182
}
21832183
},
21842184
"detect_code": ["0312"],
2185-
"macros_add": [ "RTC_LSE=1"],
2185+
"macros_add": [ "RTC_LSE=1", "CELLULAR_DEVICE=UBLOX_PPP"],
21862186
"device_has_add": ["ANALOGOUT", "CAN", "LOWPOWERTIMER", "SERIAL_ASYNCH", "SERIAL_FC", "TRNG", "FLASH", "ANALOGIN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
21872187
"release_versions": ["2", "5"],
21882188
"device_name": "STM32L471QG",

0 commit comments

Comments
 (0)