Author Topic: Forth: STM32F0 SWD terminal alternative to USART  (Read 1415 times)

0 Members and 1 Guest are viewing this topic.

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Forth: STM32F0 SWD terminal alternative to USART
« on: September 30, 2020, 08:56:45 am »
This project:

A STM32 technology demonstrator showcasing the advantages of using the SWD (Serial Wire Debugging) interface as a Forth Terminal instead of the legacy serial USART. This is made to use a STMicro STM32F0 Discovery board but can use a SWD-USB Programmer and a STM32F0xx mcu instead.

License:

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Credits:

    SWDcom Demo written by Terry Porter terry@tjporter.com.au
    SWDcom by Jan Bramkamp https://github.com/Crest/swdcom
    Mecrisp-Stellaris by Matthias Koch https://sourceforge.net/projects/mecrisp/

Serial communications.

Forth is one of the oldest programming languages in existence having been developed in the early 70's. In those days a computer running Forth usually communicated with a serial device, perhaps a Teletype or later a Wyse dedicated electronic terminal to allow interactive development and program uploading.

The availability of the IBM PC in the early 80's (and other readily available portable computers) allowed the use of terminal emulators such as Picocom, Minicom etc running on the PC itself instead of dedicated terminals.

Developer unfriendly Usart based Forth legacy serial communications issues:

    Slow, most Forths don't go above 115200 Baud.
    No serial flow control. This requires 'end of line delays' to prevent the Forth compiler 'choking' on uploaded source code. These can be as large as 200 milliseconds (depending on the speed of the Forth mcu) making source uploads glacial.
    Changing the mcu clock speed is tedious as the usart Baudrate is derived from it.
    An external 'USB to 3.3v Serial Dongle' is required for most 'development boards' and stand alone mcus to talk to the PC.
    Resetting the mcu requires entering 'reset' into the Forth console

Making Forth developer friendly in 2020.

Swdcom, provides a SWD based usart replacement along with a PC based terminal client that works with Linux and FreeBSD plus offers upload times equal to or faster than the equivalent GCC with Stlink on the same PC. Forth realtime interactivity also further reduces project development time.

Swdcom advantages:

    Works across a range of the same class of mcu free from usart/pin dependencies.
    Fast, faster than a equivalent 460800 Baud serial terminal.
    Inbuilt ACK flow control, no compiler 'choking' issues.
    Clock speed agnostic as long as the MCU clock is running the swd2 terminal functions perfectly.
    Uses a single USB cable from the PC to most development boards or a usb/swd programmer for standalone mcus.
    Resetting the mcu is easily done by hitting CTRL+C on the PC keyboard.

Running this Demo

This demo has been tested under Debian-10.6-xfce and FreeBSD so it should work for you on those platforms. It can be freely downloaded from the url below, testing comments and feedback welcome.

https://mecrisp-stellaris-folkdoc.sourceforge.io/swdcom.html

1078672-0
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf