I am trying to find a way to send AT Commands to the BLE module on my Itsy Bitsy Express board (https://www.adafruit.com/product/4481) - specifically, I'm trying to change the advertised name on the BLE.
The only tutorial/code sample I've found is an Arduino sketch for the nRF51 (https://learn.adafruit.com/introducing- ... /atcommand) which can be found in Examples if one installs the Arduino code examples. However, this does not build for the Express boards.
Are there any tutorials, sample code, etc for the Express board? Preferably in Circuit Python?
I've also tried sending AT Commands via Blufruit Connect iOS app using the UART. The problem there seems to be that whatever I send from the app to the Express shows up on the board's UART with an appended b'<string>'
So for example, if I send the string:
hello
It shows up on the Express' UART as:
b'hello'
Does anyone have any ideas?
Sending AT Commands
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sending AT Commands
Are you using the nRF52840 version?
https://www.adafruit.com/product/4481
If so, that one doesn’t use AT-commands. It runs the BLE code stack directly, so you can/must use the API’s .setName() method in C++, or the .string attribute in CircuitPython:
https://circuitpython.readthedocs.io/en ... apter.name
https://www.adafruit.com/product/4481
If so, that one doesn’t use AT-commands. It runs the BLE code stack directly, so you can/must use the API’s .setName() method in C++, or the .string attribute in CircuitPython:
https://circuitpython.readthedocs.io/en ... apter.name
- frednikgohar
- Posts: 14
- Joined: Wed Aug 11, 2021 2:33 pm
Re: Sending AT Commands
Thanks Mike,
I'm a total newbie to programming but was able to get it working... sort of. Seems that I changed the name but it is not persistent. Here's what I did in CircuitPython:
What prints is indeed NewBLEname. However:
1- if I upload a new code, the name reverts back to CIRCUITPYxxxx
2- the name of the disk drive, as is mounted to my OSX Sierra, never changes.
Interestingly, up until today the name of the board as mounted on my machine was also CIRCUITPYxxxx - until earlier this afternoon where for some reason it changed to FSRCUITPY (seems like the first two letters changed from CI to FS). Not sure how this change occurred but it has been persistently FSRCUITPY (no xxx append) when mounted, even after several soft resets via onboard RST button and/or unplug/replug of the device via USB.
Finally, I know this is off topic but I'm trying to access the other onboard button (the SW) and per the instruction, it should be read/set via:
However, I get this error:
Any ideas how best to get/set the state of the onboard SW? Any sample code would be much appreciated. Thanks in advance.
/F
I'm a total newbie to programming but was able to get it working... sort of. Seems that I changed the name but it is not persistent. Here's what I did in CircuitPython:
Code: Select all
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
import board
ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)
newName = "NewBLEname"
ble.name = newName
# Check new name was set
print("New BLE Name is: ", ble.name)
1- if I upload a new code, the name reverts back to CIRCUITPYxxxx
2- the name of the disk drive, as is mounted to my OSX Sierra, never changes.
Interestingly, up until today the name of the board as mounted on my machine was also CIRCUITPYxxxx - until earlier this afternoon where for some reason it changed to FSRCUITPY (seems like the first two letters changed from CI to FS). Not sure how this change occurred but it has been persistently FSRCUITPY (no xxx append) when mounted, even after several soft resets via onboard RST button and/or unplug/replug of the device via USB.
Finally, I know this is off topic but I'm trying to access the other onboard button (the SW) and per the instruction, it should be read/set via:
Code: Select all
import board
print(board.D4) # as SW is connected to GPIO 4
Code: Select all
Traceback (most recent call last):
File "code.py", line 22, in <module>
AttributeError: 'module' object has no attribute 'D4'
/F
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sending AT Commands
That’s normal. The bootloader sets some default values so the board starts in a known condition every time. The last thing you want is persistent settings from some piece of code you ran months ago suddenly popping up to cause problems in the code you’re using today.frednikgohar wrote:Seems that I changed the name but it is not persistent. Here's what I did in CircuitPython:
If you want to set the device name, you have to do it as part if the setup code.
Hmm.. I’ve never seen that before. Let me check with the folks who handle the low-level CircuitPython code.frednikgohar wrote:Interestingly, up until today the name of the board as mounted on my machine was also CIRCUITPYxxxx - until earlier this afternoon where for some reason it changed to FSRCUITPY (seems like the first two letters changed from CI to FS). Not sure how this change occurred but it has been persistently FSRCUITPY (no xxx append) when mounted, even after several soft resets via onboard RST button and/or unplug/replug of the device via USB.
Try using board.SWITCH instead of board.D4. The symbol name may have changed since the tutorial was written.frednikgohar wrote:Any ideas how best to get/set the state of the onboard SW?
- frednikgohar
- Posts: 14
- Joined: Wed Aug 11, 2021 2:33 pm
Re: Sending AT Commands
Noted. This totally makes sense.####################### RAPTOR - Prototype Firmware ########################
Re the disk name changing proper name on OSX: turns out this is very normal as well; one can simply right-click a mounted drive in OSX Finder and change the display name of that drive.
However, regarding the onboard switch:
I have tried
Code: Select all
board.D4
Code: Select all
board.switch
Code: Select all
board.SW
Code: Select all
board.SW1
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sending AT Commands
‘SWITCH’ was a literal string, caps and all. Did you try that as well?
Please be positive and constructive with your questions and comments.