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

MSD (Mass storage device) class using PIC18F47J53

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



Joined: 29 Apr 2013
Posts: 13

View user's profile Send private message

MSD (Mass storage device) class using PIC18F47J53
PostPosted: Tue May 06, 2014 6:07 am     Reply with quote

hi all

i would like to use my PIC18F... as a mass storage device.
i've got a PIC18F.. based system with on board 1Mb eeprom 24FC1024

i need to plug it on a PC, through USB, and let the PC look at the pic as a flash drive (or even generic mass storage device) in order to load, through PC, a configuration file generated by a software. the configuration should be saved into eeprom chip.

i heard about USB MSD class, but i've seen nothing in terms of code.
do someone have any library or example to show ?

thank's a lot Wink
Ttelmah



Joined: 11 Mar 2010
Posts: 19475

View user's profile Send private message

PostPosted: Tue May 06, 2014 7:22 am     Reply with quote

I suspect your drive is not going to be big enough....

The mass storage device class has minimum size limits 1Mb is only 128KB, and is smaller than most mass storage devices supported. I'd have to go and do some research to remember the size limits, but remember Windows at least having minimum sizes it could support, and am pretty sure this is below these. Remember you are going to get a complete file system being written, not just a single file, and hence you are going to have quite a bit of work involved to read the file.
I posted the sizes here some time ago.

The size limits are the reason that MSD classes are not commonly used by a PIC. Few devices a PIC is likely to attach to, are big enough.

Best Wishes
antosci



Joined: 29 Apr 2013
Posts: 13

View user's profile Send private message

PostPosted: Tue May 06, 2014 7:52 am     Reply with quote

oh... bad news Sad

but i've heard about someone who developed an USB MSD bootloader...
i thought there's no differences between MSD bootloader and MSD for file upload... the file is about 100Byte. Sad

i did upload the file onto eeprom trough an ad hoc software. but i would like to bypass this step implementing a MSD... uhm have i got to think a different way ?

the MSD bootloader i refeered is the one from "scene double"
notbad



Joined: 10 Jan 2013
Posts: 68

View user's profile Send private message

PostPosted: Tue May 06, 2014 10:37 am     Reply with quote

I too have searched about this a couple of weeks ago and came across the scene double project.
I was looking for the functionality of "configuration file" but the boot-loader looks cool. Smile
Too bad it's for C18 and way too complicated for a mere mortal like me to port it to CCS.
I even jokingly changed some variable types and tried to compile it on CCS but I knew I was just kidding myself.
Dear Ttelmah, I'm no expert but it looks like those minimum memory requirements don't have to be physically implemented.
Ttelmah



Joined: 11 Mar 2010
Posts: 19475

View user's profile Send private message

PostPosted: Tue May 06, 2014 2:06 pm     Reply with quote

They apply, if you want to use the file systems supplied by Microsoft.
You can ignore them if you just implement the device, and then have your own code to write directly to the device.
If you are prepared to use your own code, then 'no problem'.
Problem is that once you have it as a standard device, quite a few things are likely to try to write to it, and many of these will cause issues....
notbad



Joined: 10 Jan 2013
Posts: 68

View user's profile Send private message

PostPosted: Tue May 06, 2014 2:38 pm     Reply with quote

Do you think it's possible to port that project to CCS?
Like how many hours will it take for a beginner who knows some stuff about CCS C but nothing about C18 C?
Is there any info on porting code from Microchip compilers to CCS?

Too many questions! Sorry. Embarassed
Thanks
antosci



Joined: 29 Apr 2013
Posts: 13

View user's profile Send private message

PostPosted: Tue May 06, 2014 2:59 pm     Reply with quote

i mean... if someone did it, this mean it's not impossible. it's just hard to do in CCS. am i going wrong !?
Ttelmah



Joined: 11 Mar 2010
Posts: 19475

View user's profile Send private message

PostPosted: Tue May 06, 2014 3:13 pm     Reply with quote

If it's a bootloader, then just use it...
There is never any real reason to 'port' a bootloader. Just make sure your files are configured in the layout it uses, and use it...
antosci



Joined: 29 Apr 2013
Posts: 13

View user's profile Send private message

PostPosted: Tue May 06, 2014 3:25 pm     Reply with quote

yeah, i agree with this but i don't need a bootloader. i need to load some bytes which are the configuration of the system.

Rolling Eyes
Ttelmah



Joined: 11 Mar 2010
Posts: 19475

View user's profile Send private message

PostPosted: Tue May 06, 2014 3:31 pm     Reply with quote

Remember that most bootloader's can happily load a section of the chip's memory. You don't have to overwrite all the code.
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Tue May 06, 2014 3:37 pm     Reply with quote

Quote:
i need to load some bytes which are the configuration of the system.


Why not just load it serially?
A simple text based menu that writes to eeprom would do, no?

or code a protected configuration screen (if you have onboard input divices)... as in: only accesible when the right button is pressed while maintaning 5V on a specific adc channel and between 3 and 4 pm only.... type of deal.

like an easter egg.

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
antosci



Joined: 29 Apr 2013
Posts: 13

View user's profile Send private message

PostPosted: Tue May 06, 2014 4:04 pm     Reply with quote

i did load configuration trough serial HID usb and an ad hoc software.
but now i want to load it trough USB MSD...
the last post of Ttelmah gave me to think.
i may use bootloader to load into chip's memory my config byte instead of new firmware... am i right ?
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