View previous topic :: View next topic |
Author |
Message |
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
PLL 40Mhz Problem |
Posted: Mon Sep 17, 2007 10:39 pm |
|
|
Hi,
In my design I use a EEPROM 24LC512 (Microchip) and FLASH M25PE80 (ST). When I set my code in H4 40Mhz I cannot write and read to the memory, and when I set to HS 10Mhz the memory work fine.
Can any help me?, where is the problem?
FUSE H4
#fuses H4, WDT4096, PROTECT, NOLVP
#use delay( clock=40000000 )
FUSE HS
#fuses HS, WDT4096, PROTECT, NOLVP
#use delay( clock=10000000 )
Thank you very much!!
Best Regards, |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
|
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
|
Posted: Tue Sep 18, 2007 12:13 pm |
|
|
The only problem is with the memory, with other devices (LCD, Keyboard, etc.) work fine to 40Mhz. We are use 18F8722 with the last version of CCS.
The problem is that is too fast 40mhz for the memory?
Thanks for help me.
Best Regards, |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 18, 2007 12:18 pm |
|
|
If you are using the delay_cycles() function, the delay time will depend
on the oscillator speed.
delay_cycles(1) is only 100 ns with a 40 MHz oscillator.
With a 10 MHz oscillator, it's 400 ns.
To fix this problem, you could change it to: delay_us(1)
Then it would stay at 1 us, if the oscillator is 10 MHz or 40 MHz. |
|
|
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
|
Posted: Tue Sep 18, 2007 2:22 pm |
|
|
PCM,
In my EEPROM routines not use delay, we wait for the ACK from the I2C.
void EEPROM_WaitACK( int iPage )
{
do
{
i2c_start( );
}while( i2c_write( iPage ) );
i2c_stop( );
}
Another Idea???????? |
|
|
Miniman
Joined: 30 Apr 2007 Posts: 44
|
|
Posted: Sat Sep 29, 2007 1:46 pm |
|
|
Can you please send me your code for the M25PE80 chip? I also have that chip, but I have not got it to work... I would be very thankful!
Best regards
Miniman |
|
|
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
|
Posted: Tue Oct 02, 2007 2:31 pm |
|
|
in the ST site are the source code for the memory. My company not permit send the code.
Best Regards, |
|
|
|