Is there a bug w/ Dig8 interrupt?

Questions specifically regarding the WiShield 1.0 family driver.

Is there a bug w/ Dig8 interrupt?

Postby spidermonkey04 » Sat Oct 23, 2010 10:33 pm

Any thoughts appreciated on the subject.
I've been doing some testing with the driver, trying to optimize it, and noticed that when using Digital pin 8 as the interrupt some weird stuff happens, but the board still functions properly. zg_process_isr() seems to continually run because of this code
Code: Select all
#ifdef USE_DIG8_INTR   
// PCINT0 supports only edge triggered INT
   if (PORTB & 0x01) {
      intr_occured = 0;
      ZG2100_ISR_ENABLE();
   }else {
      intr_occured = 1;
   }
#else
   intr_occured = 0;
   ZG2100_ISR_ENABLE();
#endif

So I threw some print statements in there and saw that 'if (PORTB & 0x01)' is NEVER true, so intr_occured is always 1 which makes zg_process_isr() continually run ( from drv_process() ).

Now, this doesn't hurt the functionality of the chip, I just thought maybe it was overlooked, or maybe I'm just imagining things :shock:

It appears the interrupt pin on the Zg2100 is normally high, pulled low when an interrupt occurs ( based on attachInterrupt(0, zg_isr, LOW); ). Since Dig8 uses a pin change interrupt, the interrupt is fired when the pin transitions from HIGH to LOW, then again from LOW to HIGH. So...if Dig8 is normally HIGH, the ISR executes when its being pulled to LOW, meaning that 'if (PORTB & 0x01)', or 'is Dig8 HIGH', never equates to TRUE. Can this be correct??? Shouldn't it be something like
Code: Select all
if(PORTB & ~(0x01))
But then I thought this could cause problems if someone were to use another Pin Change Interrupt on Dig9-13. Watcha think? The whole if(PORTB) statement COULD just be removed since ZG2100_ISR_DISABLE() stops the pin change intr from being fired twice.
Sorry if I'm not making sense...

To sum up: either change it to 'if(PORTB & ~(0x01))' or just remove it?

---Jared
spidermonkey04
 
Posts: 65
Joined: Thu Oct 29, 2009 6:45 pm

Return to WiShield 1.0 Driver

Who is online

Users browsing this forum: No registered users and 1 guest

cron