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 CCS Technical Support

SPI using 18LF4550 with Vdd=3.3V?

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



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

SPI using 18LF4550 with Vdd=3.3V?
PostPosted: Mon Aug 14, 2006 9:10 am     Reply with quote

Hi

I have implemented some code using SPI, and operating at Vdd=5V. This works well.
I now swapped out the PIC to a PIC18LF4550 and am trying to
make the system work with Vdd=3.3V, 4MHz Xstal.

What I find is that things do not work at this lower voltage.
I was wondering if there is anything that I should set when Vdd is not 5V but 3.3V? (e.g. something in SPI?)

Thank you in advance for your help.
a.
ckielstra



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

View user's profile Send private message

PostPosted: Mon Aug 14, 2006 9:45 am     Reply with quote

Could be something in the startup code and/or fuses settings. What is your compiler version? What does your #fuses line look like?
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Mon Aug 14, 2006 9:52 am     Reply with quote

Hi Ckielastra

My compiler version is: 3.242

My fuses look like this:

Code:

#FUSES HS, PROTECT,NOWDT, NOBROWNOUT,NOLVP
 


The setup of SPI looks like this:

Code:
setup_spi(SPI_MASTER | SPI_L_TO_H | SPI_CLK_DIV_4);


Thank you
a.
ckielstra



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

View user's profile Send private message

PostPosted: Mon Aug 14, 2006 12:04 pm     Reply with quote

I compared the startup code for v3.236 and v3.249 but didn't notice any important changes.

I don't know what your previous chip was but most likely the SPI pins have moved to different pins, double check your hardware connections. Also disable all other internal devices that share the same pins as the SPI module, especially disable the analog function for these pins.

Also add the NOPBADEN fuse to set the pins B0 and B1 for digital I/O on power up instead of analog inputs.
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Mon Aug 14, 2006 11:17 pm     Reply with quote

Hi

If the code with SPI works for Vdd=5V, should it work without modifications for Vdd=3.3V?

Thank you for your help.
a.
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Tue Aug 15, 2006 12:19 am     Reply with quote

Hi

Another weird development.
If Vdd =3.3V the SPI does not seem to initialize the MMC card.
If Vdd =5V then everything works well. (I have a V divider with resistors out of the PIC and into the card to give the card only 3.2V).

BUT if I measure the SPI Sclock (Pin B1 on the PIC18LF4550) using an Oscope probe then the system works, and data is written to the MMC.

Can anyone please tell me why the Oscope effects the results? and how can I make it work with no Oscope probe?

Thank you
a.
Ttelmah
Guest







PostPosted: Tue Aug 15, 2006 4:50 am     Reply with quote

The obvious change, will be the addition of about 30pF of capacitance. The other obvious change, will be a ground connection from the scope probe. Are you sure you have a good ground between the two units?. If so, try adding a little capacitance to the line.

Best Wshes
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Tue Aug 15, 2006 5:06 am     Reply with quote

Hi Ttelmah

Thank you for your suggestion.
I have checked and the two units are definatley on the same ground (using an ohmeter).

I am also guessing that the problem is to do with capacitance.
The MMC specifications says that the maximum bus signal line capacitance should be 250pF.
I am not sure what I have now, nor do I know how to measure it.
The specification sheet says that in the I2C mode the SCL pin has a capacitance of 400pF. I am using the same pin (PIC18LF4550 pin RB1)
for SPI SCLK. Is it possible that my capacitance on that pin is that high?
How can I reduce the capacitance on this pin?

The 30pF cap should be placed from each of the SPI lines to ground?

Once again thank you for all your help.
Regards
a.
Ttelmah
Guest







PostPosted: Tue Aug 15, 2006 6:30 am     Reply with quote

The SCL pin, does not 'have' 400pF of capacitance. It supports _driving_ up to 400pF, while meeting the timing specifications given. Your scope (if it has a normal probe), will be roughly equivalent to a 1MR resistor to ground, paralleled by a 30pF capacitance. One possibility, is that you are getting some ringing on the lines, causing problems, and this is serving to attenuate this.

Best Wishes
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