Getting an Wavgat Arduino Uno R3 to work on Mac OS was a challenging adventure, mainly because of poor documentation. Here is my definitive guide, current as of 2018-10-08.
- This is a MacBook Pro (Retina, 13-inch, Late 2013)
- The Arduino is a Wavgat Arduino Uno R3 (like this)
I'm attaching to this guide a bunch of files that are distributed all over the net. You can get them from the original links in the post, or use the versions that I attached here.
1. Install the Arduino IDE
Get the Arduino IDE from arduino.cc
Do not use the Web Editor; you need the IDE because we need to manually add configuration for the Wavgat.
After unzipping the file, copy it to "Applications". The remainder of this post assumes that this is where the IDE is located.
When you start the IDE, at this step, it will likely not see the Wavgat in the "Ports" menu. This is expected, and will be fixed in the next step.
2. Install CH340G drivers
Wavgat uses a non-standard USB chip called CH340G
. It requires you to install drivers.
You can get these from adrianmihalko's GitHub repo.
As of this writing, you need the CH34x_Install_V1.4.pkg
version. Download it, open, follow the installer steps, and reboot your computer.
After rebooting, You might need to unblock the driver. Check the section "Security and Privacy" in System Preferences for any notices about blocked software.
Now, you should see the Wavgat in /dev
when you connect it:
ls -l /dev/*usb*
crw-rw-rw- 1 root wheel 21, 15 Oct 8 23:11 /dev/cu.wchusbserial1410
crw-rw-rw- 1 root wheel 21, 14 Oct 8 23:08 /dev/tty.wchusbserial1410
However, when you launch a Sketch in the IDE, you will probably encounter the following error message:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
This is again expected, and will be fixed in the next step.
3. Install Wavgat's configuration files
Download the configuration files. I recommend that you use the wavgate-ide-update.zip
archive attached to this guide, because the files in there have already been patched (and so you don't need step 4 below). However, you can also get the configuration from this obscure .rar
file on Drive. More details in this post for Windows
Uncompress the archive. You should see a folder that looks roughly like this:
update
├── hardware
│ ├── WAV
│ │ └── avr
│ │ ├── boards.txt
│ │ ├── platform.txt
│ │ ├── programmers.txt
│ │ └── ...
│ └── WAV8F
│ ├── boards.txt
│ ├── bootloaders
│ ├── platform.txt
│ ├── programmers.txt
│ └── ...
└── libraries
├── E2PROM
├── PMU
└── ...
All this content needs to go into the IDE's installation folder. Close the IDE. Then copy the content like this:
cp -r ~/Downloads/update/* /Applications/Arduino.app/Contents/Java
For example, the update/hardware/WAV8F/platform.txt
needs to end up in /Applications/Arduino.app/Contents/Java/hardware/WAV8F/platform.txt
.
Now start the IDE again. You should see new boards under "Tools > Boards". Select "WAVGAT UNO R3".
As Port, select "/dev/cu.wchusbserial1410" or similar.
Now, you can load the blink demo and run "Upload". If all goes well, this should actually work and lead to a LED that blinks (on for one second, off for one second). In the IDE message window, you should see messages like "Done uploading", "avrdude: 1244 bytes of flash verified", and "avrdude done. Thank you."
4. Fix error messages and warnings
This step is optional, and only needed if you did not use the wavgate-ide-update.zip
config files. The current setup still creates a number of warnings when flashing a Sketch. Especially if you have turned on "Show verbose output during compilation / upload" and "Compiler warnings: all" in the IDE preferences. You can fix some of these by making the changes below.
In the files listed below, replace the line marked with -
by the line marked with +
:
To change a warning about missing bootloader files, change the path separator from \
to /
.
/Applications/Arduino.app/Contents/Java/hardware/WAV/avr/boards.txt
@@ -14,7 +14,7 @@
lardu_328p.bootloader.low_fuses=0xff
lardu_328p.bootloader.extended_fuses=0x07
lardu_328p.bootloader.path=lgt8fx8p
-lardu_328p.bootloader.file=lgt8fx8p\optiboot_lgt8f328p.hex
+lardu_328p.bootloader.file=lgt8fx8p/optiboot_lgt8f328p.hex
lardu_328p.bootloader.unlock_bits=0x3f
lardu_328p.bootloader.lock_bits=0x3f
lardu_328p.build.mcu=atmega328p
The following removes a few compiler warnings:
/Applications/Arduino.app/Contents/Java/hardware/WAV/avr/cores/lgt8f/HardwareSerial.cpp
@@ -89,7 +89,7 @@
inline void store_char(unsigned char c, ring_buffer *buffer)
{
- int i = (unsigned int)(buffer->head + 1) % SERIAL_BUFFER_SIZE;
+ unsigned int i = (unsigned int)(buffer->head + 1) % SERIAL_BUFFER_SIZE;
// if we should be storing the received character into the location
// just before the tail (meaning that the head would advance to the
@@ -365,7 +365,6 @@
void HardwareSerial::begin(unsigned long baud, byte config)
{
uint16_t baud_setting;
- uint8_t current_config;
bool use_u2x = true;
#if F_CPU == 16000000UL
@@ -459,7 +458,7 @@
size_t HardwareSerial::write(uint8_t c)
{
- int i = (_tx_buffer->head + 1) % SERIAL_BUFFER_SIZE;
+ unsigned int i = (_tx_buffer->head + 1) % SERIAL_BUFFER_SIZE;
// If the output buffer is full, there's nothing for it other than to
// wait for the interrupt handler to empty it a bit
/Applications/Arduino.app/Contents/Java/hardware/WAV/avr/cores/lgt8f/avr-libc/malloc.c
@@ -63,7 +63,7 @@
void *
malloc(size_t len)
{
- struct __freelist *fp1, *fp2, *sfp1, *sfp2;
+ struct __freelist *fp1 = NULL, *fp2 = NULL, *sfp1 = NULL, *sfp2 = NULL;
char *cp;
size_t s, avail;
This change removes warnings about "deprecated recipe.ar.pattern":
/Applications/Arduino.app/Contents/Java/hardware/WAV/avr/platform.txt
@@ -63,7 +63,7 @@
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
-recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
+recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
/Applications/Arduino.app/Contents/Java/hardware/WAV8F/platform.txt
@@ -63,7 +63,7 @@
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
-recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
+recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
5. Have fun and profit
I hope this helps
wavgate-ide-update.zip (950 KB)