While debugging https://github.com/dartino/sdk/issues/522 the connected screen to the STM32F746G Discovery board could stop getting UART data. The output could stop like this:
Hello Dartino!
Making HTTP request 30385...
Message from server:
Hello Dartino!
Making HTTP request 30386...
Message from server:
Hello Dartino!
M
while the test kept running until 100000+ requests.
Turned out that the sending should be in progress and the write buffer is full.
The USART_CR1 register is missing the TXEIE flag (bit 7).
Turning it on in the debugger:
(gdb) set *((int *) 0x40011000) = 0x000001ad
Caused more output on screen
ello Dartino!
Making HTTP request 30387...
Message from server:
Hello Dartino!
Making HTTP request 30388...
Message from server:
Hello Dartino!
Making HTTP request 30389...
Message from server:
Hello Dartino!
Making HTTP request 30390...
Message from server:
Hello Dartino!
Making HTTP request 30391...
Message from server:
Hello Dartino!
Making HTTP request 30392...
Message from server:
Hello Dartino!
Making HTTP request 30393...
Message from server:
Hello Dartino!
Making H
Somehow the TXEIE flag gets cleared and not set again. Looking at the code the only place TXEIE is disabled is also setting tx_pending_ to false. However tx_pending_ is true so there is a race.
While debugging https://github.com/dartino/sdk/issues/522 the connected
screen
to the STM32F746G Discovery board could stop getting UART data. The output could stop like this:while the test kept running until 100000+ requests.
Turned out that the sending should be in progress and the write buffer is full.
Looking at the USART1 registers:
The
USART_CR1
register is missing theTXEIE
flag (bit 7).Turning it on in the debugger:
Caused more output on
screen
Emptying the write buffer
Somehow the
TXEIE
flag gets cleared and not set again. Looking at the code the only placeTXEIE
is disabled is also settingtx_pending_
tofalse
. Howevertx_pending_
istrue
so there is a race.