Closed
Description
Description
- Type: Bug
- Possibly related issues: Semaphore release occurs before acquisition for TCP socket over UART #4575, Introduction of RTX/CMSIS 5 has broken semaphone signalling #4584, UARTSerial() and mutexes in interrupts #4537
- Priority: Major
Bug
Toolchain:
Tested with GCC_ARM
Toolchain version:
6-2017-q1-update
mbed-cli version:
1.1.1
mbed-os sha:
8828635
Similar behavior also observed with c9e63f1
Expected behavior
Can connect to the internet.
Actual behavior
The initial connection hangs with the following trace:
By pausing I get into the Default_Handler
with this trace:
Relevant code:
if (!netif_is_link_up(&lwip_netif)) { if (sys_arch_sem_wait(&lwip_netif_linked, 15000) == SYS_ARCH_TIMEOUT) { if (ppp) { ppp_lwip_disconnect(); } return NSAPI_ERROR_NO_CONNECTION; } }
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) { u32_t start = us_ticker_read(); if (osSemaphoreAcquire(sem->id, (timeout != 0)?(timeout):(osWaitForever)) != osOK) return SYS_ARCH_TIMEOUT; return (us_ticker_read() - start) / 1000; }
osSemaphoreAcquire
is also called before that, and consistently works:
sys_arch_sem_wait(&lwip_tcpip_inited, 0)
This is the call that fails:
sys_arch_sem_wait(&lwip_netif_linked, 15000)
Sometimes I can get past it by stopping with a breakpoint and continuing manually.
I could always successfully connect using 5.4.3 and 5.4.6 with a manually applied #4119 pretty much at all stages of its development.
I'm using the configuration from https://github.com/ARMmbed/mbed-os-example-cellular