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,

A.

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:

thanks

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: https://github.com/balenablocks/finabler

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'
volumes:
    fin:
services:
  finblock:
    restart: always
    image: balenablocks/finabler::latest
    network_mode: host
    privileged: true
    volumes:
      - 'fin:/data/firmware'
    labels:
      io.balena.features.supervisor-api: '1'
      io.balena.features.balena-api: '1'
    expose:
      - "1337"

What this will do is a number of things:

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

  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

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  
 finblock  Error: Flashing failed with message: Failed to open SERIAL_DEVICE: No such file or directory
 finblock  
 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.

A.