Macchina Docs
  • Macchina.cc
  • Introduction
    • Disclaimer
  • Product Documentation
    • M2 Docs
      • Getting Started
      • Arduino IDE Quick Start
      • M2 Code libraries
        • CAN bus
        • Single-wire CAN
        • LIN
      • Next Steps with M2
      • Detailed Reference
        • Installation
        • Processor
        • Pin Mapping
        • Automotive Interfaces
        • Communication
          • M2 Bee-Compatible Add-ons
          • Cellular
        • Power
        • Storage/Memory
        • 12V IO
        • LEDS/Buttons
        • Enclosures
        • Breakout Board
        • Schematics and Source
      • Versions of M2
    • A0 Docs
      • Quick Start Guide
      • Firmware Reference
      • Hardware Reference
      • Projects
      • Troubleshooting
    • SuperB Docs
      • Getting Started
      • Hardware
      • Sending AT Commands
    • P1 Docs
      • Getting Started
      • Pin Mapping
      • Interfaces
      • Power Supply Note
    • OBD3way Docs
  • Projects
    • A0 Projects
      • A0 CAN Vehicle Data
      • A0 CAN Point to Point
      • A0 CAN Read VIN
      • Work-in-Progress A0 projects
    • M2 Projects
      • "OK Google, start my car!"
      • M2 and SavvyCAN, the Basics
      • Help Collect Voltage Data
      • Mini-Project Tutorials
        • M2 CAN Loopback
        • M2 CAN Point to Point
        • M2 SWCAN Point to Point
        • M2 VIN Extraction
    • P1 Projects
      • P1 CAN Vehicle Data
      • P1 CAN Loopback
    • Community Projects
    • Project Support
    • Other Resources
  • Support /contact us
    • Contact US / FAQ
    • Common Issues
    • Out of Stock/ Status
Powered by GitBook
On this page
  • Overview
  • Step 1 - Hardware Prep
  • Step 2 - Software

Was this helpful?

Export as PDF
  1. Product Documentation
  2. SuperB Docs

Getting Started

How to flash your SuperB using either a USB adapter board or an M2

PreviousSuperB DocsNextHardware

Last updated 5 years ago

Was this helpful?

Overview

SuperB can be flashed using an XBee USB adapter board or using M2. As of right now only the USB adapter board supports flashing through the ESP desktop tool; flashing through M2 can only be done through the Arduino IDE.

Step 1 - Hardware Prep

For the instructions that follow, the SuperB is connected to the computer with an XBee USB Adapter board (with one modification), available here.

Before the board can be used with the SuperB, VREF and DIO11 need to be bridged on the rear of the board as shown below.

At this point the board can be connected to the computer via USB with the RESET and BOOT buttons controlling EN and IO0, respectively.

  • 1) Plug SuperB into M2 with the antenna trace/U.FL connector towards the USB port and then plug M2 into computer. (Note the button nomenclature and board orientation)

  • 2) Select "Macchina M2" as board type and upload the sketch below:

int buttonState1 = 0;
int buttonState2 = 0;


 void setup() {
 pinMode(DS2, OUTPUT);
 pinMode(DS3, OUTPUT);
 pinMode(XBEE_RST, OUTPUT);
 pinMode(XBEE_MULT4, OUTPUT);
 pinMode(Button1, INPUT);
 pinMode(Button2, INPUT);
 SerialUSB.begin(115200);
 Serial.begin(115200);
 }

 char rx_byte = 0;

 void loop() {
 if (SerialUSB.available() > 0) {
     rx_byte = SerialUSB.read();
     Serial.write(rx_byte);
 }
 if (Serial.available() > 0) {
     rx_byte = Serial.read();
     SerialUSB.write(rx_byte);
 }

 buttonState1 = digitalRead(Button1);

 if (buttonState1 == LOW) {
     digitalWrite(DS2, LOW);
     digitalWrite(XBEE_RST, LOW);
 } else {
     digitalWrite(DS2, HIGH);
     digitalWrite(XBEE_RST, HIGH);
 }

 buttonState2 = digitalRead(Button2);

 if (buttonState2 == LOW) {
     digitalWrite(DS3, LOW);
     digitalWrite(XBEE_MULT4, LOW);
 } else {
     digitalWrite(DS3, HIGH);
     digitalWrite(XBEE_MULT4, HIGH);
 }
 }

Step 2 - Software

  • 1) Follow the instructions here to set up the board manager for ESP32.

  • 2) Connect the SuperB with the USB adapter board and select the correct port.

  • 3) Place the SuperB into bootloader mode by holding down the BOOT button, pressing and releasing the RESET button, and then releasing the BOOT button.

  • 4) Select "ESP32 Dev Module" as board type.

  • 5) Upload a sketch. An easy sketch to adapt is the "Blink" sketch found in File>Examples>Basics>Blink.

  • 6) Change the three instances of "LED_BUILTIN" to "26":

     void setup() {
     // initialize digital pin LED_BUILTIN as an output.
     pinMode(26, OUTPUT);
     }
    
     // the loop function runs over and over again forever
     void loop() {
     digitalWrite(26, HIGH);   // turn the LED on (HIGH is the voltage level)
     delay(1000);                       // wait for a second
     digitalWrite(26, LOW);    // turn the LED off by making the voltage LOW
     delay(1000);                       // wait for a second
     }
  • 7) Upload the sketch and reset the SuperB with the RESET button.

The ESP tool "Flash Download Tools (ESP8266 & ESP32)" can be downloaded here. The binary files used can be downloaded here. (Right click>Save link as)

  • 1) Open the tool and select "ESP32 DownloadTool".

  • 2) Enter the binary files and their addresses, and configure the remaining settings as shown below, selecting the corresponding COM port.

  • 3) Place the SuperB into bootloader mode by holding down the BOOT button, pressing and releasing the RESET button, and then releasing the BOOT button.

  • 4) Press start to begin flashing. (~10sec)

  • 5) An easy way to test the SuperB's functionality after flashing is to send it AT commands.

  • 1) Follow the instructions here to set up the board manager for ESP32.

  • 2) Modify the file "platform.txt" found at: (Windows) C:\Users\YourUsername\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\platform.txt (MacOS) /Users/you/Library/Arduino15/packages/esp32/hardware/esp32/1.0.3/platform.txt

Replace "default_reset" with "no_reset" once on line 100 and once on line 101.

  • 3) Replace the file "boards.txt" found at:

    (Windows) C:\Users\YourUsername\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\boards.txt (MacOS) /Users/you/Library/Arduino15/packages/esp32/hardware/esp32/1.0.3/boards.txt

Replace the existing "boards.txt" file with the one available here.****

  • 4) Restart the IDE.

  • 5) Open the serial monitor. Place the SuperB into bootloader mode by holding down the BOOT (SW2) button, pressing and releasing the RESET (SW1) button, and then releasing the BOOT (SW2) button. The serial monitor output should look like the one below:

  • 6) Select "SuperB on M2" as board type:

  • 7) A good example sketch can be found in File>Examples>Examples for SuperB on M2>WiFi>WiFiScan. Upload it.

  • 8) Close and reopen the serial monitor with "Macchina M2" as the board type. Press RESET (SW1) to begin scanning for access points:

Image showing tool selection screen, "ESP32 DownloadTool" is selected
Image showing settings for the ESP tool