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

Modifications to access an SD card and view data via USB

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



Joined: 14 Oct 2010
Posts: 12

View user's profile Send private message

Modifications to access an SD card and view data via USB
PostPosted: Thu Oct 21, 2010 10:03 pm     Reply with quote

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

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

Re: Modifications to access an SD card via USB
PostPosted: Fri Oct 22, 2010 7:21 am     Reply with quote

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

View user's profile Send private message

Re: Modifications to access an SD card via USB
PostPosted: Fri Oct 22, 2010 8:07 am     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Sat Oct 23, 2010 2:25 pm     Reply with quote

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.
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