Flash firmware to USB Dongle

Is there a tutorail how to flash firmware to USB dongle and then how to pair USB dongle with remote units?

Hi,

Ad1)

it depends on your system: New, work in progress doc is on github:

https://github.com/bigclownlabs/bc-website/blob/master/content/doc/firmware/toolchain-setup.en.md
https://github.com/bigclownlabs/bc-website/blob/master/content/doc/tutorials/firmware-upload.en.md

Basically you will need dfu-utils, python3 and bcf. Then connect Dongle to USB.

Check connected devices:

$ bcf devices
/dev/ttyUSB0

Then


# update list
$ bcf update
update data for repo bigclownlabs/bcf-car-proximity-sensor
update data for repo bigclownlabs/bcf-color-kid-game
update data for repo bigclownlabs/bcf-generic-node
update data for repo bigclownlabs/bcf-usb-gateway
update data for repo bigclownlabs/bcf-usb-dongle
update data for repo bigclownlabs/bcf-kit-push-button
update data for repo bigclownlabs/bcf-room-air-quality-monitor
update data for repo bigclownlabs/bcf-kit-thermostat-lcd
save to  /home/marian/.cache/bcf/repos.json
# show available firmwares
$ bcf list
bigclownlabs/bcf-climate-station:firmware-142pixel.bin:v1.0.1
bigclownlabs/bcf-climate-station:firmware-144pixel.bin:v1.0.1
bigclownlabs/bcf-climate-station:firmware-72pixel.bin:v1.0.1
bigclownlabs/bcf-generic-node:bcf-generic-node-battery-mini-v1.5.6.bin:v1.5.6
bigclownlabs/bcf-generic-node:bcf-generic-node-battery-standard-v1.5.6.bin:v1.5.6
bigclownlabs/bcf-generic-node:bcf-generic-node-power-module-RGB-150-v1.5.6.bin:v1.5.6
bigclownlabs/bcf-generic-node:bcf-generic-node-power-module-RGB-300-v1.5.6.bin:v1.5.6
bigclownlabs/bcf-generic-node:bcf-generic-node-power-module-RGBW-144-v1.5.6.bin:v1.5.6
bigclownlabs/bcf-generic-node:bcf-generic-node-power-module-RGBW-72-v1.5.6.bin:v1.5.6
bigclownlabs/bcf-kit-push-button:bcf-kit-push-button-v0.1.0.bin:v0.1.0
bigclownlabs/bcf-lcd-thermostat:bcf-lcd-thermostat-v1.0.0.bin:v1.0.0
bigclownlabs/bcf-ping-pong-table:firmware.bin:v1.0.0
bigclownlabs/bcf-sigfox-button:bcf-sigfox-button-v1.0.0.bin:v1.0.0
bigclownlabs/bcf-sigfox-climate-monitor:firmware.bin:v1.0.1
bigclownlabs/bcf-sigfox-co2-monitor:firmware.bin:v1.0.0
bigclownlabs/bcf-sigfox-motion-detector:firmware.bin:v1.0.1
bigclownlabs/bcf-sigfox-pulse-counter:firmware.bin:v1.1.0
bigclownlabs/bcf-skeleton-core-module:firmware.bin:v1.0.0
bigclownlabs/bcf-usb-dongle:bcf-usb-dongle-v1.5.5.bin:v1.5.5
bigclownlabs/bcf-usb-gateway:firmware.bin:v1.5.0
# flash firmware into dongle
$ bcf flash bigclownlabs/bcf-usb-dongle:bcf-usb-dongle-v1.5.5.bin:v1.5.5
Erase  [####################] 100.0%
Write  [####################] 100.0%
Verify [####################] 100.0%

To flash firmware into remote you need to connect Core module via USB cable. Take a Core module, hold “B” button and plug USB cable. Then release “B” button and check connected devices:

$ bcf devices
dfu:71A69145605F
/dev/ttyUSB0

Then use almost the same command as above. Only add --dfu option and use different fw:

$ bcf flash --dfu bigclownlabs/bcf-kit-push-button:bcf-kit-push-button-v0.1.0.bin:v0.1.0
download firmware from https://github.com/bigclownlabs/bcf-kit-push-button/releases/download/v0.1.0/bcf-kit-push-button-v0.1.0.bin
save as /home/marian/.cache/bcf/388c7c89d5f2bc036a08c6b3e6a9d4442442954ffbfe9ed5d38d95410a09f241
Download [#######################] 100.0%
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
dfu-util: Non-valid multiplier 'g', interpreted as type identifier instead
Downloading to address = 0x08000000, size = 41480
Download        [=========================] 100%        41480 bytes
Download done.
File downloaded successfully
Transitioning to dfuMANIFEST state

You can also use another bigclownlabs/bcf-generic-node firmwares.

Ad 2)
I did it somehow, but probably wrongly. So I’m waiting for correct steps as well.

Update: I just tested this and it works:

  • After firmware flashing unplug dongle and remote units
  • Plug dongle again
  • Now you will need more terminals :wink:
  • First: Start mosquitto
$ mosquitto
1508777193: mosquitto version 1.4.14 (build date 2017-09-27 23:00:01+0200) starting
1508777193: Using default config.
1508777193: Opening ipv4 listen socket on port 1883.
1508777193: Opening ipv6 listen socket on port 1883.
  • Second: Start bch-usb-gateway (install or clone from github)
$ bch-usb-gateway/bc_gateway/gateway.py -W &
[1] 3787
2017-10-23 18:46:43,643 INFO: Connected to MQTT broker with code 0
2017-10-23 18:46:43,645 INFO: Opened serial port: /dev/ttyUSB0
  • Third: Subscribe to all mqtt messages
$ mosquitto_sub -v -t '#'
  • Fourth: Working - will use it to sent commands to dongle
  1. Look for dongle:
[Command - Terminal 4]:
$ mosquitto_pub -t 'gateway/all/info/get' -n

[Reply - Terminal 3]:
gateway/all/info/get (null)
gateway/dongle/info {"id": "836d19838d67", "firmware": "bcf-usb-dongle-v1.5.5"}

Note: The string between gateway/ and /info (‘dongle’) from reply you will need in step 3

  1. Power on Remote (via battery or USB cable) and press and hold “B” button until LED light on
  2. Sent command to start pairing:
[Command - Terminal 4]:
$ mosquitto_pub -t 'gateway/dongle/enrollment/start' -n

[Reply - Terminal 3]:
gateway/dongle/enrollment/start (null)
gateway/dongle/attach "836d19820e43"
node/push-button/info {"firmware": "bcf-generic-node-power-module-RGB-150-v1.5.6"}
node/push-button/thermometer/0:1/temperature 24.88

Note: Remote will immediately sent data - last row.

  1. Done
1 Like