The MODBUS project has buffered UART, which is necessary because the protocol works in the background.
A UART buffer for the Forth console also makes sense, especially when a baud rate higher than 9600 baud is to be used. The solution INTRX, with an ISR written in Forth, is really simple.
Edit1: INTRX has been updated and now supports the new device independent UART symbols. The code will be included in the upcoming STM8 eForth 2.2.24 release. Compiling with a 38400 baud console is really a lot faster.
The In PulseView screenshot below shows a situation where the Background Task blocks the foreground console execution most of the time:

An interactive console still works. For some reason compiling is much more picky : the background task is allowed to run for a 2.5 out of 5 ms (that is 2-3 char intervals at 9600 baud). I still don't understand why but it has nothing to do with delays due to Flash programming.
Edit2: the solution is, very simply, that the receive buffer wasn't big enough for this much delay. If I use 80 bytes (the same length as the TIB) uploading Forth code works without problems:
Also Flash programming works as expected - this is no surprise since the programming process starts at the end of a line and stalls all, also the background task.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.