This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sd_app_event_wait()

Sir

about the

while(1)

{

sd_app_event_wait(); //stay here until a interrupt or connection occurs...

}

During the time that there is not a interrupt and no connections (i am stopped on sd_app_event_wait()), i want to broadcast a updated data (temperature and humidity that i am getting from a BME280 sensor). How can i do that, update the broacast data when stay stopped on sd_app_event_wait() ?

Thank you!

I am using bleperipheral lib to arduino!

Thanks!

Parents
  • You have to generate an interrupt with an interrupt handler, which allows you to wake the chip up and read the sensor data. One option is to use a timer interrupt, and perform a read at regular intervals. Take a look at the Timer example for guidance how to implement this. If your sensor has an interrupt pin, you can use the GPIOTE peripheral to generate an interrupt. However, I don't think the BME280 sensor supports this.

    Best regards,

    Simon

  • Thank you so much about fast answer! Nordic team is great!

    Well, i have to verify if timers interrupt were implemented on Arduino ported to NRF5x! (sandeepmistry)

    Do you mean that any timer if triggers interrupt will wake up the BLE stack ? 

    Other question, using the my multimeter and programming the advertsing interval to 4000ms, i can measure spikes of 100 microamperes (100uA), is that +- right ?

    Thank you again!

Reply
  • Thank you so much about fast answer! Nordic team is great!

    Well, i have to verify if timers interrupt were implemented on Arduino ported to NRF5x! (sandeepmistry)

    Do you mean that any timer if triggers interrupt will wake up the BLE stack ? 

    Other question, using the my multimeter and programming the advertsing interval to 4000ms, i can measure spikes of 100 microamperes (100uA), is that +- right ?

    Thank you again!

Children
  • Miguel said:
    Do you mean that any timer if triggers interrupt will wake up the BLE stack ? 

     Yes, correct. If you are putting the chip to System ON mode, the chip will be awakened by timer interrupt signal. Read more here about system ON.

    Another approach is to build upon the example <..>\nRF5_SDK_15.3.0_59ac345\examples\peripheral\twi_sensor, which works in the following manner:

    • Initialize twi to use EasyDMA
    • Initiate a read, by running nrf_drv_twi_rx()
    • Put the chip to System ON sleep (sd_app_event_wait() if using a SoftDevice)
    • Implement a twi handler, which will get triggered when the TWI transfer is completed, and read out the data from the buffer given to nrf_drv_twi_rx()

    Best regards,

    Simon

Related