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

ramtron driver in code section

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



Joined: 30 Oct 2003
Posts: 24
Location: skegness

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

ramtron driver in code section
PostPosted: Wed Jan 04, 2006 7:16 am     Reply with quote

i have the ramtron driver from the code section
i am using an 18f2680 with 8mhz xtal and pll turned on so i have a clock of 32mhz, i am using the #use i2c with fast selected.
my #use delay ( clock=32000000)
what speed will the i2c to the ramtron be running at.
i am assuming it is the 400khz ( fast ) speed.
how do i crank it up to the max ( or faster than 400khz ) assuming its currently going at 400khz.
the ramtron 24xx256 will according to the specs go up to 1mhz
i am assuming it can be done.

Sad
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Jan 04, 2006 8:39 am     Reply with quote

From the release notes on the CCS website:
Quote:
3.215 #USE I2C now allows the speed to be set in BPS using FAST=xxxxxxx


From the readme.txt:
Quote:
The #USE I2C now allows the speed to be adjusted. For example:
#USE I2C(MASTER, SCL=PIN_B0, SDA=PIN_B1, FAST=450000 )
Sets the target speed to 450 KBSP.


I haven't tried this functionality and don't know what the maximum frequency is you can define but apparently faster than 400kBps.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

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

PostPosted: Wed Jan 04, 2006 9:19 am     Reply with quote

I wrote that driver.
Let me know if there is a correction/optimization.


Last edited by treitmey on Wed Jan 04, 2006 4:19 pm; edited 1 time in total
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

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

PostPosted: Wed Jan 04, 2006 12:01 pm     Reply with quote

..

Last edited by treitmey on Wed Jan 04, 2006 4:20 pm; edited 1 time in total
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

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

PostPosted: Wed Jan 04, 2006 12:41 pm     Reply with quote

..

Last edited by treitmey on Wed Jan 04, 2006 4:18 pm; edited 1 time in total
lewiseley



Joined: 30 Oct 2003
Posts: 24
Location: skegness

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

ramtron
PostPosted: Wed Jan 04, 2006 1:29 pm     Reply with quote

Very Happy
thanks for that, i just set fast=1000000 and hey presto it seems to of have
changed.

i looked at my dissasembly listing,at the start of Main(), and noted i had a
movlw 0x13
movwf 0xfc8 ( fc8=sspadd == brg )
that was for a 400 khz
changed fast=500000
and i got a
movlw 0x0f
movwf 0xfc8
changed fast=1000000
and got
movlw 0x07
movwf 0xfc8

havent run it yet, but it looks promising
by the way i am using force_hw
lewiseley



Joined: 30 Oct 2003
Posts: 24
Location: skegness

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

further tests
PostPosted: Wed Jan 04, 2006 2:06 pm     Reply with quote

Sad
tested it at fast=1000000

seemed to work

so i scoped the scl pin
found i had a seriously deformed waveform ( sawtooth ) but the period was only 1.75uS = 571 khz ( dissapointed i am )
so tried fast=2000000 ( which dropped my fc8 value to 0x03 )
but my scope will not display it. (its old and decrepid)

not sure what to do now.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 04, 2006 2:43 pm     Reply with quote

Quote:
I had a seriously deformed waveform ( sawtooth )

1. What about the Slew Rate Control bit ? The compiler has it enabled.
This could be part of the reason for the sawtooth waveform.
Set bit 7 of the SSPSTAT register (0xFC7) to 1, to disable Slew rate
control.

2. Another reason could be that your pull-ups are too large.
What value are you using now ? Try using 1.8K pull-ups.
(for i2c running at 5 volts in fast mode).

Here is a listing which shows how the compiler sets up the Slew Rate
control bit in the SSPSTAT register.
Quote:
00022: CLRF FF8
00024: BCF FD0.7
00026: CLRF FEA
00028: CLRF FE9
0002A: BSF F94.3
0002C: BSF F94.4
0002E: MOVLW 07 // Enable 1 MHz baud rate
00030: MOVWF FC8
00032: MOVLW 28
00034: MOVWF FC6
00036: BCF FC7.7 0 = Slew rate control is enabled.
00038: BCF FC7.6
0003A: MOVF FC1,W
0003C: ANDLW C0
0003E: IORLW 0F
00040: MOVWF FC1
lewiseley



Joined: 30 Oct 2003
Posts: 24
Location: skegness

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

more tests
PostPosted: Wed Jan 04, 2006 2:51 pm     Reply with quote

Sad
took out the force hardware, fast still at 1000000
ran it and scoped it, even worse still, wave form was a bit better but the scl period was 3.4uS=294Khz.

so put force_hw back in, changed fast=1500000
ran it, scoped it.
scl period is 1.3uS=769Khz. fc8 value was 0x04.

hanged fast=1800000, fc8 value of 0x03.
scl period=1.2uS=833Khz.

i will test this further.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

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

PostPosted: Wed Jan 04, 2006 3:10 pm     Reply with quote

From 18F452 manual
Quote:
SMP: Slew Rate Control bit
In Master or Slave mode:
1 = Slew rate control disabled for Standard Speed mode (100 kHz and 1 MHz)
0 = Slew rate control enabled for High Speed mode (400 kHz)


Standard speed is 100k or 1M ??? is that right??
then they want slew rate control for high speed at 400k which is slower than the 1M. This is confusing to me.

So... If we want scl @ 1MHz is this standard or high speed? and
Do we want slew rate control? I thought we'd want slew rate control when running really fast.


Last edited by treitmey on Wed Jan 04, 2006 4:23 pm; edited 1 time in total
lewiseley



Joined: 30 Oct 2003
Posts: 24
Location: skegness

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

im going home so here is results of 4th jan 2006
PostPosted: Wed Jan 04, 2006 3:42 pm     Reply with quote

this works
fast=2500000
( 0xfc8=0x02 )
slew rate turned off
vpullup now 2k, didnt have any 1.8k so used 2X1k ( i am using picdem2 board )
ramtron is smd device soldered piggyback onto 18f2680 ( through hole)
connecting wires no longer than 2cm.

scoped scl line, period is 960ns=1.041666 MHz

waveform is still bad ( exponential curve rising, square trailing edge )

my app wrote data to various address's in the ramtron, which it could then read back- how many errors occurred during the process i dont know.
i will continue tomorrow.
thanks for all the help
speak to you tomorrow.
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