View previous topic :: View next topic |
Author |
Message |
antosci
Joined: 29 Apr 2013 Posts: 13
|
MSD (Mass storage device) class using PIC18F47J53 |
Posted: Tue May 06, 2014 6:07 am |
|
|
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 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Tue May 06, 2014 7:22 am |
|
|
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
|
|
Posted: Tue May 06, 2014 7:52 am |
|
|
oh... bad news
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.
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
|
|
Posted: Tue May 06, 2014 10:37 am |
|
|
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.
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: 19496
|
|
Posted: Tue May 06, 2014 2:06 pm |
|
|
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
|
|
Posted: Tue May 06, 2014 2:38 pm |
|
|
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.
Thanks |
|
|
antosci
Joined: 29 Apr 2013 Posts: 13
|
|
Posted: Tue May 06, 2014 2:59 pm |
|
|
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: 19496
|
|
Posted: Tue May 06, 2014 3:13 pm |
|
|
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
|
|
Posted: Tue May 06, 2014 3:25 pm |
|
|
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.
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Tue May 06, 2014 3:31 pm |
|
|
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
|
|
Posted: Tue May 06, 2014 3:37 pm |
|
|
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
|
|
Posted: Tue May 06, 2014 4:04 pm |
|
|
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 ? |
|
|
|