CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SPI slave being corrupted by timer interrupts

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rmash



Joined: 15 Nov 2004
Posts: 3
Location: Athens, Ohio

View user's profile Send private message Visit poster's website

SPI slave being corrupted by timer interrupts
PostPosted: Wed Apr 04, 2007 10:49 am     Reply with quote

Embedded folks,
I'm having quite a bit of difficulty transferring data from one master PIC to two slave PICs.

The slave pics (18f458s 40mhz) generate PWM streams with timers 0,1,and 3 that drive motors. The point of having the pwm generation done with slaves is to guarantee that the pwm generation is clean and free from interfering interrupt artifacts. Incidently, these ISRs take from 3 - 5 uS to execute.

This is effectively an extension of the thread "I2C slave interrupt problem
"

I first put together an I2C arrangement that worked with the exception of sporadic glitches in the received data. I examined the data and clock lines, which seemed to be pretty clean. I decided that the I2C slave interrupt was being interfered with by the timer interrupts, so I changed my configuration to the SPI bus with the thinking that I could avoid having a communication interrupt in the slaves.

This SPI arrangement works just fine when the timer interrupts are turned off, but when they're turned on, the received spi data becomes intermittently corrupted. I am using the #use spi() directive and spi_xfer() command.
Also, I turned on the diagnostic feature in the #use spi directive and can see that the sampling pulse is sporadic when the timer interrupts are enabled, but then are perfectly stable when the timer interrupts are disabled.
Does the MSSP necessarily use the SSP interrupt when in slave mode?
I have some fallback strategies, but I'd really like to understand why this approach is failing. It seems there's something i'm not realizing here.
thanks in advance.
rmash
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 04, 2007 11:09 am     Reply with quote

Why start a whole new thread on what is basically a continuation of
previous topic ?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group