• Hi, just started finally to play around with my puckjs.

    Web IDE works fine.

    Installed node-red and esprinoHub und a Raspi 3.

    Getting RSSI values etc. works fine, but when sending code with inject button (LED set and reset) i got mostly the following error:

    <Connect> Connected. Getting Services...
    <Connect> Timed out getting services. Disconnecting.
    BLE broken? No advertising packets in 10 seconds - restarting!
    

    a few times it worked to set a led but reset allways crashed.

    Just installed 1v90 on puck but problem remains.

    Any idea on this?

    Followed the instuctions to stop bluetoothd but still the problem remains.

    Thanks and kind regards

    solick

  • @solick I had a very similar problem. I got into the EspruinoHub code and made several changes to the logic and it seems to help a lot. At least for me. Plus I fixed a few other little things. You're welcome to try it out. :post:

    https://github.com/dklinkman/EspruinoHub­

    Also if you want to try a slightly newer firmware look here

  • Thanks, tried your version and now the programm don´t crash but the commands are still not excecuted an puck. Tried to switch LEDs on and off, nothing happend. :(

    MQTT>/ble/write/cb:45:3f:d2:6f:4d/nus/nu­s_tx => "LED2.reset();\n"
    Service     6e400001b5a3f393e0a9e50e24dcca9e
    Characteristic  6e400002b5a3f393e0a9e50e24dcca9e
    <Connect> Connected. Getting Services...
    Scanning restarted...
    <Connect> Timed out getting services. Disconnecting.
    
    Sun Jan 01 2017 16:40:20 GMT+0100 (CET)
    
    

    BTW maybe you should make a pull request to the original repo?

  • It's hard to know what's wrong exactly. Clearly the hub is connecting to the puck. You did say sometimes it works. I'm using an RPi3 and the built in bluetooth. This is what I get using the same code for the hub. I can do it 10 times in a row and it's reliable:

    Config loaded
    MQTT Connected
    <HTTPProxy> Bleno State poweredOn
    <HTTPProxy> Bleno.startAdvertising Success
    <HTTPProxy> Bleno.setServices Success
    Scanning started...
    MQTT>/ble/write/c7:6e:71:2e:0e:90/nus/nu­s_tx => "digitalPulse(LED3, 1, 1000);\n"
    Service         6e400001b5a3f393e0a9e50e24dcca9e
    Characteristic  6e400002b5a3f393e0a9e50e24dcca9e
    <Connect> Connected. Getting Services...
    <Connect> found service: 6e400001b5a3f393e0a9e50e24dcca9e
    <Connect> found characteristic: 6e400002b5a3f393e0a9e50e24dcca9e
    <Connect> Writing "digitalPulse(LED3, 1, 1000);\n"...
    <Connect> wrote data: 20 bytes
    <Connect> wrote data: 9 bytes
    <Connect> disconnected!
    Scanning restarted...
    

    Have you updated the firmware in your puck? What version?

  • Hi, puck firmware is 1v90, not the beta version.

    Mybe ist is a problem with node version? I use node v6.9.2

    Have you tried with LED1.set() just to be sure?

    Is there a debug mode in your version so that i can see what is going on?

  • Just to add a little more info to this thread.
    I have a new Pi 3, and installed all the node-red and EspruinoHub software as documented to the latest minimal install of Raspbian jessie.

    Everything appears to work as expected as far as monitoring the Pucks, but writing crashes the EspruinoHub almost every time.

    I have tested with @dklinkman version and also tried the beta 1.9.12. It appears slightly more stable and I have manage one or two writes to two different Puck's, but 9 times out of 10 it fails and the EspruinoHub restarts.

    The error usually get is an out of bounds error, or timed out getting services message.

    I have also tried using the HTTP proxy setting for the Pi bluetooth, but this made little or no difference.

    Node-red is currently at version 0.15.12

    Any help towards fixing this would be very useful if anyone has any further suggestions.

  • Hi Eric, which version of node itself are you using?

  • Hi Solick,

    Node is at v0.10.29

  • @dklinkman please could you issue a PR with your changes to lib/discovery.js in? I'm not 100% sure about the other stuff yet - it looks quite UART-specific?

  • @Gordon should I just send you the file? I think a pull request has to include all the changes for a commit level. Or so I think, I've actually never done a PR. I'm happy to attempt a PR on the full commit. 4 files I think.

    The changes to connect.js are more extensive than discovery.js. I don't know what you mean by 'UART specific", except that it is in fact the UART service and characteristic that the code is retrieving. For some reason job.device.discoverAllServicesAndCharact­eristics(...) in the original code was not returning for me, so the timeout would always occur, or at least 95% of the time. So I changed the logic to use discoverServices() and discoverCharacteristics() which worked very well. That's the gist of the changes there except I also added a recursive function to write additional chunks of data when the data was more than 20 bytes. Works well! Oh and I fixed the /ble/read topic code which was crashing due to a missing parameter.

  • @dklinkman @Gordon is there a special debug parameter to start the program? Than i would be able to debug on my system and see what happens...

  • Ahh, sorry - just glanced at it quickly and saw uartService in there. Thanks! I'll merge that in then.

    You'd have had to have manually submitted the file by Git - it's probably slightly easier if I do it but if you'd submitted it would have preserved your name as the committer for those lines of code. Since I'm dragging in everything it's not an issue though

    edit: Sorry, there's no special debug command as far as I know

  • Thanks - just pulled in. Removed the old code and renamed uartService to matchedService

  • Ahh. Yes. I should have noticed that the service is not limited to the uart service. Just happened to be in the use case.

  • Well, if it works it doesn't really matter what it's called - thanks for all your work on this! :)

  • Still Eric´s and my problem is not solved with this update. Any idea on this Gordon?

  • What error messages do you get displayed now, with the update?

  • Hi Gordon,
    I have built a new Pi3 installation with node at 4.7.2 and npm at 4.0.5 and tried both versions of EspruinoHub on github, yours and @dklinkman and tested on two Pucks, one at 1.9 and the other the latest beta from yesterday and I still get time out errors:

    MQTT>/ble/write/c6:62:41:ed:7f:9a/nus/nu­s_tx => "LED1.set();\n"
    Service     6e400001b5a3f393e0a9e50e24dcca9e
    Characteristic  6e400002b5a3f393e0a9e50e24dcca9e
    <Connect> Connected. Getting Services...
    Scanning restarted...
    Scanning restarted...
    Scanning restarted...
    <Connect> Timed out getting services. Disconnecting.
    BLE broken? No advertising packets in 10 seconds - restarting!
    

    Sometimes it connects, but mostly it fails. I am running out of things to try. Is there any debug info available to get to the bottom of this?

  • The timeout getting services sounds just like what @dklinkman's changes were supposed to fix.

    At the moment I'm afraid there is no extra debugging - but I'm not sure what else we could print that would help (apart from turning on something inside Noble itself). We're asking 'Noble' to return the available services and the function is never returning.

    Does dmesg in Linux say something? Maybe the OS is reporting problems?

  • Just ran dmesg and it all looks clean from the boot start apart from the last line:

    [ 5324.782444] Bluetooth: Failed to add device to auto conn whitelist: status 0x0c

    Not sure what this implies but it only appears once in the list after several successful and unsuccessful writes.

  • Hi still same problem like Eric has. This is very frustrating because node red support was one of the things i was aiming for to play around with

    dmesg shows a lot of data length messages and some rxheader problems:

    [171782.508708] Bluetooth: hci0 advertising data length corrected
    [171784.522087] Bluetooth: hci0 advertising data length corrected
    [171786.539132] Bluetooth: hci0 advertising data length corrected
    [911027.460713] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [911027.460736] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1051371.603572] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [1051371.603594] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1130993.959543] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [1130993.959564] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1131053.958012] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [1131053.958034] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1177615.342334] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [1177615.342356] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1187395.621677] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [1187395.621698] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1314059.310749] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [1314059.310771] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1421822.479586] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [1421822.479608] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1656549.341789] brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -110
    [1656549.341810] brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
    [1749638.660593] Bluetooth: hci0 link tx timeout
    [1749638.660618] Bluetooth: hci0 killing stalled connection cb:45:3f:d2:6f:4d
    [1749645.643130] Bluetooth: hci0 link tx timeout
    [1749645.643146] Bluetooth: hci0 killing stalled connection cb:45:3f:d2:6f:4d
    [1749649.941939] Bluetooth: hci0 link tx timeout
    [1749649.941964] Bluetooth: hci0 killing stalled connection cb:45:3f:d2:6f:4d
    [1749655.765749] Bluetooth: hci0 link tx timeout
    [1749655.765774] Bluetooth: hci0 killing stalled connection cb:45:3f:d2:6f:4d
    
  • @solick so you're using an up to date OS and EspruinoHub software?

    And the MQTT advertising data is arriving just fine - it's just when you go to connect?

    The brcmf_sdio_readframes error sounds a bit iffy as well (like your SD card is having problems?). Are you sure you're running your Pi 3 off a powerful enough power supply? I've had all kinds of instability unless I run it off a really hefty USB charger.

    It could be that there's some power fluctuation that's messing things up.

    I'm stabbing around in the dark a bit though - I mean, I have a Pi 3 here that's working great - and they should presumably all be the same.

    ACTUALLY how are you connecting to the Pi 3? Via WiFi, or Ethernet?

    I had problems with a Chromebook where I was trying to stream my display over WiFi and Bluetooth LE connections kept dropping out - I guess it's possible that if you're using WiFi you could be having similar problems? I know my Pi 3 is connected over Ethernet so I wouldn't have that issue.

  • @Gordon sorry for my late reply was very busy during the last weeks. I need to check OS but it is from September last year I think. hub software updated for the last trial.

    pi3 is connected via ethernet I need to check the power supply and will come back to you.

    Thanks for hints and kind regards

    Lyn

  • @Gordon, the power supply seems to have been the problem. Now it works!!

  • Great! Thanks for letting us know!

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

EspruinoHub crashes when gettingServices while writing from node-red

Posted by Avatar for solick @solick

Actions