Disconnecting client from gateway

  • Hi,

    I am checking the functionality of nrf51822 device at the client side, client side I am using both mysensor.h library and BlePeripheral.h library and WaveShare ble 400 nrf51822 device. I have given condition like when a button is LOW the client should connect to the gateway device (gateway side: nrf24L01 and NODE MCU(esp8266) and GatewayEsp8266MQTTclient program).
    when a button is high the client should connect to the mobile device but during the LOW (not pressed)condition of a button it is connecting to the gateway i.e to nrf24L01 when I pressed the button means HIGH it is not advertising properly how do I make it disconnect from gateway and make it to normal advertising. please help me.

  • Mod

    I don't fully understand what is the purpose of this setup... Could you please give better details.

  • Hi,
    In the client side am using the nRF51822 device and I am giving condition like if button state is LOW the client device should connect gateway device (nrf24L01) and then sending command ON and OFF from gateway to client to turn on the buzzer or LED. The gateway is connected to MQTT broker, if the button is HIGH it should disconnect from the gateway device and it should start advertising and it should connect to the mobile app (NRF connect app), through the mobile app I am sending command 0 and 1 to switch ON and OFF the led of client device.

    The gateway side the NRF24L01 is connected to NODE MCU(ESP8266MOD), this device is connected to MQTT broker.

    At the client side, I am using both libraries like BLEpepheral.h for advertising and connect to mobile and MySensor.h library for connecting to the gateway and communicate with the gateway device.

    The problem I am facing is when the button is HIGH whether the gateway is a disconnect or not, and it is not advertising to connect mobile app( (NRF connect app).

  • Hardware Contributor

    If I understand what you're trying to do, you can't use softdevice (BLE mode) with MySensors (nrf24 mode). This is not compatible actually.

  • Hi scalz,

    can you please elaborate, why it is not compatible, please tell me.

  • Hardware Contributor

    maybe you already know it, but softdevice is sort of OS, providing features like BLE etc.
    So it already uses some stuff in the nrf5x like timers, flash memory mapping for softdevice, fw, eeprom emulation etc.

    On the other side, because of softdevice license at the moment I think, the nrf5x MySensors port made by @d00616 don't use the above API, it directly uses the nrf5 hardware and is tailored for MySensors use.
    (see here for more infos https://www.openhardware.io/view/376/MySensors-NRF5-Platform and you can also see "At the current state, BLE is not supported by MySensors").

    To keep things simple, the two modes resources are conflicting.

  • Contest Winner

    There are two reasons missing SoftDevice support. The License at the time of starting my port of MySensors to NRF5 and I don't like to have the SoftDevice on my Nodes. I have never tested MySensors with a SoftDevice present.

    At the moment I reimplement the ESB protocol, because there is an bug in the NRF52 hardware (PAN102) which I had no luck fixing it in the current ESB implementation. The new version uses more resources like PPI and Timer and splits the code for TX, TX with ACK and RX. I hope this is better to debug and easier to understand.

    When I find some time, I do some tests if this code works with a SoftDevice present. When it works, then I remove or change the error/warning message about SoftDevice support. I have no plans to add code for dual Stack (BLE, ESB) or SoftDevice cooperation, but Pull Requests to do this are welcome.

    If someone have plans to add BLE support, please look into the SoftDevice/DFU bootloader memory map. I think the DFU bootloader conflicts with the NVM library, which is used to store the MySensors configuration.

  • Is it possible to disconnect client nrf5 from the gateway nrf24L01 by pressing any predefined button?

  • Mod

    Just add some code that before sending it checks a variable, you change the variable by pressing button.

  • I want to disconnect the gateway nrf24L01 device from the client nrf24L01 and then client radio should be free for advertising and connecting to mobile device until the button state is low it should not try to connect to gateway nrf24L01. when the button is high the client should be disconnecting from the gateway.

  • Mod

    I can't help you here...

  • Hardware Contributor

    for the reasons previously explained, you can't do this actually; using both "api" at same time in code as softdevice is loaded in background.
    unless you make some changes in Mysensors nrf52 port code..

Log in to reply

Suggested Topics

  • 4
  • 3
  • 2
  • 14
  • 274
  • 5