Four binary files are used for testing and flashing the Smart Citizen Kit:
The SAMD21 testing firmware is provided to you via email. It's customised with the Wi-Fi credentials of your facilities. The rest of the files can be build from the code on our Github repository.
For the initial prototype, all files will be provided via email. Once SCK2.2 production is ready, a binary file will be available in the releases page in the Github repository. This repository will be shared with you via email.
There are two main possibilities to do this process:
Common needs:
Depending on your toolset, choose one of the following:
A) Tools needed for python toolset:
B) Tools needed for Atmel-Studio toolset:
If you are using Atmel-Studio to upload the bootloader or flash the firmware, you don't need to do the next step and we can provide you with the necessary binary files.
All the tools needed to flash the Smart Citizen Kit firmware are in our github repository. You can clone it by:
Or you can download manually going to this link (https://github.com/fablabbcn/smartcitizen-kit-21):
If you follow this method and download the ZIP file, you will also need to:
smartcitizen-kit-21/bootloader/
folderuf2-samdx1
It should look like this: smartcitizen-kit-21/bootloader/uf2-samdx1/
This step is necessary for both toolset options
In the firmware folder you downloaded, do:
Depending on your platform, it may be that you need to type:
This step is necessary for both toolset options. Flashing the bootloader can be done with OpenOCD (https://openocd.org) or with Atmel-Studio, depending on your preferences.
You need an Atmel-ICE programmer connected to the SWD connector of the Smart Citizen Data Board. You will also need to provide power via the USB connector.
Option A: With Python Scripts
In the firmware folder, run:
Or:
Or:
All the commands above are equivalent. It only changes depending on your OS setup.
If no errors pop up, the LED on the Smart Citizen Kit should turn green. You are ready for the next step.
Option B: With Atmel-Studio
For this, you will use the file bootloeader-sck2.2.bin
provided with the test firmware.
We do not provide specific instructions for flashing the bootloader with Atmel Studio. Please follow the application instructions.
If no errors pop up, the LED on the Smart Citizen Kit should turn green. You are ready for the next step.
For this step, you have received a testing firmware with hardcoded Wi-Fi credentials called: SAM_firmware_test
SCK-21
should appear on your computerSCK-21
drive. The LED should blink in green and, after some seconds, the device will reset and start the testing firmwareBefore proceeding with the Test process, you need to upload the ESP firmware in the next step.
For running this script, you need to have python 3 installed in your computer.
Go to the folder where you downloaded the Smart Citizen Kit firmware:
Get the firmware:
OPTION A:
If you are compiling the firmware:
Only the first time, build the ESP firmware (only once):
OPTION B:
If you are not compiling the ESP firmware, and you are using the one provided via email, or from the firmware repository releases page, proceed as follows:
smartcitizen-kit-21/bin/ESP_firmware.bin
Flash the firmware
To upload the firmware to the microcontroller, connect the SCK to the computer via USB and run:
Or:
Or:
If everything went OK, you are ready to start the test procedure on the SCK boards.
For the test you will need:
In case of problems, you can open a serial terminal while the SCK is running the test to see what's failing (WARNING: this image does not show the full test):
We have detected that Flash Memory test fails sometimes. Repeating the test normally fixes the issue.
If the test succeeded, you need to upload the SAMD21 production firmware. To do so, follow the next steps:
Go to the folder where you downloaded the Smart Citizen Kit firmware:
Get the firmware:
OPTION A:
If you are compiling the firmware:
Only the first time, build the SAMD21 firmware (only once):
OPTION B:
If you are not compiling the SAM firmware, and you are using the one provided via email, or from the firmware repository releases page, proceed as follows:
smartcitizen-kit-21/bin/SAM_firmware.uf2
Upload the SAM firmware:
OPTION A:
If you want to use the command line:
βββββββ ```
βββββββ python make.py flash sam -v
βββββββ ```
OPTION B:
If not:
SCK-21
should appear on your computer:
SCK-21
drive. The LED should blink in green and, after some seconds, the device will reset and start the testing firmware
Done!