Skip to content

Flashing and Development

Chris Whiteford edited this page Feb 21, 2021 · 5 revisions

CANserver Software flashing, programming, and configuration

Updating Software

CANserver software can be updated automatically, uploaded to the Server's web page, or flashed via USB.

Automatic Update

When connected to the CANserver via browser from a device that also has internet access you can click the Check for Updates button on the main Status page. Your browser will then check to see if there is a new version is available and download and install if necessary. The CANserver doesn't require any external connection its self. All checking is done through the browser being used.

An example would be if you connected to the CANserver's internal network with your phone, but still had a cellular data connection active. CANserver's update system would use your phone's data connection to search for an available update.

Manual Web Update

You can manually upload firmware files to the CANserver "Over The Air" with OTA files from its main Status page. Click Select File, choose the file, and upload. CANserver will check the file, update, and restart. The OTA firmware bin files are available (LINK).

  • CANServer-OTA.zip - This file is a connivence file that contains both the firmware and WebUI. Generally when updating to a new version manually this is the file you want to use.
  • CANServer-OTA-WebUI.bin - This file contains the web interface data. Upload this first.
  • CANServer-OTA-Firmware.bin - This file contains the firmware Upload this second.
  • CANServer-OTA-Data.bin - This file contains settings. You don't need to update this file unless you want to restore defaults. You can also download a copy of your settings into this file from your CANserver.

USB Flash Update

Install (TBD) Connect CANserver via USB to your computer. Download binary files:

  • CANServer-USB-Factory.bin - All data, firmware and WebUI for CANsever, will erase all and restore factory data.
  • CANServer-USB-Update.bin - Just updated firmware and WebUI, settings and data will be retained.

Flashing via the NodeMCU PyFlasher

Options to select:

  • Serial port: Serial port for the CANserver (this will vary depending on your OS)
  • NodeMCU firmware: path/to/CANServer-USB-Factory.bin or path/to/CANServer-USB-Update.bin
  • Baud rate: 921600
  • Flash mode: Dual I/O (dio)
  • Erase flash: no (the Factory file will erase everything when installed, the Update file will only update the firmware and webui)

Flashing from the command line

Command line: esptool.py -p <canserver_serial_port> -b 921600 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x0 <path/to/CANServer-USB-Factory.bin or path/to/CANServer-USB-Update.bin>

Arduino

The CANserver hardware can be reprogrammed with Arduino with your own software. A simple example Arduino project is provided here.

Download and install the Arduino desktop app from https://www.arduino.cc

The board uses the standard Node32S ESP32 Arduino board.

In Arduino Preferences, add the following to your Board Manager URLs:

https://dl.espressif.com/dl/package_esp32_index.json

Then under Board Manager, install esp32 by Espressif Systems

Under Boards, select Node32S

You may need to install the Silabs USB drivers

Flashing firmware

If you are just flashing the complete firmware over USB, the above setup is enough and we can continue through the terminal/command prompt.

  1. Download the initialflash.bin file from the latest release.
  2. Open Arduino and plug the ESP32 on the CANserver into USB.
  3. Make note of the name of the USB interface to be used below. It is likely /dev/cu.SLAB_USBtoUART
  4. Exit Arduino and open a Terminal/Command Prompt to the location of your installflash.bin
  5. Execute the esptool installed in the Arduino packages directory to upload the bin file. Replace with appropriate esptool version and path, username, and USB port. ! This will erase previous code and settings !

/Users/yourname/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool --chip esp32 --port "/dev/cu.SLAB_USBtoUART" --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x0 initialflash.bin

  1. When you see Connecting... hold down the IO0 button to the right of the USB for a second to start flashing
  2. When complete the server should reboot and the blue light should flash slowly

Libraries

The Arduino sketch requires several libraries to compile. Download the zip and install these libraries:

Arduino Programming

When uploading your program via the USB port, once you see Connecting... you must hold down the IO0 boot button (to the right of the right of the USB cable) for ~2sec in order to start downloading.

Uploading