serial interface on MDBT42Q

Posted on
  • Not a major issue but I was wondering if there was a way to turn off the text that indicates you are switching between Bluetooth and serial on the MDBT42Q.

    so when I connect over Bluetooth the serial outputs:

    -> bluetooth
    

    and when I disconnect I get

    <- bluetooth
    

    I have written a Bluetooth to serial (rs232) program so I can send serial commands to devices that I have no cable path too, and the auto text complicates it a little bit. Thanks in advance.

  • You can force the console to Bluetooth with Bluetooth.setConsole(1); Docs

  • awesome! thank you

  • The automatic switching can bite you also in other cases.
    I had similar issue but in the other way so I had to do Serial1.setConsole(1) (or LoopbackA as I wanted Serial1 disabled).
    The issue is that there is no such thing/event as 'connection to bluetooth console', there is only connection to whole device. So if I have my custom BLE service and someone connects to it the Espruino console is switched too even if nobody is using/reading it. And additionally it seems that if nobody reads the output that espuino prints to Bluetooth console (my debug console.log() calls) some buffers gets filled soon and espruino gets stuck. If I disconnect from my service soon enough and connect Web IDE the output is drained from the buffers and shown in Web IDE, and my stuck/batched espruino code resumes. If I don't do it soon it just hangs and needs reset.

    It surprised me first but after thinking about it, is now clear because console is done via just another BLE service so it is not known which service/characteristics will client use after connection so Espruino console is switched on connection event. It theory this could be changed to do the switch only after first read/write to Nordic Serial service.

  • Thanks for the update! Actually it seems that it would be a bug of Bluetooth UART write fills buffers if nothing is reading from it. I'll look into that.

    About the original switch, I believe that if echo(0) is called, nothing will be printed to the UART to indicate the change.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

serial interface on MDBT42Q

Posted by Avatar for user102708 @user102708

Actions