The term MiniEVB refers to small boards available in various sizes that are mostly compatible with Arduino. These use microcontrollers of the type LGT8F328P from the manufacturer LogicGreen (now: Prodesign Semiconductor) with an instruction set largely compatible with the ATmega328P, but with some enhancements. This article focuses on the so-called Nano Style LQFP32 MiniEVB, where the pins and their positions along the long sides match those of the Arduino Nano.
This board comes in two versions:
LGT8F328P | ATmega328P | |
---|---|---|
System Clock | up to 32 MHz (1.8V to 5.5V) |
up to 20 MHz (4.5V to 5.5V) up to 10 MHz (2.7V to 5.5V) up to 4 MHz (1.8V to 5.5V) |
Internal Oscillator | 32 MHz | 8 MHz |
Timers |
2× 8-bit, 2× 16-bit Frequency up to 64 MHz |
2× 8-bit, 1× 16-bit Frequency up to 20 MHz |
ADC |
12 channels (12-bit resolution) Gain: 1×, 8×, 16×, 32× Differential measurement supported |
8 channels (10-bit resolution) Gain: 1× No differential measurement |
DAC |
Available with 8-bit resolution (Port PD4 / Arduino GPIO 4) |
Not available |
Internal Reference Voltages | 1.024V, 2.048V, 4.096V (±1mV) | 1.1V (±100mV) |
EEPROM | Simulated EEPROM in flash memory | 1 kB EEPROM |
Current per GPIO | ≤ 30mA | ≤ 20mA |
The pinout of the LGT8F328P Nano board is nearly identical to that of the Arduino Nano, with a few differences:
There are 5 additional digital input/output pins; AREF, A6, and A7 can be used as digital pins, and the SWC and SWD pins are also available.
To compile and upload sketches for LGT8F328P Nano boards using the Arduino IDE, some initial setup is required.
Go to "Preferences → Additional Board Manager URLs" and add the following URL:
https://raw.githubusercontent.com/dbuezas/lgt8fx/master/package_lgt8fx_index.json
If another URL is already present in this field, it can be separated using a comma:
Next, the LGT8F328P Nano board must be installed. Go to "Tools → Board → Board Manager". Search for "lgt8fx" and install "LGT8fx Boards by dbuezas".
Now connect the LGT8FX to the PC via USB and select the port under
"Tools → Port:".
If the COM port is not available on Windows, you may need to install the
USB to UART Bridge.
For the first test, I used a slightly modified Blink-sketch. This can be compiled and uploaded just like with a standard Arduino:
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
for (byte i=0; i
Since the ADC can handle higher resolution and reference voltages, analog signals can be resolved more finely. The following experiment is similar in setup to the one from LDR GL55xx (without the LED). However, instead of the LDR, a potentiometer, piezo transducer, or similar could also be used.
/*
Parameter: Voltage reference:
----------------------------------------
DEFAULT VCC
EXTERNAL External Reference (REF)
INTERNAL1V024 Internal 1.024 volts
INTERNAL2V048 Internal 2.048 volts
INTERNAL4V096 Internal 4.096 volts
*/
void setup() {
Serial.begin(9600);
analogReference(INTERNAL4V096);
// 10, 11, or 12 bit
analogReadResolution(12);
}
void loop() {
int v = analogRead(A0);
float voltage = v * 4.096 / 4096.0;
Serial.print("Value: " + String(v) + "\t\t");
Serial.println("Voltage: " + String(voltage) + " V");
delay(50);
}
On pin #4 (D4 / PD4 / DAO), a real analog signal can be generated with a resolution of 8 bits:
void setup() {
analogReference(DEFAULT);
pinMode(DAC0, ANALOG);
analogWrite(DAC0, 69); // 0...255
}
void loop(){}
Since the Watchdog works a bit differently compared to the Arduino Nano, it is recommended to use the
dbuezas/WDT library instead of the avr/wdt.h library. In the following sketch, only the
line wdt_reset()
needs to be uncommented, and the sketch will run continuously.
/*
Parameter WDT reset period
--------------------------------
WTO_64MS 64 ms
WTO_128MS 128 ms
WTO_256MS 256 ms
WTO_512MS 512 ms
WTO_1S 1 s
WTO_2S 2 s
WTO_4S 4 s
WTO_8S 8 s
WTO_16S 16 s
WTO_32S 32 s
*/
#include "WDT.h"
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Serial.begin(9600);
Serial.println("Start");
wdt_enable(WTO_4S);
}
void loop() {
Serial.println("Elapsed time: " + String(millis()) + "ms");
delay(888);
// wdt_reset();
}