Closed TG9541 closed 4 years ago
At least on the STM8L051F3 sser_hdx also works. The optional "point 5." will thus be met.
While I was at it I made TIM4_ARR
and TIM4_PSCR
configuration items and tested baud rates higher than 9600 baud using the simulated serial interface.
This is what worked:
Rate | CTIM4ARR | CTIM4PSCR | sser-fdx | sser-hdx |
---|---|---|---|---|
600 | 7 | 0xCF | yes* | yes* |
1200 | 6 | 0xCF | yes* | yes* |
2400 | 5 | 0xCF | yes* | yes* |
4800 | 4 | 0xCF | yes | yes |
9600 | 3 | 0xCF | yes | yes |
19200 | 2 | 0xCF | yes | yes |
38400 | 1 | 0xCF | yes | yes |
57600 | 1 | 0x89 | (yes) | yes |
115200 | 0 | 0x89 | no | (yes) |
*) untested but very likely to work - due to a 4 bit pre-scaler index STM8L devices can also use 300, 150, 75 downto 2.34375 baud - maybe that's useful for communication with a flashlight ;-)
Full-duplex at 115200 baud was too much for the combined TIM4 Rx/Tx state machine, and it stopped working. 115200 with half-duplex worked fine (using the new "-r" option of codeload.py, see #320) but I didn't test it with e4thcom since the baud rate in version 0.8.0.64 appears to be limited to 57600.
To be safe I would suggest limiting the usage of the simulated serial in full-duplex to 38400 baud and in half-duplex to 57600 baud.
A proof-of-concept is in the repo STM8 eForth STM8L051LED.
Here are some requirements for the solution: