/
Arduino Setup for Firmware Editing

Arduino Setup for Firmware Editing

Word document can be downloaded here.

Setting Up Arduino to Edit Gateway/Node Firmware

There are a few steps to take before you can successfully edit and upload firmware edits to the gateways and nodes using the Arduino IDE.

1. Download and Install Arduino IDE

The latest version of the Arduino IDE is available at https://www.arduino.cc/en/software.

2. Add the Moteino core.

Open the Arduino IDE and under File click Preferences. Copy and paste the following url into the Additional Boards Manager URLs box:

https://lowpowerlab.github.io/MoteinoCore/package_LowPowerLab_index.json

Click OK to close the dialog window.

Next, under Tools > Board: > click Boards Manager... and type “Moteino” into the search bar at the top of the window.

Click Install under Moteino AVR Boards (not shown above because package is already installed). Once the package is installed, you should see Moteino AVR Boards listed in the Board: list.

Close Arduino.

3. Add custom MoteinoMEGA-USB @ 8 MHz (3.3 volts) Board

Download boards.local.txt from the NodeGateway repository or copy and paste the following into a text file and save it as boards.local.txt:

MoteinoMEGA.name=MoteinoMEGA-USB @ 8MHz (3.3 volts)

MoteinoMEGA.upload.tool=avrdude

MoteinoMEGA.upload.maximum_size=130048

MoteinoMEGA.upload.maximum_data_size=16384

MoteinoMEGA.upload.speed=57600

MoteinoMEGA.upload.protocol=arduino

MoteinoMEGA.bootloader.low_fuses=0x7F

MoteinoMEGA.bootloader.high_fuses=0x14

MoteinoMEGA.bootloader.extended_fuses=0xFD

MoteinoMEGA.bootloader.unlock_bits=0x3F

MoteinoMEGA.bootloader.lock_bits=0xFF

MoteinoMEGA.bootloader.path=MoteinoMEGA

MoteinoMEGA.bootloader.file=DualOptiboot_V5.0_atmega1284p_BlinkD15_SPIdisable.hex

MoteinoMEGA.build.mcu=atmega1284p

MoteinoMEGA.build.f_cpu=8000000L

MoteinoMEGA.build.core=arduino:arduino

MoteinoMEGA.build.board=AVR_ATmega1284

MoteinoMEGA.build.variant=MoteinoMEGA

 

Navigate to

C:\Users\Your Username\AppData\Local\Arduino15\packages\Moteino\hardware\avr\1.6.1

and move or save the file there. Note that your version number (1.6.1) may be different from what is above.

Open Arduino and confirm that “MoteinoMEGA-USB @ 8 MHz (3.3 volts)” in the Boards list.

4. Increase Serial Buffer Size

Find HardwareSerial.h. It should be in a path like:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h

Open the file with Notepad and change the following:

#define SERIAL_TX_BUFFER_SIZE 64 to #define SERIAL_TX_BUFFER_SIZE 256

#define SERIAL_RX_BUFFER_SIZE 64 to #define SERIAL_RX_BUFFER_SIZE 256

If you are unable to edit the document initially, you’ll need to give yourself permission to edit the file. Right click on the filename, go to Properties > Security > Edit… and give Users “Full control” of the file. You may need Administrator privileges to make this change.

5. Add the correct versions of the libraries.

Libraries pulled from other repositories may have been updated and could cause the firmware sketches to break. Some libraries are included as files within the sketches and show up as tabs when you open the .ino file. You don’t need to worry about those.

They are also included in the folder containing the .ino file.

GitHub view:

GitHub Desktop view:

Libraries that are not included in this folder need to be added to the Arduino IDE. The versions used by the firmware can be found in the “libraries” folders:

GitHub view:

GitHub Desktop view:

 

You should now be able to edit, compile, and upload firmware edits to the nodes and gateways.

Related content

Helpful External Links
Helpful External Links
More like this
Notes From Alondra + Mikah Meeting
Notes From Alondra + Mikah Meeting
More like this
Control Flow Diagrams
Control Flow Diagrams
More like this
NodeGateway Repository File Structure
NodeGateway Repository File Structure
More like this
Upgrading to LPWA Radio
Upgrading to LPWA Radio
More like this
Notes on 3G Gateway
Notes on 3G Gateway
More like this