I’m at a point where I have flashed the pre-build firmata firmware from https://github.com/balena-io-playground/balena-fin-firmata-flash to the co-processor, but are having problems communicating with it. When sending a firmware version request over serial, it only sometimes answer.
I have therefore tried to dig deeper into what’s going on. I therefore managed to compile the firmware myself, from the source: GitHub - balena-io-hardware/fin-coprocessorFirmata-sw: firmata firmware for the BGM111 co-processor on the balenaFin
And flashed it on to the co-processor but the same error was present (it didn’t always respond). I therefore commented out almost everything in the main StandardFirmata.cpp so it just echoed whatever it received (with an extra byte, 25, added in front, so I could see if that at least came through correct):
int main(void)
{
balenaInit();Serial.begin(57600); while(1) { while(Serial.available() > 0) { int inputData = Serial.read(); if (inputData != -1) { Serial.write((byte)25); Serial.write((byte)inputData); } } }
}
After flashing this on to the co-processor, it replied all the time. Sometimes with the correct echoed bytes (with the byte: 25 in front) and most of the times with rubish bytes. If I for example send over
194
it sometimes returned as expected:
25 194
but most of the times altered bytes like:
9 250
240 25
etc.
I therefore tried to alter the code, so it only sent byte 65 (character ‘A’) every 1 second, and didn’t have to read from the serial port. After flashing, I opened putty, connected to the serial line, and saw the same behavior. The character ‘A’ was sometimes coming through, but mostly rubish bytes.
Has anyone else experienced the same sort of behavior? I’m initializing the serial port on the PI to communicate with the co-processor using following settings:
Baud rate: 57600
Data bits: 8
Stop bit: 1
Parity: None
Handshake: None
DTR/RTS: Disabled