8000 LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) + some fixes in firmware · Issue #42 · goshante/ats20_ats_ex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) + some fixes in firmware #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
diqezit opened this issue Apr 19, 2025 · 2 comments

Comments

@diqezit
Copy link
diqezit commented Apr 19, 2025

Comparing ATmega328P vs LGT8F328P for SI4732

As an alternative to the Arduino Nano 328P, the LGT8F328P microcontroller is gaining more and more attention
It remains instruction-compatible with the ATmega328P, and provides slightly higher performance with several advantages for battery-powered applications

1. Arduino Nano 328P Overview

Arduino Nano 328P

  • MCU: ATmega328P (8‑bit AVR)
  • Clock: 16 MHz (~16 MIPS)
  • Memory:
    • Flash: 32 KB (2 KB for bootloader)
    • SRAM: 2 KB
    • EEPROM: 1 KB
  • I/O:
    • 14 digital pins (6 PWM)
    • 8 analog inputs (10‑bit, 1024 levels)
  • Interfaces: UART, I²C, SPI
  • Power: 5 V (recommended 7–12 V, accepts 6–20 V)
  • Extras: Onboard LED on D13, extensive documentation and code examples

2. LGT8F328P Overview

LGT8F328P Board

  • MCU: 8‑bit RISC‑AVR core, AVR‑instruction compatible
  • Clock:
    • Internal up to 32 MHz
    • External crystal 16 MHz supported
  • Memory:
    • Flash: 32 KB
    • SRAM: 2 KB
    • EEPROM: emulated in Flash (configurable 1–8 KB, reduces available Flash)
  • I/O:
    • 14 digital pins (6 PWM, plus extra GPIO on some packages)
    • 8 analog inputs (12‑bit, 4096 levels)
  • Voltage: 1.8–5.5 V
  • Extras:
    • 8‑bit DAC
    • Internal references: 1.024 V, 2.048 V, 4.096 V
    • Signal amplifier for ADC
    • Extra timers (Timer3) with up to 9 PWM channels
    • Unique ID (GUID)
    • DSC accelerator for fast 16‑bit math
    • PWM dead‑time control
    • Some boards add LDO, USB‑C, Bluetooth 5.0, hardware encryption

3. Performance Comparison

  • Clock speed: LGT8F328P can run at twice the frequency (32 vs. 16 MHz)
  • Benchmarks: At 32 MHz, LGT8F328P completes simple loops almost twice as fast as a Nano at 16 MHz
  • DSC accelerator: Speeds up 16‑bit operations further
  • Setup note: You must adjust clock prescalers to actually reach 32 MHz

4. Memory & EEPROM

  • Flash/SRAM are identical: 32 KB / 2 KB
  • EEPROM:
    • Nano has dedicated 1 KB
    • LGT8F328P emulates EEPROM in Flash (≤8 KB, wear limited to ~100,000 cycles, uses part of Flash)
  • Reliability: Dedicated EEPROM generally endures more cycles per byte than emulation

5. Other Key Differences

  • Voltage range: LGT8F328P: 1.8–5.5 V (vs. 5 V on Nano)
  • ADC accuracy: 12‑bit on LGT8F328P vs. 10‑bit on Nano
  • DAC & references: Only available on LGT8F328P
  • Pin drive: Up to 80 mA on some LGT8F328P pins
  • Programming: Some LGT8F328P boards use SWD/SWC ISP, and may need manual reset before upload
  • Documentation: Nano has complete, well‑translated docs; LGT8F328P docs can be sparse or in Chinese

6. Pin Compatibility Comparison

Compare PinOUT

  • LGT8F328P can effectively control the shutdown mode of MD8002A (pin 1 in the schematic)

  • Approximately 1.5× longer battery life while maintaining all functions

  • SI4732 uses a 3.3V I²C/SPI interface, and the LGT8F328P can work directly with this voltage without level converters

  • Additional LGT8F328P interrupts allow more efficient processing of SI4732 events (RDS data, signal level changes)

  • Сonditionally if the built-in DAC in LGT8F328P will be able to add smooth volume rise and fade when turning the radio on and off

  • This will get rid of the unpleasant clicking noise that comes from the abrupt level changes in the SI4732

  • Essentially, will be feeding another analog signal to the MD8002A's input for smooth gain control, which will give a more pleasant interaction with the unit

inline void setI2CStandardMode(void) { Wire.setClock(100000); }; inline void setI2CFastMode(void) { Wire.setClock(400000); }; inline void setI2CFastModeCustom(long value = 500000) { Wire.setClock(value); };
loading patches for SSB mode + а frequent updates of RDS data and rapid changes of frequency and operating modes

But to the disadvantages

Critical disadvantage - Emulated EEPROM reduces the available code space, potentially when EEPROM is actively used then the memory may degrade faster (write/rewrite cycles).

Noise reduction

I also recommend to use ferrite flat beads for the connector loop, in my case it significantly reduced the noise on the si4732 from running oled display.

serde4nik.jpg

@diqezit diqezit changed the title LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) Apr 19, 2025
@diqezit diqezit changed the title LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) label:enhancement Apr 19, 2025
@diqezit diqezit changed the title LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) label:enhancement LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) Apr 19, 2025
@diqezit
Copy link
Author
diqezit commented Apr 20, 2025

Firmware Modification to Eliminate Audio Pops in ATS-20 Receiver

With certainty I can say that the modification with the connection of pin 1 (from md8002a) to the arduino pin (in my way it's a3 pin) (25). And modification of the firmware remained quite working - I lost all the impulse jumps when switching the internal amplifier si4732 - you just need to modify a little bit of firmware in some places. It is important to avoid disrupting the work of the oled configs as well. But since this amplifier is used for the speaker, there will be no result on the headphones - because the 3.5 mm jack is BEFORE this amplifier.

Modifications Made

  1. Added hardware muting capability by connecting MD8002A amplifier's shutdown pin to Arduino
  2. Modified configuration in defs.h:
    #define MD8002A_SHUTDOWN_PIN A3 // Amplifier MD8002A disable pin
  3. Added amplifier control methods:
    • Created safeAmpOff() and safeAmpOn() to control the amplifier via MD8002A_SHUTDOWN_PIN
  4. Updated controller initialization:
    • Modified setup() to initialize amplifier control
  5. Enhanced mode switching logic:
    • Updated applyBandConfiguration() to properly handle amplifier during band changes
    • Added amplifier control before and after mode switching in loop() specifically for AM/SSB transitions.

This solution effectively eliminates audio pops when switching between different modulation modes. Note that this improvement only affects speaker output, not headphones, as the 3.5mm headphone jack is connected before this amplifier in the signal chain.

Upgrade archieve with firmare

ats20_ats_ex-master.zip

Image showing how to connect the pins

It is necessary to fix the clicking when switching to SYNC MODE - but this is still in process :)

And yes, please put a 100 nf capacitor between pin 1 and ground, just in case.

@diqezit diqezit changed the title LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) LGT8F328P vs ATmega328P - potential processor upgrade & replacement in ATS-20 - question/discussion (not issue) + some fixes in firmware Apr 20, 2025
@droneando
Copy link

Hi diqezit: I have implemented your audio pops fix. It works fine but the display also goes down every time the md8002a does, and come back to life with the amplifier. I dont know if it is normal behaviour or any thing goes wrong with my fix...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0