xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« on: April 10, 2013, 02:39:07 02:39 » |
|
Hello!! Everyone.
In proteus samples section, i had seen one mass storage device example using PIC18F4550.
But now the Microchip Application Libraries doesn't support this project.
So can we make a Mass Storage Device SD card Reader using PIC18F4550 or PIC18F2550.
As i saw one project in Microchip Application Library USB Section, which shows MSD but for internal flash of PIC18F4550.
But i need to do it for SD Card. Is it possible?? If yes then suggest me how can i do this.
|
|
|
Logged
|
|
|
|
Parmin
Hero Member
Offline
Posts: 582
Thank You
-Given: 496
-Receive: 133
Very Wise (and grouchy) Old Man
|
|
« Reply #1 on: April 10, 2013, 03:14:33 03:14 » |
|
I believe PIC18 starter kit would include such example.
You should be able to download the codes and schematic from Microchip.
|
|
|
Logged
|
If I have said something that offends you, please let me know, so I can say it again later.
|
|
|
|
flo0319
Junior Member
Offline
Posts: 81
Thank You
-Given: 7
-Receive: 17
|
|
« Reply #3 on: April 10, 2013, 05:57:09 17:57 » |
|
You need to download first Microchip Application Library from link give by happylex. After you have installed it, you need to go in the [installed folder \ USB \ Device - Mass Storage - SD Card reader] there is a project for 18F46J50, you can adapt it for 18F2550 easy
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 188
Thank You
-Given: 257
-Receive: 322
|
|
« Reply #4 on: April 10, 2013, 07:29:32 19:29 » |
|
- Use this project: “C:\Microchip Solutions v2013-02-15\PIC18F Starter Kit 1\Demos\USB Device - Mass Storage - SD Card reader\MSD - SD Card Reader - Firmware”. - Change the file ‘HardwareProfile - PIC18F Starter Kit.h’ according to your board. Include in this file the following definition: ‘#define PICDEM_FS_USB”. This will set the correct configuration bits in code. - Create the linker file according to application note AN1003. - Check the function ‘static void InitializeSystem(void)’ for any necessary code change.
If I don’t miss anything this should be enough.
Remember that if you don’t use the LF version then you need to add some voltage translators in your circuit.
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #5 on: April 11, 2013, 05:45:48 17:45 » |
|
Thanks for your replies. I modified the PIC18F47J53 SD Card Reader Project. Right now i am changing it for PIC18F4550, after so many errors, i am getting one last error. And it is associated with Linker. MPLINK 4.40, Linker Device Database Version 1.3 Copyright (c) 1998-2011 Microchip Technology Inc. Error - could not find definition of symbol 'GetInstructionClock' in file 'Objects\47J53_PIM\SD-SPI.o'. Errors : 1
I am also getting one warning while compiling Call of function without prototype and it is associated with this function void Delayms(BYTE milliseconds) { BYTE ms; DWORD count; ms = milliseconds; while (ms--) { count = MILLISECDELAY; while (count--); } Nop(); return; }
I am not getting what is the problem, it is related with instruction cycle, but i am not getting how to solve this
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 188
Thank You
-Given: 257
-Receive: 322
|
|
« Reply #6 on: April 11, 2013, 05:50:52 17:50 » |
|
Put here a zip file with the project. I can correct the errors.
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #7 on: April 12, 2013, 01:57:03 01:57 » |
|
I am uploading my project in zip folder pls have a look at it.
And correct the errors i am getting in this.
The project file is located here "\SD_Card Reader PIC18F2550\Microchip Solutions v2011-12-05\USB\Device - Mass Storage - SD Card reader\Firmware"
In this project, at some places it is written pic18f2550, but it is for pic18f4550 at the moment. Please don't confuse with that.
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 188
Thank You
-Given: 257
-Receive: 322
|
|
« Reply #8 on: April 12, 2013, 09:56:43 09:56 » |
|
It’s done. Just add the GetSystemClock() and GetInstructionClock() definitions in the file ‘HardwareProfile - PIC18F2550.h’<line 158>: #define GetSystemClock() CLOCK_FREQ #define GetInstructionClock() (GetSystemClock() / 4)
|
|
« Last Edit: April 12, 2013, 10:03:07 10:03 by motox »
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #9 on: April 12, 2013, 05:12:59 17:12 » |
|
Hello!! Thanks that works..
When i simulate the Project in Proteus, the MSD is detected by PC but no pen drive is detected. What is the reason behind this
I am getting some driver issue. Pls have a look at the image.
Posted on: April 12, 2013, 06:10:50 18:10 - Automerged
If possible, pls run the simulation on your pc and checks whether it is running or not.
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 188
Thank You
-Given: 257
-Receive: 322
|
|
« Reply #10 on: April 12, 2013, 05:20:33 17:20 » |
|
Run the attached program, select the USB device and post the resulting print screen.
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #11 on: April 12, 2013, 05:36:08 17:36 » |
|
I am running the proteus simulation and nothing happens this time also. And nothing appear in the application you give to me.
Here are the snapshot.
|
|
|
Logged
|
|
|
|
motox
Cracking Team
Active Member
Offline
Posts: 188
Thank You
-Given: 257
-Receive: 322
|
|
« Reply #12 on: April 12, 2013, 06:31:15 18:31 » |
|
I never used Proteus and I don’t trust it. Try to debug the problem. Start to check the value of the variable ‘USBDeviceState’. It’s like a state machine that tells you the USB connection status.
|
|
|
Logged
|
|
|
|
flo0319
Junior Member
Offline
Posts: 81
Thank You
-Given: 7
-Receive: 17
|
|
« Reply #13 on: April 12, 2013, 08:02:19 20:02 » |
|
In proteus is implemented a MMC card and not a SD card, it's a difference between commands(initialization and addressing data) for manage these type of cards.
|
|
|
Logged
|
|
|
|
#tester
Newbie
Offline
Posts: 8
Thank You
-Given: 1
-Receive: 15
|
|
« Reply #14 on: April 12, 2013, 10:30:04 22:30 » |
|
and where is the data file for your formatted SD Card, virtual or real. without a formatted card you can't read/or/write..
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #15 on: April 13, 2013, 03:26:06 03:26 » |
|
I never used Proteus and I don’t trust it. Roll Eyes Try to debug the problem. Start to check the value of the variable ‘USBDeviceState’. It’s like a state machine that tells you the USB connection status.
Ok i will check that, and will also run the code on real hardware, but after two days, as i am not having that board right now. In proteus is implemented a MMC card and not a SD card, it's a difference between commands(initialization and addressing data) for manage these type of cards. Proteus has a mmc card not sd card, but the code will work for both card, as i had tested that earlier when experimenting with MDD Library and PIC18F8722 Project Example, it successfully create file in the card. and where is the data file for your formatted SD Card, virtual or real. without a formatted card you can't read/or/write.. There is a Software WinImage, by the help of which i create Memory Card image of 2MB for my MMC Card in Proteus. It is not working with this project, but had worked in proteus earlier when i experiment with MDD Library project. Posted on: April 13, 2013, 03:59:12 03:59 - Automerged
One strange thing. When i run the PIC18F47J53 SD Card Reader Project in Proteus it working fine, but the one with PIC18F2550 Even i changed nothing in this.
|
|
|
Logged
|
|
|
|
happylex
Newbie
Offline
Posts: 17
Thank You
-Given: 7
-Receive: 3
|
|
« Reply #16 on: April 21, 2013, 03:05:42 15:05 » |
|
You can try to debug in the simulation. I have seen it is possible for AVR and even Arduino code when using the .elf file, and it looked like a debugger with all the possible options the hardware debuggers also have.
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #17 on: April 21, 2013, 04:43:50 16:43 » |
|
What should i debug, means what should i do, so that i can get to know where is the problem.
And i am making a real hardware and will try to implement it on that and will check the transaction in usblyzer software.
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #18 on: April 22, 2013, 05:32:32 17:32 » |
|
Finally i tested my code on real hardware. What i found is Microchip Mass Storage Device detected successfully but nothing happens means i am not able to view the Removable Disk Drive as supposed to be.
Posted on: April 22, 2013, 06:31:16 18:31 - Automerged
No Disk Drive appears, :-(
What should i do now.
I am also attaching UVC View Software Snapshot when this device is connected.
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #19 on: April 23, 2013, 03:22:00 03:22 » |
|
Have a look at this, it is showing I drive means some thing is there, but nothing appears in windows explorer
|
|
|
Logged
|
|
|
|
avrlover
Active Member
Offline
Posts: 115
Thank You
-Given: 50
-Receive: 219
|
|
« Reply #20 on: April 23, 2013, 07:10:19 07:10 » |
|
here is application note from microchip might help u
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #21 on: April 23, 2013, 07:18:10 07:18 » |
|
I had read that application note. But not able to solve my problem. I dont know why this happen. As device manager us showing microchip mass storage device but not showing the drive.
|
|
|
Logged
|
|
|
|
avrlover
Active Member
Offline
Posts: 115
Thank You
-Given: 50
-Receive: 219
|
|
« Reply #22 on: April 23, 2013, 07:40:45 07:40 » |
|
I have use code an1003 in Proteus it shows drive letter but drive is not accessible try your this code in Proteus i am using windwos xp sp3
|
|
|
Logged
|
|
|
|
xpress_embedo
Active Member
Offline
Posts: 173
Thank You
-Given: 122
-Receive: 254
|
|
« Reply #23 on: April 23, 2013, 10:47:11 10:47 » |
|
When i remove the memory card. It is showing the drive in windows explorer . When memory card is inserted nothing appears in windows explorer.
I am not getting what is tge problem. Can anyone check my linker file fir pic18f4550.
Posted on: April 23, 2013, 11:46:01 11:46 - Automerged
My code is not working in priteus as i had stated in my earlier post
|
|
|
Logged
|
|
|
|
avrlover
Active Member
Offline
Posts: 115
Thank You
-Given: 50
-Receive: 219
|
|
« Reply #24 on: April 23, 2013, 11:18:10 11:18 » |
|
so u can use code supplied by microchip an1003
|
|
|
Logged
|
|
|
|
|