7 How to flash the Arduino
sanni edited this page 2024-08-19 17:50:23 +02:00

Using the Firmware Updater

Go to the website for the Firmware Updater and follow the prompts. You must be running a Chromium-based browser (Chrome, Edge, etc) on a desktop (or laptop) to use the Firmware Updater -- it does not work on mobile browsers or Firefox.

Before updating ensure all cartridges are removed from the OSCR. If you don't see your OSCR in the list you must install the driver first. There's a link to the driver installer on the updater page. Download and extract the installer then run it. Follow the instructions, restarting if needed. Your OSCR should show up then.

Currently, the Firmware Updater cannot be used to flash a new Arduino for the first time or to update very old OSCR firmware versions. Use the manual method described below for that.

Using the Arduino IDE

The Cart Reader's firmware is released as source code and needs to be compiled before flashing. This method allows you to easily modify the firmware and hopefully sparks your interest in contributing to this project. 🔧🔨😊
Both compiling and flashing can be done with the Arduino IDE. You can either use the Portable Release or the official Arduino IDE installer.

Portable Release:

Each Cart Reader release comes with a pre-configured and tested portable Arduino IDE tailored for that specific release which includes the Cart_Reader.ino sketch as well as all the needed Arduino libraries and SD database files and does not interfere with any previous Arduino installation.

To upload the firmware to the Cart Reader please follow these steps:

0) Plug your Open Source Cartridge Reader into a USB port of your PC. The 3V/5V switch needs to be set to 5V and the ON/OFF switch needs to be set to ON.

1) Download the latest V#.#_Portable.zip or .7z from the Releases tab and extract it.

rfeleasezip

2) Install CH341 drivers if needed by running SETUP.exe in the "CH341 Drivers" folder.
After the successful installation of the driver, there should be a CH340 entry in the device manager(WIN+R devmgmt.msc). This will also tell you what COM Port you need to select later on.

image

3) Launch "arduino.exe" found in the "Arduino IDE Portable" folder you just extracted(right-click "Run as administrator" might be necessary).

image

4) In the Arduino IDE go File -> Sketchbook -> Cart_Reader

image

5) Then Tools -> Board and set it to "Arduino Mega or Mega 2560".

image

6) Now Tools -> Port and select the COM port your Arduino is using.

image

7) Next you need to go to the config.h tab and define your hardware version by removing the // in front of your version.

config

You can tell which hardware version you got by comparing your OSCR with this image:

image

You can also remove // before #define ENABLE_XXX to enable add-on modules you need.

systemmodules

8) In case you do not have the Clock Generator installed you need to change the line "#define clockgen_installed" to "//#define clockgen_installed".

clockgen

You can tell if you have the clock generator installed by comparing your OSCR with this image:

image

9) Finally Sketch -> Upload

image

10) Also don't forget to update the SD database files like described here

Updating in-between portable releases:

The latest portable release will always be some commits behind the current development code in the master branch. If you want to use the latest fixes/features you can update the portable release by either launching the included UPDATE.bat (Windows 10/11 only) or by downloading and extracting the current master branch into the portable release overwriting the old files.

Copy the Cart_Reader folder from:

cartreader-master.zip\cartreader-master\

to:

VX.X_Portable\Arduino IDE\portable\sketchbook\

And then copy the files from:

cartreader-master.zip\cartreader-master\sd\

to your SD card like described here.

Official Arduino IDE Installer:

Alternatively you can download and install the Arduino IDE and then copy the "libraries" and "Cart_Reader" folder from the current release "VX.X_Portable\Arduino IDE\portable\sketchbook" to "C:\Users\your_username\Documents\Arduino" and launch the Arduino IDE from the start menu.
It should look like this when done:

C:\Users\your_username\Documents\Arduino\Cart_Reader    
C:\Users\your_username\Documents\Arduino\libraries   

If you want to use the latest fixes and features you can download and extract the current master branch and copy the Cart_Reader folder to:

C:\Users\your_username\Documents\Arduino\    

In both cases don't forget to also copy the files in the SD directory to your SD card like described here.