FEATHER M0 BLUEFRUIT GPIO APP FREEZES

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
stevenpk
 
Posts: 1
Joined: Tue Oct 19, 2021 10:26 am

FEATHER M0 BLUEFRUIT GPIO APP FREEZES

Post by stevenpk »

I have been trying my hand at using the Bluefruit LE Connect app (Android version) to trigger Feather M0 Bluefruit GPIO via the BluefruitLE_nrf51822 example (far beyond my present skill level, just trying to understand how it works..). The entire set-up was flawless, AT commands and UART work fine, and the BluefruitLE_nrf51822 example appears to function with pins in analog and PWM mode, but as soon as a pin in digital mode is switched to HIGH on the application ("Write digital port #... line in Serial Monitor screenshot), the board seems to freeze/disconnect. App commands no longer produce any change (i.e. digital pin switched to HIGH cannot be turned off, but other pins can't be triggered), attempt to exit and reenter app Pin I/O menu fails (no response to query, reverts to Uno default), no new commands appear on Serial Monitor, only solution is to flash code again.

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
Screen Shot 2021-10-19 at 10.48.59 AM.png
Screen Shot 2021-10-19 at 10.48.59 AM.png (81.25 KiB) Viewed 103 times
Screen Shot 2021-10-19 at 10.49.08 AM.png
Screen Shot 2021-10-19 at 10.49.08 AM.png (101.38 KiB) Viewed 103 times
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);
  }
}

User avatar
mikeysklar
 
Posts: 13946
Joined: Mon Aug 01, 2016 8:10 pm

Re: FEATHER M0 BLUEFRUIT GPIO APP FREEZES

Post by mikeysklar »

Does make any difference what pin you set high?

I'm not sure it will help, but there is an update for the bluefruit module.

https://github.com/adafruit/Adafruit_Bl ... espifriend

Some instructions here for an update:

https://learn.adafruit.com/introducing- ... nd/history

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”