Radio waking up for no reason.

  • Hi.
    I'm working on low power pulse power meter based on atmega328p@3.3v/8MHz.
    My plan is:
    a: Send KWh for day/night meter every 100 pulses
    b: power radio ON only on 100th pulse
    😄 For (b) reason I'm not using sleep(); as sleep(); is powering up radio every time cpu is woken up.
    sleep(0); => 20mA x 8ms
    PowerDown(); => 4mA x 0.5ms
    Using sleep(0); my node battery would last approx 80 times shorter than without it.
    d: Calculate average power consumption every 30 minutes.
    e: For reason (d) I'm running on internal oscillator with 32.768kHz crystal feeding Timer2 in asynchronous mode.

    Now the problem.
    Before I enabled TIMER2 overflow interrupt everything worked fine. Pin change interrupts work as intended, radio stays down until data is ready to be sent.
    As soon as I enable TIMER2 interrupt, wake up from it (every 8 seconds) and radio gets turned on by receiveDone(); called from f****k knows where.
    I know it's receiveDone(); because I'm using AVRStudio and DebugWire debugging.
    i could call transportDisable();(that's what sleep uses to switch radio off) but it takes 4 ms to cycle radio power, 8-10 times more power used that needed.

  • Update:
    After few hours with AVR dragon snooping execution paths I found that after each loop() radio is woken up by code executed after each loop().
    My solution is to never leave loop() by creating infinite loop inside of it, so far, after 10 h everything runs stable.
    8-10 years on a single 1/2AA Lithium thionyl battery seems possible 🙂

Log in to reply

Suggested Topics