Jump to content
leebr

Problems with Serial using interrupts

Recommended Posts

Hi,

I am developing a monitor that will wake up every 15 minutes read and sensor and send some data. I'm using an EXP430G2  onto which I have successfully soldered the 32KHz crystal. The interrupts are working OK, waking every 16 seconds and toggling a LED. I'm using TACTL = TASSEL_1 +ID_3 + MC_2 +TAIE and Timer0-A1.

My problem occurs whenever I try to use either the serial port (using Serial.print) or the AirBooster Pack. Then nothing happens - the system freezes. I'm assuming this has something to do with use of interrupts by the Serial and Airbooster libraries but I have no idea what. 

Any pointers on how to resolve this much appreciated. (Note serial and airbooster work fine when not using interrupts)

Cheers

brian

Share this post


Link to post
Share on other sites

Just curious, are you trying to do the Serial.print inside the interrupt?  Somewhere in the documentation it says you shouldn't do that.

What I do, is use and "Event" variable to trigger something time consuming (e.g., Serial writes)  outside of the ISR.  So something like this:

#include "Event.h"

Event SampleTaken;
volatile (datatype)  SampleValue;


setup:
   setup/start timer
   SampleTaken.begin();
loop:
   SampleTaken.waitFor();
   print SampleValue;

ISR:
   Grab SampleValue;
    SampleTaken.send();
  
jrd

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...