Architecture for Use of Co-Processor

Good Afternoon All,

I intend to use the co-processor to read ADC values.

I see the Firmata flasher application on Github, exposes a simple HTTP API for flashing and setting pins. Very nice.

A few questions:

  1. Should I just have the co-processor running as a parallel application, keeping the flash up to date and providing the middleware to the co-processor?
  2. It’s hard to use it as a Git submodule due to the directory structure, maybe I will open an issue and discuss that directly. Am I expected to fork and modify the code to expose more hardware via the API?
  3. What would be the smart approach to interfacing with the co-processor, if you ignore everything else that I’ve said? (The rest of my applications are written in Python, BTW.)

Thanks for your input,


Hi Adam,

My colleagues were recently working on a project to facilitate getting up and running with the fin coprocessor via the firmata protocol. I have pinged them and they will be able to provide more concrete answers. :slight_smile:


1 Like

Hi Adam,

Great to hear that you’re using the Fin and it’s coprocessor. As Rahul said we’ve been doing some work in this area, specifically to make it easier for people to use in their applications. It’s still early in the development phase, but it would be great if you could try it out and add issues/requests/PRs to the github repo:

This is a balena block, which means we build it as a docker image that can bring in via your docker-compose.yml file:

version: '2.1'
    restart: always
    image: balenablocks/finabler::latest
    network_mode: host
    privileged: true
      - 'fin:/data/firmware'
      io.balena.features.supervisor-api: '1'
      io.balena.features.balena-api: '1'
      - "1337"

What this will do is a number of things:

  1. Add a series of tags to the device view of your Fin:

  2. The ability to set an environment variable to a specific firmata version from our releases page and the block will handle flashing it for you. OR…

  3. Set the variable to latest and the block will flash the latest version

  4. All device configuration settings are auto-set

  5. A REST API for interacting with the coprocessor.

Currently 5. is limited to a ping endpoint, to programmatically know when the coprocessor is ready for instructions, and a sleep endpoint. These are super useful, but we want to add more. Reading ADC values is high on our list, but adding your userland voice to the GH repo will help us to prioritise.
The API is exposed on port 1337. Have a play and see what you can do.

If you need any more help , let me know.

Phil, that is exactly what I was looking for, you rock.

I will fork and submit PRs if I get far enough along to want to try reading the inputs. Do you suggest that I just add it as a git submodule and specify build instead of image, so I can play with the node code in index.js?

Should I be setting SERIAL_DEVICE to something specific?

 finblock  Cannot query firmware
 finblock  Start automatic flashing: installing firmata v2.0.1
 finblock  flash stderr: Failed to open SERIAL_DEVICE: No such file or directory
 finblock  Error: Flashing failed with message: Failed to open SERIAL_DEVICE: No such file or directory
 finblock      at Socket.<anonymous> (/usr/src/app/flasher.js:39:22)
 finblock      at Socket.emit (events.js:315:20)
 finblock      at addChunk (_stream_readable.js:295:12)
 finblock      at readableAddChunk (_stream_readable.js:271:9)
 finblock      at Socket.Readable.push (_stream_readable.js:212:10)
 finblock      at Pipe.onStreamRead (internal/stream_base_commons.js:186:23)
 finblock  flash failed! device will not reboot.

Assuming that it’s looking for /dev/ttyS0:

root@tcore:/usr/src/app# stat /dev/ttyS0
stat: cannot stat '/dev/ttyS0': No such file or directory

(That’s logged into the host OS.)

I note the readme says:

  • Automatically applies device tree overlays required for the coprocessorI see that the image

But I don’t see anything about enabling the serial UART, is there a step I missed?

Maybe I need to get the OS upgraded, as discussed:

Before continuing on this. Might be able to get there tonight.


This is great!

I sorted out the Balena OS issue and the finabler launched and flashed as expected. Very cool!

I tested /ping (via a simple GET request) and it just hangs, nothing happens. /firmware works, and so does /sleep, which is just fantastic. Thank you very much for the suggestion Phil, and your work on this project.


1 Like

Hey Adam thanks for giving this a try. Looking forward to your further feedbacks and contributions.

As for the GET /ping endpoint, it is not fully implemented. You can see the related issue here



I sorted out the Balena OS issue and the finabler launched and flashed as expected. Very cool!

Did you have to make any changes for the finabler block to work?

Hi Adam,

I’m glad you got this sorted. I think the crux of your issue getting the block to run, was in getting your Fin re-flashed and configured properly as a Fin. The overlays (and therefore UART enablement) will be predicated on this being correct.

With regards to the /ping endpoint, I’ve just spotted and fixed the bug and pushed a new image to docker. If you push this to your device, the ping endpoint will return if the device is ready. There is more to do on this endpoint, since we want to make sure it covers all of the cases where the block is running, but busy (e.g. flashing, about to sleep). For now it simply tells you that the block is up and running.

I’m excited to see what you’re doing with it!


1 Like

The only thing different than the documentation was the image parameter in docker-compose.yaml. The README shows image: balenablocks/finabler::latest but that caused an error, so I changed it to image: balenablocks/finabler which worked as expected.


Oh yes, that looks like a typo

It should be image: balenablocks/finabler:latest

Goes to show that I need to read the Docker docs, eh? Thanks!

I can confirm that /ping works now.

I’m working on a data logging and analysis system for vehicle systems on boats and RVs, using myself as the customer for now. :slight_smile:


Oh snap! Me too. We should compare notes. :wink:

(readme typo fixed)

1 Like