SparkFun Pro nRF52840 Mini Bluetooth usage with CircuitPython

Hi,

(I hope that I’ve created this Topic in the Right Location)

I’m trying to work with the Pro Mini on a Bluetooth Project using CircuitPython. I started with the tutorial provided by sparkfun (tutorials/nrf52840-development-with-ard … python/all). Despite that the board has no Attribute named board.P0_07 or board.P0_13, I figured out that there are instead the Attributes board.LED0 and board.BUTTON0. In the end, i can now toggle the LED on and off using the button on the Pro Mini.

The next step I’m trying to take, is to make a small BluetoothLE application using CircuitPython. The Problem now is, that the librarys for that aren’t already installed on the chip. So reading the first line of the Python REPL:

Adafruit CircuitPython 4.1.2 on 2019-12-18; SparkFun Pro nRF52840 Mini with nRF52840

states, that it uses the 4.X.X Release of CircuitPython. After downloading the 4.X.X Release from [https://github.com/adafruit/Adafruit_Ci ... E/releases](https://github.com/adafruit/Adafruit_CircuitPython_BLE/releases) I transfered the following modules to the lib Folder:
  • - adafruit_ble
  • - adafruit_bluefruit_connect
  • With that I did a Restart of the board and tried to Import modules in the REPL but got the following Errors:
    >>> from adafruit_ble import BLERadio
      File "<stdin>", Line 1, in <module>
      File "adafruit_ble/__init__.py", Line 33, in <module>
    ImportError: This release is not compatible with CircuitPython 4.x; use library release 1.x.x
    
    from adafruit_ble.services.nordic import UARTService
      File "<stdin>", Line 1, in <module>
      File "adafruit_ble/services/__init__.py", Line 28, in <module>
    ImportError: No module with name '_bleio'
    

    Can anyone help me with those Errors? I’m not sure whats exactly missing or wrong. For example the first error states, that i should use release 1.x.x, but first of all the CircuitPython REPL states there is Version 4.X.X installed and also i cant find Version 1.X.X on the above mentioned git repo.

    Best regards and thanks in Advance for any help,

    Marco Piechotta

    (The selected Imports are used in this tutorial: https://learn.adafruit.com/circuitpytho … tton-press)

    Hello Marco,

    Unfortunately, since this update is specific to Adafruit there isn’t much that we can do to support their code. However, looking over the link you mentioned I found the following message:

    BLE support in CircuitPython is currently in development. Be aware that you might find bugs! If you do run into a problem, please let us know! You can contact us on Discord or post an issue here: https://github.com/adafruit/circuitpython/issues

    Hi Brandon,

    thanks for the fast Reply. I’m trying to Contact adafruit directly, but I’m also trying the way to Transfer my Code to the board using Arduino. Maybe you can help me with the Problems i get, when compiling the Code in the Arduino IDE:

    I did the following Tutorial:

    tutorials/nrf52840-development-with-ard … python/all (the same page as mentioned above)

    but when I just compile my Code with the selected SparkFun Board, i get the following error:

    %AppData%\Local\Arduino15\packages\adafruit\hardware\nrf52\0.18.5\cores\nRF5\Uart.cpp:247:48: error: 'PIN_SERIAL1_RX' was not declared in this scope
    
       Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
    
                                                    ^~~~~~~~~~~~~~
    
    %AppData%\Local\Arduino15\packages\adafruit\hardware\nrf52\0.18.5\cores\nRF5\Uart.cpp:247:48: note: suggested alternative: 'PIN_SERIAL_RX'
    
       Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
    
                                                    ^~~~~~~~~~~~~~
    
                                                    PIN_SERIAL_RX
    
    %AppData%\Local\Arduino15\packages\adafruit\hardware\nrf52\0.18.5\cores\nRF5\Uart.cpp:247:64: error: 'PIN_SERIAL1_TX' was not declared in this scope
    
       Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
    
                                                                    ^~~~~~~~~~~~~~
    
    %AppData%\Local\Arduino15\packages\adafruit\hardware\nrf52\0.18.5\cores\nRF5\Uart.cpp:247:64: note: suggested alternative: 'PIN_SERIAL_TX'
    
       Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
    
                                                                    ^~~~~~~~~~~~~~
    
                                                                    PIN_SERIAL_TX
    
    exit status 1
    Error in compiling with board SparkFun Pro nRF52840 Mini.
    

    If i use for example the board Adafruit Bluefruit Metro nRF52840 Express, the compiling works just fine, so my guess would be, that there is something wrong with my Settings for the SparkFun board but this error message isnt telling me a lot where to search as a beginner :slight_smile:

    Best regards

    Marco

    I had the same issue. The definition in the variant.h for the board is PIN_SERIAL_RX and PIN_SERIAL_TX . Edit the variant.h file and add underneath these definitions :

    #define PIN_SERIAL1_RX PIN_SERIAL_RX

    #define PIN_SERIAL1_TX PIN_SERIAL_TX

    I agree with Paul, let us know if this solves your issue.

    Hi Brandon and Paul,

    thanks for your help. It solved the issue for me as well and now the board works just fine with the Arduino IDE. Hopefully i can get some solution for the circuitpython Problem from adafruit directly but I think this thread can now be closed as solved. Thanks again.

    Best regards,

    Marco

    Marpie:

    from adafruit_ble.services.nordic import UARTService
    

    File “”, Line 1, in
    File “adafruit_ble/services/init.py”, Line 28, in
    ImportError: No module with name ‘_bleio’

    
    
    
    Can anyone help me with those Errors? I'm not sure whats exactly missing or wrong. For example the first error states, that i should use release 1.x.x, but first of all the CircuitPython REPL states there is Version 4.X.X installed and also i cant find Version 1.X.X on the above mentioned git repo.
    

    Hi Marpie, I’m the lead for CircuitPython (paid by Adafruit). The error message you received wasn’t very clear. We expected folks to use CircuitPython 5.x for BLE because we reworked the APIs since 4.x.

    The current latest version is 5.3.0 which you should be able to run on the SparkFun Pro nRF52840 Mini and use the Adafruit CircuitPython BLE libraries.

    Hope that helps!