0

Control UNO with Feather nRF52 Bluefruit?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Tue Jul 27, 2021 7:12 pm

Looking to use the nRF52 Bluefruit to control the PWM input to an UNO input (to be read by another program which has an UNO firmata on it to read it).
Have the controller working ok per this: https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/ble-uart-controller
Like the example that has the nRF52 dimming the LEDhttps://learn.adafruit.com/bluefruit-le-connect/pin-i-o, would like to do that + put the valiues into an UNO to be read.

Trying to follow this guide: https://learn.adafruit.com/bluefruit-le-connect/library-and-config but am confused on the changes and uncomments needed for the nRF52 I have:
Code: Select all | TOGGLE FULL SIZE
/************************  CONFIGURATION SECTION ***********************************/
/*
Don't forget to also change the BluefruitConfig.h for the SPI or UART connection
and pinout you are using!

Then below, you can edit the list of pins that are available. Remove any pins
that are used for accessories or for talking to the BLE module!
*/

/************** For Bluefruit Micro or Feather 32u4 Bluefruit ************/
uint8_t boards_digitaliopins[] = {0,1,2,3,5,6,9,10,11,12,13,A0,A1,A2,A3,A4,A5};

/************** For UNO + nRF58122 SPI & shield ************/
//uint8_t boards_digitaliopins[] = {2, 3, 5, 6, 9, 10, A0, A1, A2, A3, A4, A5};

/************** For Bluefruit M0 Bluefruit ************/
//uint8_t boards_digitaliopins[] = {0,1,5,6,9,10,11,12,13,20,21,A0,A1,A2,A3,A4,A5};


and in the configh.h file:

DO i need to chanmge to transmit/control an UNO?

Code: Select all | TOGGLE FULL SIZE
// SOFTWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins that will be used for 'SW' serial.
// You should use this option if you are connecting the UART Friend to an UNO
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SWUART_RXD_PIN       9    // Required for software serial!
#define BLUEFRUIT_SWUART_TXD_PIN       10   // Required for software serial!
#define BLUEFRUIT_UART_CTS_PIN         11   // Required for software serial!
#define BLUEFRUIT_UART_RTS_PIN         -1   // Optional, set to -1 if unused

scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Re: Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Thu Jul 29, 2021 4:07 am

A simpler Question:
What settings does the nRF52 require? ARM Cortex M4F
Technical: https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/introduction

The Wiring options seem to suggest the Micro 32u4 or Feather M0
https://learn.adafruit.com/bluefruit-le-connect/wiring-options

Following this approach for Firmata: https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/ble-pin-i-o leads to https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/master/libraries/Bluefruit52Lib/examples/Peripheral/StandardFirmataBLE, uploading turns it off and the Iphone app doesn't see it.

Followed this: https://learn.adafruit.com/bluefruit-le-connect/library-and-config

Gets errors:
Code: Select all | TOGGLE FULL SIZE
'boards_analogiopins' was not declared in this scope
3.JPG
3.JPG (106.12 KiB) Viewed 329 times
2.JPG
2.JPG (49.78 KiB) Viewed 329 times
1.JPG
1.JPG (113.42 KiB) Viewed 329 times


THe controller sketch works but can't do I/O and PWM.

Tried the "StandardFirmataBLE" Firmata for nRF52 boards: not seen on iphone. Code loaded.

scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Re: Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Fri Jul 30, 2021 3:15 am

Follwed the guide to rerun th ebootloader, and updated to 0.24.

Sketches seem to work EXCEPT the StandardFirmataBLE:

Error seems to indicate multiple libraries. Saw a 0.21.0 under nrf52 and deleted it so only 0.24.0 exists.

Error reports:
Code: Select all | TOGGLE FULL SIZE
In file included from C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Bluefruit52Lib\examples\Peripheral\StandardFirmataBLE\StandardFirmataBLE.ino:31:
C:\Program Files (x86)\Arduino\libraries\Firmata/Firmata.h:131:17: error: friend declaration of 'void encodeByteStream(size_t, uint8_t*, size_t) const' specifies default arguments and isn't a definition [-fpermissive]
  131 |     friend void FirmataMarshaller::encodeByteStream (size_t bytec, uint8_t * bytev, size_t max_bytes = 0) const;
      |                 ^~~~~~~~~~~~~~~~~
Multiple libraries were found for "Servo.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Servo
 Not used: C:\Program
Multiple libraries were found for "Wire.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Wire
Multiple libraries were found for "Firmata.h"
 Used: C:\Program
Multiple libraries were found for "Adafruit_LittleFS.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Adafruit_LittleFS
Multiple libraries were found for "InternalFileSystem.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\InternalFileSytem
Multiple libraries were found for "bluefruit.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Bluefruit52Lib
Multiple libraries were found for "Adafruit_TinyUSB.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Adafruit_TinyUSB_Arduino
exit status 1
Error compiling for board Adafruit Feather nRF52832.


Found a nRF52831 library: Deleted it. Same error on running the STandardFirmataBLE.

Something is not right with this Sketch...https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/ble-pin-i-o

Can you provide guidance?

scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Re: Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Fri Jul 30, 2021 3:25 am

THe neopixel sketch works.

THe Firmata is not working, from here: https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/ble-pin-i-o

COpied from here: https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/libraries/Bluefruit52Lib/examples/Peripheral/StandardFirmataBLE/StandardFirmataBLE.ino

Error:
Code: Select all | TOGGLE FULL SIZE
Arduino: 1.8.10 (Windows 10), Board: "Adafruit Feather nRF52832, S132 6.1.1, Level 0 (Release)"

In file included from D:\My_Docs_Master\Arduino_OldComp\Michael_test_codes\BluFruitTestCodes\firmata_try_again\firmata_try_again.ino:25:
C:\Program Files (x86)\Arduino\libraries\Firmata/Firmata.h:131:17: error: friend declaration of 'void encodeByteStream(size_t, uint8_t*, size_t) const' specifies default arguments and isn't a definition [-fpermissive]
  131 |     friend void FirmataMarshaller::encodeByteStream (size_t bytec, uint8_t * bytev, size_t max_bytes = 0) const;
      |                 ^~~~~~~~~~~~~~~~~
Multiple libraries were found for "Firmata.h"
 Used: C:\Program
Multiple libraries were found for "Adafruit_LittleFS.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Adafruit_LittleFS
Multiple libraries were found for "InternalFileSystem.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\InternalFileSytem
Multiple libraries were found for "bluefruit.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Bluefruit52Lib
Multiple libraries were found for "Adafruit_TinyUSB.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Adafruit_TinyUSB_Arduino
Multiple libraries were found for "Servo.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Servo
 Not used: C:\Program
Multiple libraries were found for "Wire.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Wire
exit status 1
Error compiling for board Adafruit Feather nRF52832.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Re: Control UNO with Feather nRF52 Bluefruit?

by hathach on Fri Jul 30, 2021 5:55 am

it is an issue of firmata library https://github.com/adafruit/Adafruit_nR ... -727751057 . They fix it in the upstream but haven't released it yet (only affect some port which unfortunately include our nrf52 core). For walkaround, you could download their git master (zip) and extra to your library to build.

Code: Select all | TOGGLE FULL SIZE
It is indeed issue with firmata library, it is fixed in their upstream https://github.com/firmata/arduino/blob/master/Firmata.h#L131 here. But it is not released just yet, I have no control when they release 2.5.9 , maybe you could just download their current master.zip and extract to the libraries folder.

hathach
 
Posts: 1156
Joined: Tue Apr 23, 2013 1:02 am

Re: Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Fri Jul 30, 2021 10:01 pm

That link is to a Firmata.h file only.
If I could find a similar file to replace I would, however, in that Adafruit BLEFirmata folder, there are no similar files unless the example needs to be changed?
Saving it as a Firmata.h or ino file doesn't seem to work.

WHat github package and is that manage libraries with a zip file install? Can't find the file they mention.

Any guidance?
7.JPG
7.JPG (191.28 KiB) Viewed 307 times
6.JPG
6.JPG (25.9 KiB) Viewed 307 times

scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Re: Control UNO with Feather nRF52 Bluefruit?

by hathach on Sat Jul 31, 2021 12:57 am

here is the github repo of firmata project https://github.com/firmata/arduino , just click code button and download it as zip file and replace/copy to your library as Arduino/libraries/firmata .

Screenshot from 2021-07-31 11-50-22.png
Screenshot from 2021-07-31 11-50-22.png (53.13 KiB) Viewed 304 times


Adafruit_BLEFirmata is for nrf51 only, and has nothing do with nrf52.

hathach
 
Posts: 1156
Joined: Tue Apr 23, 2013 1:02 am

Re: Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Sat Jul 31, 2021 10:00 pm

Followed the link: https://github.com/firmata/arduino
Followed the instructions:
8.JPG
8.JPG (57 KiB) Viewed 294 times

COntroller works fine.
StandardFirmataBLE same issue.
Code: Select all | TOGGLE FULL SIZE
Arduino: 1.8.10 (Windows 10), Board: "Adafruit Feather nRF52832, S132 6.1.1, Level 0 (Release)"

In file included from C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Bluefruit52Lib\examples\Peripheral\StandardFirmataBLE\StandardFirmataBLE.ino:31:
C:\Users\micha\Documents\Arduino\libraries\Firmata/Firmata.h:131:17: error: friend declaration of 'void encodeByteStream(size_t, uint8_t*, size_t) const' specifies default arguments and isn't a definition [-fpermissive]
  131 |     friend void FirmataMarshaller::encodeByteStream (size_t bytec, uint8_t * bytev, size_t max_bytes = 0) const;
      |                 ^~~~~~~~~~~~~~~~~
Multiple libraries were found for "Servo.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Servo
 Not used: C:\Program
Multiple libraries were found for "Wire.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Wire
Multiple libraries were found for "Firmata.h"
 Used: C:\Users\micha\Documents\Arduino\libraries\Firmata
 Not used: C:\Program
 Not used: C:\Users\micha\Documents\Arduino\libraries\arduino-master
Multiple libraries were found for "Adafruit_LittleFS.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Adafruit_LittleFS
Multiple libraries were found for "InternalFileSystem.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\InternalFileSytem
Multiple libraries were found for "bluefruit.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Bluefruit52Lib
Multiple libraries were found for "Adafruit_TinyUSB.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Adafruit_TinyUSB_Arduino
exit status 1
Error compiling for board Adafruit Feather nRF52832.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


Also tried to install as a downloaded zip as Arduino-master.zip.

Looked for example StandardFirmataBLE from the "FIRMATA" library and different error:
Code: Select all | TOGGLE FULL SIZE
Arduino: 1.8.10 (Windows 10), Board: "Adafruit Feather nRF52832, S132 6.1.1, Level 0 (Release)"

In file included from C:\Users\micha\Documents\Arduino\libraries\arduino-master\examples\StandardFirmataBLE\StandardFirmataBLE.ino:28:
C:\Users\micha\Documents\Arduino\libraries\Firmata/Firmata.h:131:17: error: friend declaration of 'void encodeByteStream(size_t, uint8_t*, size_t) const' specifies default arguments and isn't a definition [-fpermissive]
  131 |     friend void FirmataMarshaller::encodeByteStream (size_t bytec, uint8_t * bytev, size_t max_bytes = 0) const;
      |                 ^~~~~~~~~~~~~~~~~
C:\Users\micha\Documents\Arduino\libraries\arduino-master\examples\StandardFirmataBLE\StandardFirmataBLE.ino: In function 'void setup()':
StandardFirmataBLE:772:3: error: 'stream' was not declared in this scope; did you mean 'Stream'?
  772 |   stream.setLocalName(FIRMATA_BLE_LOCAL_NAME);
      |   ^~~~~~
      |   Stream
C:\Users\micha\Documents\Arduino\libraries\arduino-master\examples\StandardFirmataBLE\StandardFirmataBLE.ino: In function 'void loop()':
StandardFirmataBLE:806:8: error: 'stream' was not declared in this scope; did you mean 'Stream'?
  806 |   if (!stream.poll()) return;
      |        ^~~~~~
      |        Stream
Multiple libraries were found for "Servo.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Servo
 Not used: C:\Program
Multiple libraries were found for "Wire.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Wire
Multiple libraries were found for "Firmata.h"
 Used: C:\Users\micha\Documents\Arduino\libraries\Firmata
 Not used: C:\Users\micha\Documents\Arduino\libraries\arduino-master
 Not used: C:\Program
Multiple libraries were found for "Adafruit_TinyUSB.h"
 Used: C:\Users\micha\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.24.0\libraries\Adafruit_TinyUSB_Arduino
exit status 1
'stream' was not declared in this scope; did you mean 'Stream'?

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


'stream' was not declared?..

Tried replacing all 'stream' with 'Stream', then got expected unqualified-id before '.' token....

Still not able to run.

scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Re: Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Wed Sep 01, 2021 1:39 pm

Curious if the updates to this example https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/ble-pin-i-o solved the issues with the firmata?

scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Re: Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Thu Sep 02, 2021 3:58 am


scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Re: Control UNO with Feather nRF52 Bluefruit?

by hathach on Thu Sep 02, 2021 7:53 am


You run the correct example, however, the bug is within the firmata library itself. Check out my above comment, here is what you need to do to build that example

goto https://github.com/firmata/arduino , just click code button and download it as zip file and replace/copy to your library as Arduino/libraries/firmata .

hathach
 
Posts: 1156
Joined: Tue Apr 23, 2013 1:02 am

Re: Control UNO with Feather nRF52 Bluefruit?

by scotch1 on Thu Sep 02, 2021 9:15 pm

SO the issue is that the folder downloaded is 'Arduino-Master':
And needs to replaces the "Firmata" folder;
C:\Users\xxxxx\Documents\Arduino\libraries\Firmata
Appears to compile and work. Nice

scotch1
 
Posts: 238
Joined: Mon Nov 26, 2012 12:13 am

Please be positive and constructive with your questions and comments.