Re: Asm sleep - pbp sleep
Here is something from me:
1. Leave the RX pin unconnected for testing. Check the pin state. Does it stay low or high? If it is high and you get int at high already, then it never sleeps.
2. IF all ok, then before sleep instructon, disable GIE and PEIE first. Disable eusart module. Then re-enable it. clear the flags. Then enable GIE, PEIE and lastly usart int bit. Make sure usart flag is cleared, and Usart int bit enabled at the last just before SLEEP command.
3. There should be at least two NOP() immediately after SLEEP.
4. If there are some other ints in your code not shown here, than they may be the cause of wake up. Remember, Most of the ext int sources wake the device up eventhough you do not care for them. Make sure you disable all other ext int sources (if you are using any) before SLEEP.
Last edited by sayzer; - 11th May 2020 at 09:42.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks