View previous topic :: View next topic |
Author |
Message |
Nopnop
Joined: 10 Aug 2007 Posts: 7
|
problems with timer x on 18F452 |
Posted: Fri Feb 08, 2008 5:30 pm |
|
|
hello,
we have a problem with timer.
I use 2 pics 18F452 and a FRAM from Ramtron FM24C512.
This components communicate with I2C in Multimaster Mode :
18F452 (1) (master) <--> FRAM <--> 18F452 (2) (master)
with a little program (just I2C), the Multimaster Mode function great.
No bus collision.
I can write in FRAM with pic (1) and with pic (2).
I can read in FRAM with pic (1)) and with pic (2).
And so i can receive data on pic (1) from pic (2) by the FRAM.
... etc...
But when i introduce 1 timer interrupt, I2C is stopped !
I can see pic (1) and pic (2) function, because i can see 2 flicker leds with timer...
So, Do you known any incompatibility between the I2C bus and the timer's interrupt ?
I have tested the interrupt's priority, but without result...
thanks for your idea...
(excuse me for my poor english...) _________________ made by www.nopnop.fr |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 08, 2008 7:37 pm |
|
|
Modify your i2c routines to disable interrupts while inside those routines.
Do this on all your fram i2c access routines, and see if it fixes the problem.
Example:
Quote: | void write_fram(int16 address, int8 data)
{
disable_interrupts(GLOBAL);
i2c_start();
i2c_write(0xa0);
i2c_write(address >> 8);
i2c_write(address);
i2c_write(data);
i2c_stop();
enable_interrupts(GLOBAL);
} |
|
|
|
|