Update documentation and make one small part change to improve 9600 baud and M17 decode performance.

m17
Rob Riggs 2021-01-03 16:36:26 -06:00
rodzic 4d097e8a66
commit b8e080538e
6 zmienionych plików z 38284 dodań i 134027 usunięć

Wyświetl plik

@ -211,12 +211,14 @@
"\n",
"There are a number of components in this subsection:\n",
"\n",
" * C2 - 220nF DC blocking capacitor.\n",
" * R1 - 10K DC-offset resistor, along with C2 forms a 72Hz high-pass filter.\n",
" * C2 - 1uF DC blocking capacitor.*\n",
" * R1 - 10K DC-offset resistor, along with C2 forms a 15Hz high-pass filter.\n",
" * D1, D2 - voltage limiter.\n",
" * U1C - audio buffer.\n",
" * R7, R10, R14, C4, C6, C8, and U1D - 3-pole active Bessel anti-aliasing filter.\n",
" \n",
"C2 was changed in 2021 to a 1uF to improve the low frequency response needed for 9600 baud.\n",
"\n",
"The quad op amp U1 is shared across the Audio Input and Audio Output sections.\n",
" \n",
"Audio signal from the radio is fed through the capacitor C2 to block DC from the radio. A DC bias voltage fed in from the MCU's DAC channel 2 (PA5) through a 10K resistor (R1), forming a high-pass filter. This then passes through a pair of diodes which limit the voltage begin fed into the op-amp. Amplified audio from a radio's speaker output can easily exceed the voltage limits of the op amp inputs. The op-amp U1C is an audio buffer to provide the low output impedance to feed the anti-aliasing filter.\n",
@ -225,6 +227,11 @@
"\n",
"https://en.wikipedia.org/wiki/Anti-aliasing_filter\n",
"\n",
"I used the following resources when designing the filter:\n",
"\n",
" * http://www.ti.com/lit/an/sloa049b/sloa049b.pdf\n",
" * http://sim.okawa-denshi.jp/en/OPstool.php\n",
"\n",
"After the anti-alaising filter, the audio enters the MCU. Inside the MCU is a programmable gain amplifier (PGA) which can amplify the audio signal in discrete steps of 1X (0dB), 2X, 4X, 8X, and 16X. The DC offset of the amplifier changes based on the amplification level from 1/2 to 1/32 (1.65V - 100mV). The bias voltage output by DAC channel 2 is adjusted in step with the amplification level by the firmware in the TNC.\n",
"\n",
"### Audio Output\n",
@ -295,17 +302,16 @@
"| AVX Corporation \t| SR201A102JAR \t| CAP CER 1000PF 100V C0G/NP0 RAD \t| 2 \t| 0.29 \t| 0.58 \t|\n",
"| Vishay BC Components \t| K103M15X7RF53L2 \t| CAP CER 10000PF 50V X7R RADIAL \t| 1 \t| 0.21 \t| 0.21 \t|\n",
"| AVX Corporation \t| SR215C104KAA \t| CAP CER 0.1UF 50V X7R RADIAL \t| 2 \t| 0.2 \t| 0.40 \t|\n",
"| TDK Corporation \t| FG14X7R1H224KNT00 \t| CAP CER 0.22UF 50V X7R RADIAL \t| 1 \t| 0.3 \t| 0.30 \t|\n",
"| TDK Corporation \t| FG26X7R1E105KNT06 \t| CAP CER 1UF 25V X7R RADIAL \t| 1 \t| 0.34 \t| 0.34 \t|\n",
"| TDK Corporation \t| FG28X7R1A225KRT06 \t| CAP CER 2.2UF 10V X7R RADIAL \t| 1 \t| 0.34 \t| 0.34 \t|\n",
"| Vishay BC Components \t| K333K15X7RF5TL2 \t| CAP CER 0.033UF 50V X7R RADIAL \t| 2 \t| 0.23 \t| 0.46 \t|\n",
"\n",
"\n",
"The total component cost for these items is about $25 USD from Digikey.\n",
"\n",
"You can purchase these directly from Digi-Key using this link: https://www.digikey.com/short/phmpd4\n",
"\n",
"It might be worthwhile to buy an extra one of each of the passive components in case one is lost or a lead is accidentally cut too short.\n",
"\n",
"*Note: C2 was changed from a 220nF capacitor to a 1uF capacitor in early 2021.*\n",
"\n",
"### Substitutions\n",
"\n",
@ -337,10 +343,11 @@
"\n",
"Nice to have equipment:\n",
"\n",
" * An extra 2M radio.\n",
" * An RTL-SDR (Ultra-cheap SDR).\n",
" * An extra 2M radio or, better yet...\n",
" * An [ultra-cheap SDR](https://amzn.to/2LslXHj) (AKA RTL-based USB DVB dongle).\n",
" * An oscilloscope.\n",
" * A signal generator.\n",
" * A logic analyzer, such as a $15 [USB logic analyzer](https://amzn.to/2XhLOnS) controlled with the [Sigrok software & firmware](https://sigrok.org/wiki/Noname_Saleae_Logic_clone) is more than adequate for this project.\n",
"\n",
"\n",
"## Assembly\n",
@ -553,7 +560,7 @@
"**Parts required:**\n",
"\n",
" * 2 BAT85S Schottky diodes.\n",
" * 1 220nF capacitor.\n",
" * 1 1uF capacitor.*\n",
" * 1 33nF capacitor.\n",
" * 1 1nF capacitor.\n",
" * 1 470pF capactor.\n",
@ -562,14 +569,16 @@
" * 1 30kΩ resistor.\n",
" * 1 510Ω resistor.\n",
" * Various jumper wires.\n",
" \n",
"\n",
"*\\*Note: this was changed to from 220nF to 1uF in early 2021.*\n",
"\n",
"We will now create the audio input section, including the AC coupling cap, DC offset connection, protection diodes, input buffer, and anti-aliasing filter.\n",
"\n",
" * Connect a wire from *c58-c50*\n",
" * Connect one diode from *a49* to the lower ground rail. The cathode band should be nearest *a49*.\n",
" * Connect one diode from *j49* to the upper power rail. The cathode bnad should be neares the power rail.\n",
" * Connect a jumper wire across the *e49-f49* gap.\n",
" * Connect the 220nF capacitor from *e50* to *g49*.\n",
" * Connect the 1uF capacitor, C2, from *e50* to *g49*.\n",
" * Connect the 10kΩ resistor from *h46* to *h49*.\n",
" * Connect a wire from *i49* to *i36*.\n",
" * Connect a short jumper from *g37* to *g38*, tying VinA- to VoutA\n",
@ -898,7 +907,37 @@
"Filtered audio output should appear at the resistor lead at *i29*.\n",
"\n",
"Verify all of the connections in the [Audio Input](Audio Input) section.\n",
"\n"
"\n",
"### Saving Settings\n",
"\n",
"To verify that settings are being saved:\n",
"\n",
" * Connect the Nucleo board via USB to turn it on.\n",
" * Start the configuration app.\n",
" * Connect to the TNC.\n",
" * Change a setting, such as the input twist.\n",
" * Go to the \"Save Settings\" page.\n",
" * Click the \"Save Changes\" button. This should write the changes to EEPROM.\n",
" * Press the \"Disconnect\" button.\n",
" * Disconnect the USB cable momentarily, then reconnect it. This will reset the board and cause the TNC to read the configuration from EEPROM.\n",
" * In the configuration app, connect to the TNC.\n",
" * Verify that the setting you change has been retained.\n",
"\n",
"If the above test fails:\n",
"\n",
" * Using a DMM, check that the EEPROM has 3.3V power at *f21*.\n",
" * Using a DMM, check that the EEPROM is pulled up to 3.3V at *f23* and *f24*.\n",
" * Using a DMM, check that the WP pin at *f22* is pulled low (0V).\n",
" * Using a DMM, check that all of the address lines and ground line, *e21, e22, e23, e24* are connected to ground.\n",
" * Verify a wire connects from *a15* to *i24* for I2C SDA on the EEPROM.\n",
" * Verify a wire connects from *j6* to *i23* for I2C SCL on the EEPROM.\n",
"\n",
"If this looks OK, we will need to probe the I2C bus.\n",
"\n",
" * Use an oscilloscope to probe the I2C lines at *g23* (CH1/SCL) and *g24* (CH2/SDA).\n",
" * Use a logic analyzer to probe the data on the I2C bus. Refer to the data sheet for the expected data.\n",
"\n",
"Sigrok software can be used to decode the I2C data and even the higher-level 24Cxx EEPROM read/write protocol."
]
},
{
@ -925,7 +964,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.9"
}
},
"nbformat": 4,

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 3.4 MiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 351 KiB

Wyświetl plik

@ -1,4 +1,4 @@
update=Sat 22 Jun 2019 10:45:54 PM CDT
update=Sun 03 Jan 2021 04:32:37 PM CST
version=1
last_client=kicad
[general]
@ -35,16 +35,10 @@ LibDir=
[schematic_editor]
version=1
PageLayoutDescrFile=
PlotDirectoryName=
PlotDirectoryName=/home/rob/workspace/Nucleo_L432KC_TNC/KiCAD/
SubpartIdSeparator=0
SubpartFirstId=65
NetFmtName=
SpiceAjustPassiveValues=0
LabSize=50
ERC_WriteFile=0
ERC_TestSimilarLabels=1
ERC_CheckUniqueGlobalLabels=1
ERC_CheckBusDriverConflicts=1
ERC_CheckBusEntryConflicts=1
ERC_CheckBusToBusConflicts=1
ERC_CheckBusToNetConflicts=1

Wyświetl plik

@ -1,12 +1,12 @@
EESchema Schematic File Version 5
EELAYER 29 0
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title "Nucleo32 TNC"
Date "2019-06-13"
Rev "A"
Date "2021-01-03"
Rev "B"
Comp "Mobilinkd TNC"
Comment1 "Breadboard TNC Project"
Comment2 "STM32L432 Nucleo32 Board"
@ -404,7 +404,7 @@ L Device:C C1
U 1 1 5D0E12F1
P 1350 3250
F 0 "C1" V 1098 3250 50 0000 C CNN
F 1 "0.22uF" V 1189 3250 50 0000 C CNN
F 1 "1uF" V 1189 3250 50 0000 C CNN
F 2 "" H 1388 3100 50 0001 C CNN
F 3 "~" H 1350 3250 50 0001 C CNN
1 1350 3250

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 3.4 MiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 351 KiB

Wyświetl plik

@ -1,5 +1,73 @@
# nucleo32-l432kc-tnc-firmware
Source code for breadboard TNC based on STM32L432KC Nucleo32 dev board
# NucleoTNC Firmware
Source code for STM32L432KC Nucleo32-based TNC (PCB & breadboard version).
http://www.mobilinkd.com/2019/06/24/nucleotnc/
# Building
Use Eclipse with CDT and the GNU MCU Eclipse plugins.
If you are porting this to another build platform, you will need to
build the firmware using the same compiler and linker options. As
with most firmware projects, there is a linker script with defines
the memory layout for for the Flash and SRAM.
Below are example compilation and linking lines for reference:
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O2 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-inline-functions -fsingle-precision-constant -fstack-usage -fstrict-aliasing -ffast-math -Wall -Wextra -Wlogical-op -Wfloat-equal -g -D__FPU_PRESENT=1 -DUSE_HAL_DRIVER -DARM_MATH_CM4 -DSTM32L432xx -D__weak=__attribute__((weak)) -DNUCLEOTNC=1 -I../Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I/home/rob/workspace/Nucleo_L432KC_TNC/Inc -I/home/rob/workspace/Nucleo_L432KC_TNC/Drivers/STM32L4xx_HAL_Driver/Inc -I/home/rob/workspace/Nucleo_L432KC_TNC/Drivers/CMSIS/Include -I/home/rob/workspace/Nucleo_L432KC_TNC/Drivers/CMSIS/Device/ST/STM32L4xx/Include -I/home/rob/workspace/Nucleo_L432KC_TNC/Middlewares/Third_Party/FreeRTOS/Source/include -I/home/rob/workspace/Nucleo_L432KC_TNC/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -I/home/rob/workspace/Nucleo_L432KC_TNC/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -I/home/rob/workspace/Nucleo_L432KC_TNC/TNC -I/usr/arm-none-eabi/include -std=gnu++1z -fabi-version=9 -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics -Wno-register -c -o TNC/HdlcFrame.o ../TNC/HdlcFrame.cpp
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O2 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-inline-functions -fsingle-precision-constant -fstack-usage -fstrict-aliasing -ffast-math -Wall -Wextra -Wlogical-op -Wfloat-equal -g -T /home/rob/workspace/Nucleo_L432KC_TNC/STM32L432KC_FLASH.ld -Xlinker --gc-sections -Wl,-Map,firmware.map --specs=nano.specs -o firmware.elf Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_crc.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_crc_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dac.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dac_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_opamp.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_opamp_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rng.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rtc_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.o Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.o Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.o Middlewares/Third_Party/FreeRTOS/Source/croutine.o Middlewares/Third_Party/FreeRTOS/Source/event_groups.o Middlewares/Third_Party/FreeRTOS/Source/list.o Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.o Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.o Middlewares/Third_Party/FreeRTOS/Source/queue.o Middlewares/Third_Party/FreeRTOS/Source/tasks.o Middlewares/Third_Party/FreeRTOS/Source/timers.o Src/arm_fir_f32.o Src/arm_fir_fast_q15.o Src/arm_fir_init_f32.o Src/arm_fir_init_q15.o Src/arm_fir_interpolate_init_q15.o Src/arm_fir_interpolate_q15.o Src/arm_offset_q15.o Src/arm_q15_to_float.o Src/freertos.o Src/main.o Src/stm32l4xx_hal_msp.o Src/stm32l4xx_hal_timebase_TIM.o Src/stm32l4xx_it.o Src/system_stm32l4xx.o TNC/AFSKModulator.o TNC/AFSKTestTone.o TNC/Afsk1200Demodulator.o TNC/AfskDemodulator.o TNC/AudioInput.o TNC/AudioLevel.o TNC/DCD.o TNC/Demodulator.o TNC/FilterCoefficients.o TNC/Fsk9600Demodulator.o TNC/Fsk9600Modulator.o TNC/Goertzel.o TNC/Golay24.o TNC/HdlcDecoder.o TNC/HdlcFrame.o TNC/IOEventTask.o TNC/Kiss.o TNC/KissHardware.o TNC/KissTask.o TNC/LEDIndicator.o TNC/Log.o TNC/M17.o TNC/M17Demodulator.o TNC/M17Encoder.o TNC/M17Modulator.o TNC/ModulatorTask.o TNC/NullPort.o TNC/PortInterface.o TNC/SerialPort.o newlib/_exit.o newlib/_sbrk.o newlib/_syscalls.o startup/startup_stm32l432xx.o
All of the macros defined on the compiler line are important in order
to properly build the firmware.
# Debugging
Logging is enabled in debug builds and is output via ITM (SWO). The
firmware is distributed with an openocd stlink config file that enables
ITM output to a named pipe -- `swv`. You must create this pipe in the
top level directory.
To read from this pipe, open a terminal and run:
`while true; do tr -d '\01' < swv; done`
If you change the MCU's core clock, you need to adjust the timing in the
`stlink-tnc3.cfg` config file.
The TNC3 runs at 48MHz on startup. It may switch to 80MHz for modulation
types (9600, M17) which require more speed. This makes using SWO challenging
as it cannot handle changes in core speeds.
# Installing firmware
Firmware can be installed via the on-board ST/LINK port or via USB DFU.
## USB DFU
1. Download the STM32CubeProgrammer.
https://s3.amazonaws.com/mobilinkd/en.stm32cubeprog-1.4.0.zip
This programmer will work on Linux, OS X, and Windows.
2. Download the ELF file from the release (or that you have built from source).
3. Plug the TNC into a USB port and turn the TNC on. You should see a USB serial port enumerated.
4. Put the TNC into DFU mode by pressing the DFU button on the side. The TNC
will only enter DFU mode when plugged into a USB port.
![TNC3 Diagram](https://s3.amazonaws.com/mobilinkd/TNC3/TNC3_Diagram.png)
***There is no visible indication on the TNC that it is in DFU mode***
5. You should see the serial port device go away and a new DFU device appear.
6. Run the STM32CubeProgrammer from the command-line. (Replace "firmware.elf" with the appropriate firmware filename.)
./STM32_Programmer_CLI -c port=USB1 -d firmware.elf -v -g 0x8000000
7. When that is complete, the DFU device will disappear and the serial port
device will re-appear.
----
@ -16,8 +84,6 @@ Details of the defect are available [on the ST community site](https://community
----
We use Eclipse CDT with the GNU MCU Eclipse plugin to build this project.
## TNC Build Instructions
Please go here: [TNC Build Instructions](Build/NucleoTNC.ipynb)