|
|
View previous topic :: View next topic |
Author |
Message |
luis.rigoni
Joined: 14 Oct 2010 Posts: 12
|
Modifications to access an SD card and view data via USB |
Posted: Thu Oct 21, 2010 10:03 pm |
|
|
Hello,
This question may sound noob, but ... how do I modify the example "ex_fat.c" to work with the PIC18F4550 and USB?
--> EDIT: Maybe I expressed myself wrong. I want the PIC to communicate with the SD card via the SPI interface, of course. But instead of the PIC to communicate with PC via RS232 I want it via USB.
I'm having problems with errors of lack of RAM memory for the variables when I replace with #include <18F4550.h> and add #include <usb_cdc.h>.
Apart from includes, also modified the connecting pins, which were as follows:
Code: | # Define MMCSD_PIN_SCL PIN_B1 / / o
# Define MMCSD_PIN_SDI PIN_B0 / / i
# Define MMCSD_PIN_SDO PIN_C7 / / o
# Define MMCSD_PIN_SELECT PIN_C6 / / o |
The other settings are:
Code: | //configure a 20MHz crystal to operate at 48MHz
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000) |
CDC is the best choice for communication? The declaration #use rs232 needs to be maintained even when using the USB?
The compiler version is 4.093
Thanks in advance
Last edited by luis.rigoni on Fri Oct 22, 2010 8:10 am; edited 2 times in total |
|
|
collink
Joined: 08 Jan 2010 Posts: 137 Location: Michigan
|
Re: Modifications to access an SD card via USB |
Posted: Fri Oct 22, 2010 7:21 am |
|
|
Is there some extenuating circumstance that prevents you from using the built in SPI interface on that chip to directly talk with the SDCard?
That would seem easier than trying to get an sdcard to work through a USB adapter (after all, SDCards do NOT speak USB. They need an adapter/converter to do that)
luis.rigoni wrote: | Hello,
This question may sound noob, but ... how do I modify the example "ex_fat.c" to work with the PIC18F4550 and USB?
I'm having problems with errors of lack of RAM memory for the variables when I replace with #include <18F4550.h> and add #include <usb_cdc.h>.
Apart from includes, also modified the connecting pins, which were as follows:
Code: | # Define MMCSD_PIN_SCL PIN_B1 / / o
# Define MMCSD_PIN_SDI PIN_B0 / / i
# Define MMCSD_PIN_SDO PIN_C7 / / o
# Define MMCSD_PIN_SELECT PIN_C6 / / o |
The other settings are:
Code: | //configure a 20MHz crystal to operate at 48MHz
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000) |
CDC is the best choice for communication? The declaration #use rs232 needs to be maintained even when using the USB?
The compiler version is 4.093
Thanks in advance |
|
|
|
luis.rigoni
Joined: 14 Oct 2010 Posts: 12
|
Re: Modifications to access an SD card via USB |
Posted: Fri Oct 22, 2010 8:07 am |
|
|
Maybe I expressed myself wrong. I want the PIC to communicate with the SD card via the SPI interface, of course. But instead of the PIC to communicate with PC via RS232 I want it via USB. |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Sat Oct 23, 2010 2:25 pm |
|
|
Seems you may have a two part task. First look at the USB example it essentially writes and reads bytes to and from a PC. Next you have the SD card interface and a file system. The reads and writes bytes to the SD card.
Now you combine the two. You may face fun issues in doing so but it will be a great learning experience. |
|
|
|
|
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
|