Skip to main content
AAnki.1
Associate
September 29, 2021
Question

How to integrate BlueNRG-2 in an existing application over UART?

  • September 29, 2021
  • 1 reply
  • 2102 views

I have a project that transmit data on BLE and the old BLE that I was using has command for all there setting and those command were sent over the UART. I was hoping if I can use BlueNRG-2 and do all the settings via UART and stream my data over android application.

Can someone please let me know if BlueNRG has this capability?

    This topic has been closed for replies.

    1 reply

    Sebastien DENOUAL
    ST Employee
    September 29, 2021

    Hi @AAnki.1​ 

    There is a specific code example from BlueNRg-1/-2 SDK that may answer your needs.

    This code example is named "chat demo" - server config . It act as a bridge from UART to BLE (and vice versa)

    > All data received on BlueNRG-2 UART is automatically push over BLE and so received on Rx characteristics by the connected smartphone.

    > All data push by smartphone over a TX_characteristic are automatically push over BlueNRG-2 UART.

    Hope it helps.

    Regards,

    Sebastien.

    AAnki.1
    AAnki.1Author
    Associate
    September 29, 2021

    Hi @Sebastien DENOUAL​ 

    Thank you for your reply.

    I already tried this on but I found few limitation in this.

    1) I am unable to receive more than 20Bytes in a message. Only receives a 20 bytes message from the phone.

    2) Does get any response on the UART if BLE is connected to the phone? I get a response of "aci_gap_set_discoverable() --> SUCCESS" if I disconnect the phone with BLE, but nothing comes if devices gets connected.

    Let me know if any solution possible for this.

    Thanks & Regards,

    Aman.

    Sebastien DENOUAL
    ST Employee
    September 29, 2021

    Hi,

    1) 20 bytes => Yes, this is the default packet size "over the air". You can increase this value by playing with MTU size and activating Data Packet Length extension feature available on BlueNRG-2 .

    Now, 20 bytes is the default size of one packet over the air but of course you are allow to send multiple packet. No issue at this point.

    2) Does get any response on the UART if BLE is connected to the phone?

    On this chat demo, by default choice has been done to get only "data" over UART without information message or status. You can of course modify chat demo example to implement any additional message you want to receive.

    As an example, once connected, you will receive hci_le_connection_complete_event() on blueNRG-2 side. At this stage, you can add a printf over UART or send status over UART.

    Regards,

    Sebastien.