Skip to content

Commit 9875c29

Browse files
authored
Merge pull request #3990 from u-blox/c027_boot_fix
UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the …
2 parents b25eaf5 + 965404c commit 9875c29

File tree

1 file changed

+5
-1
lines changed
  • targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027

1 file changed

+5
-1
lines changed

targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/C027_api.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "gpio_api.h"
1717
#include "mbed_wait_api.h"
1818
#include "C027_api.h"
19+
#include "us_ticker_api.h"
1920

2021
static gpio_t mdmEn, mdmLvlOe, mdmILvlOe, mdmUsbDet;
2122
static gpio_t gpsEn;
@@ -36,7 +37,10 @@ void c027_init(void) {
3637
// led should be off
3738
gpio_init_out_ex(&led, LED, 0);
3839

39-
wait_ms(50); // when USB cable is inserted the interface chip issues
40+
// Can't use wait_ms() as RTOS isn't initialised yet
41+
// so this is the correct way to wait for 50 ms
42+
uint32_t start = us_ticker_read();
43+
while ((us_ticker_read() - start) < 50000);
4044
}
4145

4246
void c027_mdm_powerOn(int usb) {

0 commit comments

Comments
 (0)