Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
B

Bens

@Bens
About
Posts
7
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • PiGatewaySerial using interrupts
    B Bens

    Hi All,

    I have the following set-up:

    • A couple of SenseBender Micro's

    • A Raspberry Pi 2 with the NRF24 connected to the GPIO pins

    • The RPi runs the PiGatewaySerial

    • The RPi also runs the pimatic(.org) controller, using the mysensor plugin.

    In this set-up I noticed that the RPI misses some messages send by the SenseBender Micro's, especially when messages are send in rapid succession, e.g. when "presenting" the sensors.

    I modified the PiGatewaySerial.cpp by using the interrupt generated by the NRF24 (see https://www.raspberrypi.org/forums/viewtopic.php?t=17061&p=290453) and have the interrupt routine run "gw->processRadioMessage();". (And remove this call from the main loop of PiGatewaySerial.cpp). I also use a semaphore to ensure that the NRF24 connected to the RPi is either used by the interrupt routine or by "gw->parseAndSend(buff);", which is the other major item in the main loop.
    The result is that no messages are lost anymore. :smiley: I can share the code if requested.

    In the main loop there remains only one polling item "ret = poll(&fds, 1, 500);". I searched quite a bit, but am not able to find a way to make also this call interrupt based. This call waits for about half a second if there is a message that can be read from, in loose terms, "/dev/ttyMySensorsGateway". This waiting for half a second is what makes the RPi miss send messages and which is resolved using the interrupt from the NRF24.

    Does anybody know how to make this call "ret = poll(&fds, 1, 500);" using interrupts? I do not like polling!

    Ben

    Development raspberry pi 2 pimatic interrupts serial gateway
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular