Hi anybody here that can help me with some code made in mikroC compiler?
Im using this compiler becase of its MMC FAT16 lib..
But its not working (at least not for me)
Hi anybody here that can help me with some code made in mikroC compiler?
Im using this compiler becase of its MMC FAT16 lib..
But its not working (at least not for me)
The best is yet to come
Good enough - its perfect !!
2 Gig of free online backup space![]()
cq cq de LA3BNA
I might be able to help you ... I have v8.0 and I managed to use fat16 library ...
The important note about it thoe is
1. you have to format the MMC/SD card on the PC (the format routine actually does not format the card, but just clear fat table)
2. it is fat16 library *only* meaning if you for e.g. use 32MB MMC card it will *NOT* work, because it is formated using fat12 (I spent 2 days on this until I figured it out and tried 1G card)
If you are trying with the "small" card like I did (fat12) you can write "raw data" to card (sectors) and then use some raw read sw on PC to read the data ...
Bits From Bytes - the best RepRap kit out there now featuring RepRap V3 with full electronics redesign based on PIC32MX440F256H (English)
MySQL Blog (Serbian)
Elco Blog (Serbian)
Use forum to ask questions, do not use PP
No im using a 1G (SD)card but i cant seem to get anything on it.
I have tried to implement the quick format but with no luck (i will keep trying)
And using the help file have only confused me (well a bit cos its using portb in code and portc on the schematic example)
The best is yet to come
Good enough - its perfect !!
2 Gig of free online backup space![]()
cq cq de LA3BNA
you have to format the SD card on PC ... (preferably on windows)... the quick format from the library cannot format the card that is not "preformated" already... the quick format from the lib just erase all files...
have you tried the example ...\Examples\EasyPic4\extra_examples\MMC\Mmc_Fat16
what uC are you using? If IIRC mikroC lib uses hw SPI to talk with the mmc card, most of uC's I used have SPI on port C ... The software SPI might not be fast enough to talk with the card...
Bits From Bytes - the best RepRap kit out there now featuring RepRap V3 with full electronics redesign based on PIC32MX440F256H (English)
MySQL Blog (Serbian)
Elco Blog (Serbian)
Use forum to ask questions, do not use PP
Im using a 18F4550
How to determin if its SW or HW spi?
Edit:
Yes i have formatted on a XP machine
Last edited by Kryten; 21st May 2008 at 12:32 PM.
The best is yet to come
Good enough - its perfect !!
2 Gig of free online backup space![]()
cq cq de LA3BNA
I;m not sure my comment on hw/sw spi had any value as I'm looking now at the dsheet and SPI is on RC7, RB0, RB1 and RA5 ... The test I made with MMC reader was MMC reader dev card connected to portC .. so all 4 lines are connected to portC
http://www.mikroe.com/pdf/mmc-sd_board_schematic.pdf
CS - C2
SCK - C3
SDI - C4
SDO - C5
and it works for me ...
Bits From Bytes - the best RepRap kit out there now featuring RepRap V3 with full electronics redesign based on PIC32MX440F256H (English)
MySQL Blog (Serbian)
Elco Blog (Serbian)
Use forum to ask questions, do not use PP
Well I have made a PCB that is purposbuilt for my application.
Im using the SPI pins (RB 0,1 and 4 (Using RB4 CSSPP as chip select) and RC7) I might have to change my CS pin to RA5
Last edited by Kryten; 21st May 2008 at 01:15 PM. Reason: forgot something
The best is yet to come
Good enough - its perfect !!
2 Gig of free online backup space![]()
cq cq de LA3BNA
the mmc_fat_init() just takes parameter what pin you want to use for
CS ... the other 3 pins are HW spi and for 18F452 they are:
RC3/SCK/SCL -> (spi sck) -> SCK pin on MMC
RC4/SDI/SDA -> (spi data in) -> Dout pin on MMC
RC5/SDO -> (spi data out ) -> Din pin on MMC
now, the library use always SCK/SDI/SDO so as you use pic18f4550 then
you need to connect the MMC to
RB1/SCK/... spi clock
RB0/SDI/... - spi data in
RC7/RX/DT/SDO - spi data out
the "chip select" is passed to mmc_fat_init, so you can use any pin for that
I have just tried your project locally and it works but I had to put the 18F452 in, as my MMC board is idc10 connector to easypic4 so I was not able to connect it to pins on 4550, I removed the "adc" part of the project and it just append "blank" data to the file .. and that part is ok .. I'll try later on to connect it using wires to try the project with 4550 but that has to wait a bit as i'm kinda out of free time for now (I can probably test it during weekend)
Bits From Bytes - the best RepRap kit out there now featuring RepRap V3 with full electronics redesign based on PIC32MX440F256H (English)
MySQL Blog (Serbian)
Elco Blog (Serbian)
Use forum to ask questions, do not use PP
Ok i might have to change it then.. It might be that 600 samples thing
The best is yet to come
Good enough - its perfect !!
2 Gig of free online backup space![]()
cq cq de LA3BNA
Here is the connections between the SD /MMC card holder and uC
(I think now that using a PIC18F425 could have been better)
The best is yet to come
Good enough - its perfect !!
2 Gig of free online backup space![]()
cq cq de LA3BNA
If your running the 18F425 at 5V and the SD card at 3.3V you'll probably need a 74HCT125 or the like as a level converter as the SDI pin is ST (3.3V is too low)
The schematic below is for an AVR but the idea is the same.
![]()
blue, I'm not sure as
http://www.mikroe.com/pdf/mmc-sd_board_schematic.pdf
works perfectly with 18F4520 and that is 5V uC afaik.
Bits From Bytes - the best RepRap kit out there now featuring RepRap V3 with full electronics redesign based on PIC32MX440F256H (English)
MySQL Blog (Serbian)
Elco Blog (Serbian)
Use forum to ask questions, do not use PP
It's not recommended, the ST inputs want higher than 3.3V when the hardware SPI is used. Check the electrical specifications of the datasheet.
http://www.ljcv.net/library/sc/pic10t-2.0.pdf
thank you for clearing it up .. so .. it actually should not work, or at least it is not recommended ... the interesting thing is, now I get the reason why "Write" always work and "read" fails from time to time with no apparent reason (output from pic is divided with R1 trough R6 so SD receives 3.3V, but PIC does not always catch that 3.3V as "on") .. in general, this schematic ( http://www.mikroe.com/pdf/mmc-sd_board_schematic.pdf ) should have some 3.3->5V logic conversion on Dout from SD card for it to work "properly"
Bits From Bytes - the best RepRap kit out there now featuring RepRap V3 with full electronics redesign based on PIC32MX440F256H (English)
MySQL Blog (Serbian)
Elco Blog (Serbian)
Use forum to ask questions, do not use PP
Try lowering the VDD on the PIC with a diode, your top speed will go down but the ST threshold is VDD * 0.8 so that will go down too.