Pages: [1]   Go Down
Author Topic: interrupt disable SD access  (Read 800 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 3
Posts: 77
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A particular application utilizes the arduino interrupt 1.  The ISR can be delayed without terrible consequences.  This is important because writes to the SD may be taking place at the interrupt moment.  I don't think they should be messed with.  Testing, certainly not exhaustive, has not revealed any problems.  This is probably just good luck.  It certainly is not good form to ignore the issue.  

Perhaps someone would share their knowledge and experience.

I know about
To disable interrupts:
 cli();                // disable global interrupts

and to enable them:  
 sei();                // enable interrupts

and BSET & BCLR

I am used to 8052 programming where individual interrupts can be masked and prioritized.  I do not know the details of how the arduino interrupt system works and particularly how  it may already be manipulated by the SD routines to protect the transfer from interruption.  Is it efficient to noInterrupts() before each file access or is there a line of assembly code to accomplish the same for just interrupt 1?  cli is not a good idea because millis  must keep going.

I've thought about masking the interrupt by changing the interrupt sensing pin to be an output with a 1 on it before the SD access and then changing it back on the return from the SD routine, or masking it with the output of another pin.  I am concerned the state of the pins might change just as a result of the manipulation, creating a false interrupt.  I can set this up and give it a try but if someone has knowledge and experience to share, things would proceed a lot faster.

Thanks in advance

jac
« Last Edit: February 17, 2011, 08:38:50 pm by jcarrr » Logged

Pages: [1]   Go Up
Jump to: