Back to Smartcitizen.me

Update firmware to use MQTT broker

Hi,

I suppose to update the firmware (in general) but in my case to change the MQTT server address (to my own server) I have to follow this https://github.com/fablabbcn/smartcitizen-kit-20/blob/master/building.md guide and need an ATATMEL-ICE - DEBUGGER? If so, is the ATATMEL-ICE-BASIC sufficient?

Thanks.
Guy

Hi @guy.dillen,

You will find more information changing the MQTT end-point on the post below:

Also, keep in mind your SCK 2.1 firmware is currently (it will be split later) on the 2.1 branch

And, you don’t need at all an ATMEL ICE. You can upload the firmware using just a micro USB cable. The following guide covers the process. However, some steps might be outdated, so I’ll ask my colleague @victor to update the guide on the next coming days

https://docs.smartcitizen.me/Components/Firmware/guides/Edit%20the%20Firmware/

Hi,

I can connect to your MQTT broker, mqtt.smartcitizen.me. However, subscribing doesn’t give any messages in return. Do I need a token as part of the topic, or can I just subscribe to a topic, and if yes, which one?

Thanks.

Hi,

I can (manual) build the firmware (ignoring warnings during build):

Linking .pio/build/sck2/firmware.elf
Checking size .pio/build/sck2/firmware.elf
Building .pio/build/sck2/firmware.bin
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [====== ] 63.5% (used 20804 bytes from 32768 bytes)
PROGRAM: [======= ] 65.7% (used 172316 bytes from 262144 bytes)
==================================================================== [SUCCESS] Took 58.43 seconds ====================================================================

However, with the following REMARKS/UPDATES FOR BOTH smartcitizen-kit-20 AND smartcitizen-kit-21

./build.sh sam -> isn’t available in the root folder (meaning I used the Manual install)

When running the manual install:

$ cd sam
$ platformio run

  • I need to update a print statement to Python 3.x in uploadSAM.py -> I have both Python 2 and 3 installed on my Mac!
  • I only succeed getting a fimware file the second time I execute 'platformio run; the first time I get an error:

collect2: error: ld returned 1 exit status
**** [.pio/build/sck2/firmware.elf] Error 1*
===================================================================== [FAILED] Took 57.93 seconds =====================================================================

  • Executed $ tools/uf2conv.py -o SAM_firmware.uf2 sam/.pio/build/sck2/firmware.bin instead of (as in the docs) $ tools/uf2conv.py -o SAM_firmware.uf2 sam/.pioenvs/sck2/firmware.bin (folder .pioenvs isn’t available)

For security reasons broker is limited to specific topics used by SCK:

You can see them on the firmware, too:

If you want a broker to play with it to add and subscribe to new topics, you can either deploy an instance of our platform or run any free broker like mosquitto or emqtt.

About your last post:

  1. The firmware compiles perfectly on Linux. As you can see we check automatically it compiles for every commit that goes to master

https://travis-ci.org/fablabbcn/smartcitizen-kit-21

You can see what we do

  1. I just compiled from the ground both firmwares manually on my mac with pio run and it worked perfect using Python 2.7

:warning: Ensure your Platformio is also running on Python 2.7 by reinstalling it like pip install -U platformio while ensuring your default python is 2.7 python --version

  1. We refactored all the automated toolchain lately to make.py but we still have to work to update the documentation. I hope next week we have it ready!

Conclusion, the firmware compiles perfectly on mac using pyhton 2.7 manually but we still need to do some checks for the new automated version make.py and update the documentation. I hope next week we have it ready!

Thanks for the info.

It builds, of course successfully, as I also mentioned. I only would give some feedback of the build process as I experienced.

One remark: I installed platformio using brew.

Best
Guy

1 Like

Great,

We’ll post here a link to the updated documentation soon!