View previous topic :: View next topic |
Author |
Message |
Guest
|
18f452 to 18f4520 migration problem (SPI/SD Card) |
Posted: Sat Apr 05, 2008 5:14 pm |
|
|
Hi all!
I have a program using SPI to read data from an SD card which works perfectly on a pic18f452. I changed for a 4520 and am now using the internal oscillator with PLL (32Mhz) instead of an external 20Mhz crystal.
I changed the code to initialize the PIC, and the PIC indeed works at the right frequency, but the SD card part is no longer working.
I did not found any informations on the migration documents from microchip relative to SPI.
Does anyone have an idea what could cause this?
Are there things I missed in the migration docs?
Thanks |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sat Apr 05, 2008 7:31 pm |
|
|
Does the SD card work when you select a lower clock frequency? For example the 16MHz with internal oscillator should be easy to check as it requires only a software change. |
|
|
Guest
|
|
Posted: Sun Apr 06, 2008 4:48 am |
|
|
I tried soldering a 20Mhz crystal and setting config back to what it was originally, but it didn't change anything... |
|
|
Guest
|
|
Posted: Sun Apr 06, 2008 5:56 am |
|
|
Well finally it works...
It was no software problem, but hardware: There was a junction between one SPI wire and ground because of a small desolder bread wire stuck in....
Thanks for trying to help though! |
|
|
csuszo
Joined: 01 May 2008 Posts: 1
|
Please help me |
Posted: Thu May 01, 2008 7:59 am |
|
|
I'm having troubles to set my intosc on 32MHz can you help me how did you do that? |
|
|
nicorosen
Joined: 25 Oct 2010 Posts: 2
|
|
Posted: Sat Nov 27, 2010 2:23 pm |
|
|
csuszo, I'm using a PIC18F4520 with internal oscillator @ 32MHz.
All you need is to set the fuses and configure the clock.
This is the code I used and worked well:
Code: |
#INCLUDE <18F4520.h>
#FUSES INTRC_IO,NOWDT,PUT,NOWRT
#USE delay(internal=32mhz)
|
|
|
|
|