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

PLL 40Mhz Problem

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



Joined: 18 Oct 2003
Posts: 145

View user's profile Send private message

PLL 40Mhz Problem
PostPosted: Mon Sep 17, 2007 10:39 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 18, 2007 2:11 am     Reply with quote

Which processor are you using?

Are you sure your processor is running at 40MHz? In order for the PLL to be enabled you have to power down the chip once, see also:
http://www.ccsinfo.com/forum/viewtopic.php?t=20325
http://www.ccsinfo.com/forum/viewtopic.php?t=23829
cfernandez



Joined: 18 Oct 2003
Posts: 145

View user's profile Send private message

PostPosted: Tue Sep 18, 2007 12:13 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 18, 2007 12:18 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 18, 2007 2:22 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 29, 2007 1:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 02, 2007 2:31 pm     Reply with quote

in the ST site are the source code for the memory. My company not permit send the code.

Best Regards,
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