Fg3avr is 3 channels frequency generator for arduino with ATMEGA328P mcu. It can be used for various purposes, for example, it can drive 3 phase motors or can be used for 3 phase AC generation
- Frequency outputs are digital, the pins used for output are D2, D3, D4
- Generator is driven by UART commads. UART pins used are default D0 and D1
- Each frequency has startup delay, 'on' period and 'off' period adjustable parameters. Also generation can be turned off independently for each channel
- Frequency parameters can be stored in eeprom and loaded from eeprom.
- At board power-up it checks if there are frequencies stored in eeprom. They are loaded from eeprom and generation starts automatically, no need to connect and setup by UART
This board has capabilities below
- Min timing units 1
- Max timing units 65535
- CPU ticks per one time unit 21
- CPU ticks per one second 16000000
So this device has 1.3125 micro seconds resolution per one unit. Max frequency it is able to generate is 378 kHz
Each command contains additional CRC bytes at the end. The checksum algorithm used is CRC16/MODBUS.
UART protocol now is upgraded to support 32 bit timing ranges, but this generator has limited timing resolution up to 16 bits.
The UART speed is 19200 bps. All values use big endian byte ordering (highest byte comes first)
-
Command 00 - PING PONG
Used to check if board is connected and alive0x00 0x40 0xBF -
Command 01 - SET FREQUENCIES
if ON period equals to 0 then frequency is muted (off)
Command contains 39 bytes. F1, F2, F3 - three frequenciesCommand 0x01 DELAY for F1 32 bit value ON period for F1 32 bit value OFF period for F1 32 bit value DELAY for F2 32 bit value ON period for F2 32 bit value OFF period for F2 32 bit value DELAY for F3 32 bit value ON period for F3 32 bit value OFF period for F3 32 bit value CRC16 Checksum 16 bits -
Command 02 - STORE TO EEPROM
Stores current frequencies to eeprom0x02 0x81 0x3E -
Command 03 - LOAD FROM EEPROM
Loads frequencies from eeprom, this is done also at the reset (startup)0x03 0x41 0xFF -
Command 04 - CHECK CAPABILITIES
Request device capabilities (timing range, ticks per one unit, cpu ticks per second)0x04 0x83 0xBE -
Possible arduino responses:
OK, COMMAND EXECUTED
0x00 CRC checksum 16 bits BAD COMMAND (CRC ERROR)
0x01 CRC checksum 16 bits BAD DATA IN EEPROM (CRC ERROR)
0x02 CRC checksum 16 bits CAPABILITIES (Response to command 04)
Command 0x04 Min units 1 0x00 0x00 0x00 0x01 Max units 65536 0x00 0x00 0xff 0xff Ticks per one unit 21 0x00 0x00 0x00 0x15 CPU ticks per one second 16000000 0x00 0xf4 0x24 0x00 CRC 16 bits 0x06 0x17