Write simple profiling definitions
START_PROFILE
STOP_PROFILE
Use it for detect sys tick amount and output to screen
main.c
Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
Use VNA_SHELL_FUNCTION definition for all commands
Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
Apply default scale from trace_info on trace change
Led blink outside from main sweep cycle (better look, and less noise)
Some size fixes
chprintf.c
Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
Use it in all code (little increase speed, and huge decrease size)
Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)
plot.c
Made huge screen render profile (add some comments)
Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
Clip cell if need only on screen flush
Use new plot_printf, remove chsnprintf usage
Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
uint32_t *p = (uint32_t *)spi_buffer;
while (count--) {
p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
p+=4;
}
gives x10 speed perfomance
Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
|
||
|---|---|---|
| .circleci | ||
| .vscode | ||
| ChibiOS@669d4bbc8d | ||
| doc | ||
| NANOVNA_STM32_F072 | ||
| python | ||
| .gdbinit | ||
| .gitignore | ||
| .gitmodules | ||
| adc.c | ||
| chconf.h | ||
| chprintf.c | ||
| dsp.c | ||
| ffconf.h | ||
| fft.h | ||
| flash.c | ||
| Font5x7.c | ||
| halconf.h | ||
| ili9341.c | ||
| main.c | ||
| Makefile | ||
| mcuconf.h | ||
| nanovna.h | ||
| numfont20x22.c | ||
| plot.c | ||
| prog.sh | ||
| README.md | ||
| si5351.c | ||
| si5351.h | ||
| STM32F072xB.ld | ||
| tlv320aic3204.c | ||
| ui.c | ||
| usbcfg.c | ||
| usbcfg.h | ||
NanoVNA - Very tiny handheld Vector Network Analyzer
About
NanoVNA is very tiny handheld Vector Network Analyzer (VNA). It is standalone with lcd display, portable device with battery. This project aim to provide an RF gadget but useful instrument for enthusiast.
This repository contains source of NanoVNA firmware.
Prepare ARM Cross Tools
UPDATE: Recent gcc version works to build NanoVNA, no need old version.
MacOSX
Install cross tools and firmware updating tool.
$ brew tap px4/px4
$ brew install gcc-arm-none-eabi-80
$ brew install dfu-util
Linux (ubuntu)
Download arm cross tools from here.
$ wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2
$ sudo tar xfj gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2 -C /usr/local
$ PATH=/usr/local/gcc-arm-none-eabi-8-2018-q4-major/bin:$PATH
$ sudo apt install -y dfu-util
Fetch source code
Fetch source and submodule.
$ git clone https://github.com/ttrftech/NanoVNA.git
$ cd NanoVNA
$ git submodule update --init --recursive
Build
Just make in the directory.
$ make
Build firmware using docker
Using this docker image and without installing arm toolchain, you can build the firmware.
$ cd NanoVNA
$ docker run -it --rm -v $(PWD):/work edy555/arm-embedded:8.2 make
Flash firmware
First, make device enter DFU mode by one of following methods.
- Jumper BOOT0 pin at powering device
- Select menu Config->DFU (needs recent firmware)
Then, flash firmware using dfu-util via USB.
$ dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/ch.bin
Or simply use make.
$ make flash
Companion Tools
There are seveal numbers of great companion PC tools from third-party.
- NanoVNASharp Windows software by hugen79
- NanoVNA WebSerial/WebUSB by cho45
- Android NanoVNA app by cho45
- NanoVNASaver by mihtjel
- TAPR VNAR4 supports NanoVNA by erikkaashoek
- see python directory to use NanoVNA with Python and Jupyter Notebook.
Documentation
- NanoVNA User Guide (google translate) by cho45
Reference
- Schematics
- PCB Photo
- Block Diagram
- Kit available from https://ttrf.tk/kit/nanovna
Note
Hardware design material is disclosed to prevent bad quality clone. Please let me know if you would have your own unit.