Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Spurious SSP interrupt using I2C

Status
Not open for further replies.

Oznog

Active Member
I am running the SSP I2C on a PIC18F252 in Slave mode.
The Master is a separate piece I can physically disconnect. When that happens, the Slave is supposed to go into Sleep mode until another I2C interrupt occurs. The Slave hardware has pullup resistors to keep the values high.

Prob is, after the Master is disconnected, the Slave is still experiencing SSP interrupts at a regular period, just under 1 sec. This makes no sense- both SCK and SDA pins remain high on the scope. It looks like S=1, DA=RW=BF=0 when the interrupt occurs.

I made sure all the assigns to PortC pins used the C latch rather than the Reg. No difference.

Additionally this is the same system which keeps losing a byte periodically while data goes from Slave to Master. Maybe it's a related problem, maybe not.

SSPADD= SLAVE_I2C_ADDR;
SSPCON2 = 0b00000001; // Enable clock stretching
SSPSTAT = 0b00000000;
SSPCON1= 0b00110110; // Slave mode, 7 bit no interrupts
 
ok well do u mind emailing me ur interrupt code/setup code on the slave, when i get on my laptop i can check it with some stuff i played with last year (had some i2c slave working on a 16F877A, pretty much the same setup).

Thanks,

- Martyn
 
Unfortunately it's part of a much larger project (all in C), so it's not really practical to make it stand-alone.

The debugging I've done on this keeps indicating there is nothing in the code prompting this. If the Master never gets hooked up, it sees no interrupts, but once the Master has been doing I2C transactions, it gets 1 interrupt repeating in just under 1 sec. I can find no code which prompts this action, all the SSP operations are triggered by SSP interrupts caused by operations initiated by the Master (which was removed!). I even started changing the periods of TMR0, TMR1, etc since if this was triggering code which caused the interrupt then the period would change (it didn't). WDT and software WDT are disabled. The part is not getting reset.
 
Got it- stupid typo hidden in a supplementary module. I don't know why I didn't think to search for references to SSPIF, those files weren't supposed access it in the first place.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top