BLE UART tutorial help

bluetooth
Tags: #<Tag:0x00007fe21ddd7140>

#1

When I load the example BLE UART code linked below it does not show up on the Adafruit Bluefruit app as a UART service. I tried it on the Boron, Argon, and Xenon with the same results.

https://docs.particle.io/tutorials/device-os/bluetooth-le/#uart-peripheral

The BLE UART LOG Handle example application does have the devices show up as UART services on the Bluefruit App. Both app examples use the same service UUID so I’m not sure what’s going on.

https://docs.particle.io/tutorials/device-os/bluetooth-le/#ble-log-handler

Is it just me?


#2

That’s odd. I just tried it again and that code is working for me and is displaying as having a UART in the Bluefruit App.


#3

I loaded both the UART example codes on a Xenon running the 1.3.0 firmware and the Xenon will not show up as a UART device.

The Xenon does show up a BLE device but not UART capable.

The Xenon is blinking Blue, does that matter?


#4

The Xenon is blinking Blue, does that matter?

Yup. That’s the problem. In 1.3.x, when in listening mode the system takes over BLE advertisements because it needs to advertise for device setup over BLE.


#5

Can I get the Xenon out of the Listening Mode without having it join a MESH network?

Can I program the Xenon to basically only communicate via BLE as a stand alone device without having it connected to a MESH network?


#6

Can I get the Xenon out of the Listening Mode without having it join a MESH network

Yes, set the setup done flag on the device from firmware or dfu-util, then use SYSTEM_MODE(MANUAL).

https://docs.particle.io/support/particle-devices-faq/mesh-setup-over-usb/#marking-setup-done


#7

Should I be getting this error in Workbench?

I load this code on the Xenon but it stays blinking blue and never flashes the D7 LED indicating it has set the flag.


#8

This looks like a false flag by IntelliSense but should not cause a build error.


#9

Cool, I built it, flashed to a Xenon, but no D7 LED illumination so it’s not setting the flag for some reason.


#10

Have you ran a clean before you built?
After switching platform I usually check the first firmware via particle binary inspect to ensure that I actually get a compatible binary.


#11

Yea, I quickly learned that the clean process is required when switching devices to compile for. I turned that warning off but then turned it right back on after stuff seeing the new code not uploading.

I just moved onto using a Xenon that was already setup on a network.


#12

I also am having trouble setting up the SETUP DONE flag on the Xenon. I have a whole tray of Xenons and tested 5 of them. None work.

Anyone else having this problem besides @RWB and myself?


#13

Glad it was not just me :slight_smile:

@rickkas7 Both of us were not able to use the Xenon SETUP DONE flag on the Xenons using Workbench and firmware 1.3.0

A new bug maybe?


#14

Other things I tried that didn’t work:

  • Uploaded the code via --usb and --serial flash modes
  • Firmware versions 1.2.1-rc2 and 1.3.0-rc1
  • Marking setup done from the DFU-Util commands for the Argon (probably different for the Xenon, but I tried anyway)

#15

Now that I think about it, the setup done flag isn’t necessary on the Xenon. And I cleared the credentials and I had no problem using manual mode. A few things:

If you updated Device OS to 1.3.0-rc.1 to use BLE, make sure you also upgrade the bootloader in --serial mode, otherwise the device will try to go into safe mode to upgrade it, which will cause it to go into listening mode with no mesh network set up. To verify if this is the case, connected by USB and in listening mode (blinking dark blue), do:

particle serial inspect

Make sure the device does not have any failed dependencies.

Also your user firmware must use

SYSTEM_MODE(MANUAL);

The examples in the tutorial have this line commented out so you can flash code OTA without going into safe mode, but to use a Xenon without a mesh network for BLE you can only flash by USB and must use MANUAL mode.


#16

Ah yes, that was exactly the information I needed, @rickkas7. That make my life so much easier. I have 2 trays of Xenons that I want to use without BLE and Mesh in the interim. I was having a lot of trouble just getting my firmware to run due to the tedious Mesh setup process.

Here are the exact steps I’ve taken with a fresh Xenon (on Windows 10):

  1. Put the Xenon in DFU mode.
  2. Upgrade the System firmware from CLI using USB (Serial mode doesn’t work until system firmware is upgraded).
particle flash --usb xenon-system-part1@1.3.0-rc.1.bin --force
  1. Press the Xenon reset button.
  2. Upgrade the Bootloader from CLI using Serial.
particle flash --serial xenon-bootloader@1.3.0-rc.1.bin --force
  1. Inspect the Serial on the Xenon and make sure all have passed.
particle serial inspect


6. Flash your own code, and verify that SYSTEM_MODE(MANUAL) is being used.
7. Xenon should reboot and run your code. If in Listening mode, something is wrong.


#17

How are you putting then BLE to good use?


#18

I plan on having a Particle cellular + mesh module (either BSOM or Boron) on my product that’s installed next to a solar panel on a large solar array. Then, on the ground sits another accompanying device. The two devices exchange data/variables and I want them to communicate with each other via BLE.

In the interim, I have an E-Series E0 communicating with the Xenon over a physical wire (Modbus). I don’t have enough trust (or experience) in BLE yet - it’s not production-ready. Once it’s more stable I am going to implement the BLE devices and get rid of the physical wire. I’ll actually save money once that’s complete. You wouldn’t believe how much IP-rated wires and connectors cost!


#19

Yea that makes sense. The BLE may be more stable than the Mesh due to its maturity as a standard. With the external antennas the BLE range is really good for the little power it consumes.

Ricks new BLE Serial Library makes it really easy to send and receive BLE data basically the same as you can over regular serial UART so it should be easy to do what ever your wanting to do.

Did you ever move forward with the LTO batteries and circuits?


#20

Yes, for sure! BLE Serial is definitely close to what I want, and it should be really easily portable from my existing Serial design.

Yep, I’m using just a single 1500mAh LTO cell to power the E-Series E0 and main PCB. I used a TI high efficiency step-up converter going into the Li+ pin and it’s working like a dream. Glad to finally ditch those LiPo cells