Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.3.6 still doesn't work with UNO R4 WiFi in real life #322

Closed
ArduinoManager opened this issue Aug 31, 2023 · 2 comments
Closed
Labels
conclusion: off topic Off topic for this repository conclusion: resolved Issue was resolved type: imperfection Perceived defect in any part of project

Comments

@ArduinoManager
Copy link

ArduinoManager commented Aug 31, 2023

Environment:

Arduino IDE: 2.2.0
ArduinoBLE: 1.3.6

This is my test code

#include <ArduinoBLE.h>
#include <BLECharacteristic.h>

BLEService mainService = BLEService("19B10000-E8F2-537E-4F6C-D104768A1214");
BLECharacteristic rxCharacteristic = BLECharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLEWrite, 20, true);
BLECharacteristic txCharacteristic = BLECharacteristic("19B10002-E8F2-537E-4F6C-D104768A1214", BLERead | BLENotify, 20, true);

BLEService batteryService = BLEService("180F");
BLEUnsignedCharCharacteristic batteryLevelChar = BLEUnsignedCharCharacteristic("2A19", BLERead | BLENotify);


void setup() {
  Serial.begin(115200);
  while (!Serial)
    
  delay(500);
  Serial.println("Initializing BLE module");

  if (!BLE.begin()) {
    Serial.println("starting BLE failed!");
    return;
  }
  BLE.setDeviceName("Bug Test");
  BLE.setLocalName("Bug Test");
  BLE.setAdvertisedService(mainService);

  mainService.addCharacteristic(rxCharacteristic);
  delay(1000);

  mainService.addCharacteristic(txCharacteristic);
  delay(1000);

  BLE.addService(mainService);
  delay(1000);


  batteryService.addCharacteristic(batteryLevelChar);
  delay(1000);

  BLE.addService(batteryService);
  delay(1000);

  BLE.setEventHandler(BLEConnected, connectHandler);
  BLE.setEventHandler(BLEDisconnected, disconnectHandler);
  rxCharacteristic.setEventHandler(BLEWritten, characteristicWritten);

  BLE.advertise();

  Serial.println("Advertising started");
}

void loop() {

  BLE.poll();
  delay(200);
}


void connectHandler(BLEDevice central) {
  Serial.print("Connected event, central: ");
  Serial.println(central.address());
}

void disconnectHandler(BLEDevice central) {
  Serial.print("Disconnected event, central: ");
  Serial.println(central.address());
}

void characteristicWritten(BLEDevice central, BLECharacteristic characteristic) {
  Serial.println("Characteristic event, written: ");

  char buffer[40];
  int n = characteristic.readValue(buffer, sizeof(buffer));
  memset(&buffer[n], 0, sizeof(buffer) - n);
  String d = String(buffer);

  Serial.print("R >");
  Serial.print(d);
  Serial.print("< ");
  Serial.println(n);
}

Arduino Nano 33 IoT: Code correctly publish services and characteristics.
**Arduino R4 WiFi: Only the Battery Level services shows up on LightBlue for iOS

Reported here as well: https://forum.arduino.cc/t/arduinoble-doesnt-work-inside-library/1148979.

I simplified the test code removing the library but it still doesn't work.

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Aug 31, 2023
@facchinm
Copy link
Contributor

The library needs an updated version of the Renesas core (namely 1.0.3) which solved the heap corruption bug arduino/ArduinoCore-renesas@96963d8 . The core will be available VERY soon 🙂

@facchinm
Copy link
Contributor

Fixed by core 1.0.3 release

@per1234 per1234 added conclusion: off topic Off topic for this repository conclusion: resolved Issue was resolved labels Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: off topic Off topic for this repository conclusion: resolved Issue was resolved type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants