I have tried editing to use HW and SW SPI, used two different computers and smartphones, tweaking the code where I thought the issue might be, but no luck. I have been trying to debug using Serial.print messages, but remain unsure whether the problem is between the application and the Feather (disconnecting) or with the Feather/program itself (getting stuck/freezing).
I am not asking for an effortful code-based solution, as this would be a lot of work (though if there is a quick fix i'm missing, pray tell!), but rather if anyone has had this specific problem before, has an impression of where the issue could stem from and/or could point me in the right direction for the solution (code, board, app..).
Thank you in advance for any clarity you could bring!
Serial Monitor screenshots snippet where the error occurs, nothing else change in the BluefruitLE_nrf51822 example from the Adafruit BLEFirmata library
Code: Select all
void digitalWriteCallback(byte port, int value)
{
FIRMATADEBUG.print("DWCx"); FIRMATADEBUG.print(port, HEX); FIRMATADEBUG.print(" "); FIRMATADEBUG.println(value);
byte pin, lastPin, mask=1, pinWriteMask=0;
if (port < TOTAL_PORTS) {
// create a mask of the pins on this port that are writable.
lastPin = port*8+8;
if (lastPin > TOTAL_PINS) lastPin = TOTAL_PINS;
for (pin=port*8; pin < lastPin; pin++) {
// do not disturb non-digital pins (eg, Rx & Tx)
if (BLE_Firmata.IS_PIN_DIGITAL(pin)) {
// only write to OUTPUT
// do not touch pins in PWM, ANALOG, SERVO or other modes
if (pinConfig[pin] == OUTPUT) {
pinWriteMask |= mask;
pinState[pin] = ((byte)value & mask) ? 1 : 0;
}
}
mask = mask << 1;
}
FIRMATADEBUG.print(F("Write digital port #")); FIRMATADEBUG.print(port);
FIRMATADEBUG.print(F(" = 0x")); FIRMATADEBUG.print(value, HEX);
FIRMATADEBUG.print(F(" mask = 0x")); FIRMATADEBUG.println(pinWriteMask, HEX);
BLE_Firmata.writePort(port, (byte)value, pinWriteMask);
}
}