Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 28, 2024, 09:47:16 21:47


Login with username, password and session length


Pages: 1 [2]  All
Print
Author Topic: Can we make SD Card reader using PIC18F2550??  (Read 17024 times)
0 Members and 1 Guest are viewing this topic.
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #25 on: April 23, 2013, 11:56:50 11:56 »

I didnot used that i think.
Can you please upload your code.

What i think is that you are talking about microchip usb framework stack supplied by microchip.

And i am using that
Logged
Parmin
Hero Member
*****
Offline Offline

Posts: 582

Thank You
-Given: 496
-Receive: 133


Very Wise (and grouchy) Old Man


« Reply #26 on: April 24, 2013, 12:02:28 00:02 »

Use USBDVIEW to uninstall cache drivers for the device before reconnecting the USB.
Often your HID driver hang up on windows.
Logged

If I have said something that offends you, please let me know, so I can say it again later.
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #27 on: April 24, 2013, 02:42:42 02:42 »

I un-installed many drivers related to usb with the software you told.

Then when i connect my device it is searching for drivers.
 Sad
Operating system search for microchip mass storage device and then install driver.

After sometime the drive i appears in the windows explorer and after that it disappear.
What should i do know.

It appears for seconds and then disappears.
Sad
« Last Edit: April 24, 2013, 02:48:13 02:48 by xpress_embedo » Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #28 on: April 24, 2013, 07:09:33 07:09 »

I tried this in windows xp
It is showing the the drive but doesnt show anythibg else


I tries to observe the spi pins on oscilloscope and found that no pin is changing its status except the chip select pin.
Why my spi is not working.
I am using the code tempelate of microcjip usb framework is there any bug or i am doing it wrong
Logged
avrlover
Active Member
***
Offline Offline

Posts: 115

Thank You
-Given: 50
-Receive: 219


« Reply #29 on: April 24, 2013, 07:27:45 07:27 »

source code for an1003
http://ww1.microchip.com/downloads/en/AppNotes/MCHPMSD.zip
Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #30 on: April 24, 2013, 09:21:54 21:21 »

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.


in picture attached at your post I can observe that in simulation log appear MMC unsupported command. Mass storage device driver is a generic protocol for manage memory platforms, this is did over USB driver. So, your connection with mmc/sd card can not work correctly but in windows will appear your card drive (because this is just something virtual).

Also in  C:\Program Files\Labcenter Electronics\Proteus 7 Professional\SAMPLES\VSM for USB\PICDEM FS USB\MSD  is the PIC18F4550 project example for what you need using without any modify application note AN1003. you can view there is no any log error with mmc commands
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #31 on: April 25, 2013, 02:47:23 02:47 »


When i build this project i get an error.

C:\MCHPMSD\MSD\system\Compiler.h:241:Error [1034] previous definition of macro 'STKOVF' does not agree


I comment this line
#define STKOVF              STKPTRbits.STKFUL

In the compiler.h header file and it gets compiled

After that i check the Configuration Settings of the hex file, it is for 48Mhz Crystal.
Then in code i didn't find where are configuration settings written.

Then i write manual the configuration settings in the main.c file

/****Configuration bits****/
#pragma config PLLDIV   = 5       
#pragma config CPUDIV   = OSC1_PLL2 
#pragma config USBDIV   = 2       
#pragma config FOSC     = HSPLL_HS
#pragma config FCMEN    = OFF
#pragma config IESO     = OFF
#pragma config PWRT     = OFF
#pragma config BOR      = OFF
#pragma config VREGEN   = ON
#pragma config BORV     = 3
#pragma config WDT      = OFF
//#pragma config WDTPS    = 32768
#pragma config MCLRE    = ON
#pragma config LPT1OSC  = OFF
#pragma config PBADEN   = OFF
#pragma config STVREN   = ON
#pragma config LVP      = OFF
#pragma config XINST    = OFF       // Extended Instruction Set


Then Microchip Mass Storage Device Detected and Drive I: Appears in the Windows Explorer, but doesn't get open.


Posted on: April 25, 2013, 03:42:12 03:42 - Automerged

Also in  C:\Program Files\Labcenter Electronics\Proteus 7 Professional\SAMPLES\VSM for USB\PICDEM FS USB\MSD  is the PIC18F4550 project example for what you need using without any modify application note AN1003. you can view there is no any log error with mmc commands

This is always shown in proteus, but in my earlier projects related to mmc but it works without any error.

And i am testing this all on real hardware and they are not working.

The the Demo Given by Proteus is AN1003 Application Note.
The hex file in that folder of Proteus Sample works for my board :-)

But i use pic kit 3 to program my board, as soon as i remove the pik kit 3
Unrecognized USB Found, and i connected and system restarted it works. :-(
Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #32 on: April 25, 2013, 06:57:35 18:57 »

Can you put here a picture with your project schematic and the simulation log window opened?
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #33 on: April 27, 2013, 03:57:44 03:57 »

The Schematic i am using is Similar to PICDEMFS Board.

There are two that i am trying to run one is the one i modified the SD Card reader of PIC1847J53 for PIC18F4550.
It stops in proteus at some instance.

And then the second one with the application note AN1003 is moving further but not producing the result on proteus and not on Real Hardware.
Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #34 on: April 27, 2013, 02:41:22 14:41 »

I ask you for simulation log and not for usb log. there is important if the MMC card receive good commands
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #35 on: April 27, 2013, 05:35:58 17:35 »

I am attaching the Snapshot of the Simulation Log, of proteus
One with the code in Application Note AN1003, this is showing no Error except a warning indicating excessive CPU Load

and while the Modified SD Card Demo is Showing
Two Unsupported Commands, which i had seen many times before, i think here it is topping the execution of process.
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #36 on: May 01, 2013, 02:38:51 02:38 »

Is there any solution for this..

The PIC18F4550 and even the project with PIC18F47j53 both are not working, they both are showing Microchip Mass Storage Device in the Windows Device Manager but not showing any drive in windows explorer.

And one of the best part with PIC18F4550 and Application Note Source code AN1003.
Lab-center Electronics Said that they didn't modified the source code of AN1003 and puts directly it in the sample design of pic18f4550 mass storage application.
But when i put that code, it didn't work.
Anyways this is all about proteus, lets discuss some real hardware stuff.

I put the hex file given in proteus into my PIC18F4550, in its configuration bits 48Mhz Oscillator is set.

I import the hex file in MPLAB and then Select PIC KIT 3 as my programmer and after that i change the configuration bits in MPLAB to meet my board requirement i.e 20Mhz Crystal.

And it works :-)
But as soon as i disconnect my pic kit 3 it stops working.
This is really strange.
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #37 on: May 02, 2013, 04:06:35 16:06 »

Finally some good news.

I finally made hardware for PIC18F47J53 Micro-controller as per there SD Card Reader Demo, as per circuit diagram below.

When I didn't connect the VDDCORE/Vcap and Vusb pin with nothing, similar affect happens as i am facing with pic18f4550.

When as soon as connecting these pins with +3.3V everything is working fine, mass storage is detected and a drive is shown in windows explorer with all the files present in it.
But the speed is really very slow, it is working but very slowly, but it is okay with me.

Now can anyone tell me the significance of these pins VDDCORE/Vcap and Vusb

and in PIC18F4550 based hardware i had connected Vusb pin to ground with a capacitor of 220pF in between.
I am going to give it a +5V or +3.3V after reading sufficient details about this pins.

Please suggest me something..
Logged
Catcatcat
Senior Member
****
Offline Offline

Posts: 432

Thank You
-Given: 284
-Receive: 1654



WWW
« Reply #38 on: May 04, 2013, 03:59:26 15:59 »

Maybe this link will be useful
FatFs is a generic FAT file system module for small embedded systems. The FatFs is written in compliance with ANSI C and completely separated from the disk I/O layer. Therefore it is independent of hardware architecture. It can be incorporated into low cost microcontrollers, such as AVR, 8051, PIC, ARM, Z80, 68k and etc..., without any change.

Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #39 on: May 07, 2013, 06:35:46 18:35 »

I solved my problem,
Everything is working properly.

I just connect a 3.3V to VUSB pin in PIC18F4550 and my code starts working.
But still not able to know why msd class did work when i connected 3.3v to Vusb.

As i had not done all this with cdc and hid class
Logged
LithiumOverdosE
Senior Member
****
Offline Offline

Posts: 361

Thank You
-Given: 383
-Receive: 588


« Reply #40 on: July 14, 2013, 02:25:50 02:25 »

I'm a bit late but if somebody needs original Labcenter SD Card images and tool they used to manipulate them here they are.  Wink

Note to mods:

You might as well move this post to Proteus models and libraries section. I suspect it will be forgotten here and it could be useful to somebody.
Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #41 on: July 14, 2013, 06:49:54 06:49 »

post it there then.
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #42 on: August 14, 2013, 04:08:47 04:08 »

I am making new SD Card Reader Project using PIC32MX795F512L, but it is having the same problem which i am getting with my previous PIC18F2550, even its VUSB3V3 line is connected to 3.3V.

I had connected the VBUS to the supply coming from USB Port of computer and i am using SPI2 Port for interfacing memory card with PIC32

Please have a look at my code and if someone knows what is the problem with this, i think its in my hardware but dont, know that exactly.
« Last Edit: August 14, 2013, 05:08:18 05:08 by xpress_embedo » Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #43 on: August 14, 2013, 09:37:40 09:37 »

I am using mikroc for PIC32 example for Mass Storage Class Example.

It is working fine with the same hardware, while the above code is not.
« Last Edit: August 14, 2013, 10:37:51 10:37 by xpress_embedo » Logged
gan_canny
Junior Member
**
Offline Offline

Posts: 89

Thank You
-Given: 101
-Receive: 26


« Reply #44 on: August 15, 2013, 02:47:35 14:47 »

Vusb
The PIC chips with usb have the equivalent of two processing components. Since usb is very very timing critical it has a separate clocking component within the PIC. The PIC instruction set also needs timing. Since for the usb timing ( absolute 32 Mhz)  is most critical this clock is essentially considered primary and the PIC lock is derived from it. Vusb can impact the usb timimg ( and therefore the PIC) and is usually connected through a capacitor to ground. I always use 0.47uf but it isn't critical but too small a value won't sufficiently absorb stray ground issues ( electrons on the loose) coming in from the usb connector ; too large a value and it won't react fast enough. Usb is a differential signal but it still needs a well behaved ground. Now a usb connector's pins are designed in such a way as to have the power connect before the D- D+ when manually being inserted into a USB socket.
Likewise on disconnect the power comes of last. Depending on the code you write for the pic  you may need to address this to discover if you ) a slave) are still plugged into the master.

///     Vusb ------| |----- GND
////               0.47uf
//                             100k
//        5V    VBUS-----+----/\/\/\/\/\----- (USB_CON_SENSE_PIN ON PIC PIN_B5)
//                     |
//                     +----/\/\/\/\/\-----GND
//                             100k
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #45 on: August 16, 2013, 07:40:25 07:40 »

Thanks for your help,

But the problem was in my software.

Correct the Hardware Profile.h as follow:-
Code:

    #define putcSPI             putcSPI2
    #define getcSPI             getcSPI2
    #define OpenSPI(config1, config2)   OpenSPI2(config1, config2)

I am using SPI1 instead of SPI2 now it is working.

gan_canny you are saying that i have to connect the VUSB3V3 to ground with a CAP, i found this too in the datasheet of PIC32.

But in USB Starter Kit 2 Manual they had connected this Pin to PIC32_VDD which means to 3.3V

and it is working with both, either connecting that pin to ground using cap or connecting that pin to Supply.
Both Works.
« Last Edit: August 16, 2013, 08:05:49 08:05 by xpress_embedo » Logged
Pages: 1 [2]  All
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC