Fixed a bug in communicaton. Added some interrupt disablers. Made some variables volatile.

Signed-off-by: Cesar Andreu <cesarandreu@gmail.com>