Mecrisp-Cube icon indicating copy to clipboard operation
Mecrisp-Cube copied to clipboard

Use case: NanoVNA

Open sbridger opened this issue 3 years ago • 0 comments

I thought I would write a little about this use case:

The NanoVNA analyser is a synthesised signal source, and tracking receiver that follows the source frequency, controlled by an STM32 equivalent. The hardware of this unit is very versatile. The nature of using this sort of gear is that there is an almost unlimited number of special applications. It is impossible (and foolish to try) to support them all into the firmware. It is both a standalone device, and one controlled by PC application software through a (serial) port. The authors of the pc software are not the authors of the firmware. When a new function at the PC level needs a new command in the firmware, it can't easily be implemented. When a new application (e.g use it as a signal generator) is outside the scope of the product, the designers won't (and shouldn't really) add it.

Where does Mecrisp-cube fit in? Firstly the program is in C, and is not going to be rewritten in forth. It needs/has a command interpreter for the external interface. By adding Forth you get the command interpreter function for free. You get macro capability to speed up repetitive command sequences for free. By using forth, the macro capability is essentially a full, unlimited programming language. Now any normal task can be accomplished from the pc hosted software sending forth commands. The end user / pc software author, can automate and extend, without touching the firmware.

If extensions require more firmware functionality, it is now only required to expose a low level function. A new function does not require the firmware author to implement anything above the basic level. Once that is done , users can handle most of the work involved in a special function: the UI, configuration and display. None of that falls on the firmware author.

As an example, a requested feature is an offset between the signal generator and detector frequencies. To implement this the usual way, means adding a new function to do it, a new serial command, and new offset parameters. In Forth, it can be implemented immediately, as the set frequency function is a basic exposed function.

sbridger avatar Sep 10 '21 00:09 sbridger