I've been desperately trying to get my Xeon to run BLE and continue to bump into issues.
I'm using the latest version of Visual Studio Code on Mac OSX. My device has 1.5.2.
The code I am trying to flash is from the UART example with the addition of me trying to control the LED
Every time I flash the code, it says successful. But changing the UUID or adding the LED control does not take effect for some reason, which leads me to believe it's still running the old code?
Executing task: make -f '/Users/.../.particle/toolchains/buildscripts/1.9.2/Makefile' flash-user -s <
:::: PUTTING DEVICE INTO DFU MODE
Done.
:::: FLASHING APPLICATION
Creating /Users/.../.../Developer/Particle/BLEGPS/BLEGPS/target/1.5.2/xenon/platform_user_ram.ld ...
Creating /Users/.../.../Developer/Particle/BLEGPS/BLEGPS/target/1.5.2/xenon/platform_user_ram.ld ...
text data bss dec hex filename
8348 108 1108 9564 255c /Users/.../.../Developer/Particle/BLEGPS/BLEGPS/target/1.5.2/xenon/BLEGPS.elf
dfu-suffix (dfu-util) 0.9
Copyright 2011-2012 Stefan Schmidt, 2013-2014 Tormod Volden
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Suffix successfully added to file
Serial device PARTICLE_SERIAL_DEV : not available
Flashing using dfu:
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Opening DFU capable USB device...
ID 2b04:d00e
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash "
Downloading to address = 0x000d4000, size = 8456
Download [=========================] 100% 8456 bytes
Download done.
File downloaded successfully
Transitioning to dfuMANIFEST state
*** FLASHED SUCCESSFULLY ***
Press any key to close the terminal.
// This example does not require the cloud so you can run it in manual mode or
// normal cloud-connected mode
SYSTEM_MODE(MANUAL);
const size_t UART_TX_BUF_SIZE = 20;
void onDataReceived(const uint8_t* data, size_t len, const BlePeerDevice& peer, void* context);
// These UUIDs were defined by Nordic Semiconductor and are now the defacto standard for
// UART-like services over BLE. Many apps support the UUIDs now, like the Adafruit Bluefruit app.
const BleUuid serviceUuid("6E400001-B5A3-F393-E0A9-E50E24DCCA9F");
const BleUuid rxUuid("6E400002-B5A3-F393-E0A9-E50E24DCCA9F");
const BleUuid txUuid("6E400003-B5A3-F393-E0A9-E50E24DCCA9F");
BleCharacteristic txCharacteristic("tx", BleCharacteristicProperty::NOTIFY, txUuid, serviceUuid);
BleCharacteristic rxCharacteristic("rx", BleCharacteristicProperty::WRITE_WO_RSP, rxUuid, serviceUuid, onDataReceived, NULL);
void onDataReceived(const uint8_t* data, size_t len, const BlePeerDevice& peer, void* context) {
// Log.trace("Received data from: %02X:%02X:%02X:%02X:%02X:%02X:", peer.address()[0], peer.address()[1], peer.address()[2], peer.address()[3], peer.address()[4], peer.address()[5]);
for (size_t ii = 0; ii < len; ii++) {
Serial.write(data[ii]);
}
}
void setup() {
RGB.control(true);
RGB.color(255, 0, 0);
Serial.begin();
BLE.on();
BLE.addCharacteristic(txCharacteristic);
BLE.addCharacteristic(rxCharacteristic);
BleAdvertisingData data;
data.appendServiceUUID(serviceUuid);
BLE.advertise(&data);
RGB.color(0, 255, 0);
}
void loop() {
if (BLE.connected()) {
RGB.color(0, 255, 255);
uint8_t txBuf[UART_TX_BUF_SIZE];
size_t txLen = 0;
while(Serial.available() && txLen < UART_TX_BUF_SIZE) {
txBuf[txLen++] = Serial.read();
Serial.write(txBuf[txLen - 1]);
}
if (txLen > 0) {
txCharacteristic.setValue(txBuf, txLen);
}
}
}