Waking processor from STANDBY via SERCOM: RXS interrupt loop?

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

On my SAMD21, I'm using the OSCULP32K as a real-time clock: I can put the processor into STANDBY mode and on a RTC count match, it wakes the processor up.  Works fine.

 

Now I'd also like to wake the processor up when serial RX activity is detected.  But I'm getting stuck in an apparent interrupt loop.  Here's what I've done:

 

If I understand section 26.6.3.7 of the SAMD21 Family Datasheet correctly, I should:

  1. Reconfigured the clocks so the SERCOM3 Slow input is derived from the RTC (which is always running)
  2. Enabled Start Of Frame detection (CTRLB.SFDE) to detect onset of an incoming character
  3. Enabled Receive Start Interrupt Enable (INTENSET.RXS) to wake the processor at the onset of an incoming character

 

(Aside: I know that if my baud rate is high and my processor clock is slow to wake, then I ight ot eceive he irst haracter orrectly.)

 

Steps 1 and 2 I did via Atmel START (i.e. the Clocks screen and the SERCOM3 advanced settings, respectively).  I didn't see any high-level functions for enabling INTENSET.RXS, so I just called:

 

  hri_sercomusart_set_INTEN_RXS_bit(SERCOM3);

in my startup code.  Everything seems to work until I type a single character, at which point the code goes into a continual loop inside _sercom_usart_interrupt_handler().

 

My guess is that _sercom_usart_interrupt_handler() isn't set up to clear RXS interrupts, so the interrupt bit never gets cleared and it continually re-interrupts.  (The good news: enabling RXS interrupts definitely wakes the processor.)

 

So my questions:

  • Is my theory about RXS interrupts not getting cleared correct?  If not, what should I look for?
  • Is there a way to clear the RXS interrupt without modifying the ASF source code?  (I didn't see one)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Addendum:

 

I noticed in the Datasheet, it says:

When using start-of-frame detection without the Receive Start interrupt, start detection will force the 8MHz Internal Oscillator and USART clock active while the frame is being received. In this case, the CPU will not wake up until the Receive Complete interrupt is generated.

So I also tried NOT enabling Receive Start Interrupts, assuming that the processor would wake on Receive Complete.  But I'm missing something: typing a char to SERCOM3 doesn't wake the processor.