Card Reader

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times

Card Reader

Post by JohnCrow »

Hi
Not sure if ive missed a post or bug fix, but Im not able to get the card reader to work in FC5 (patch installed)

If I try it in hardware mode I get random characters on the lower line of the lcd, and just waits
Software mode does not do anything just sits waiting for card
Tried Sandisk class 2 (from matrix) and panasonic class 4 cards

The program works fine in FC4
This is an edited version of my whole flowchart to just leave the card reader part.
Cardtest-FC4-Works.fcf
FC4-working version
(11.61 KiB) Downloaded 349 times
Tried various configurations of the flowchart and have not been able to get it to even just create a file.
Suspect I must be overlooking something obvious

Thanks
1 in 10 people understand binary, the other one doesn't !

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Card Reader

Post by Benj »

Hi John,

Sorry for the delay some fixes are now available from here.
http://www.matrixmultimedia.com/mmforum ... 163#p33034

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times

Re: Card Reader

Post by JohnCrow »

Hi
Im still having problems with the card reader.
Ive done some tests and these are the results

They are still present after installing V5.2 (clean install, not patched)
I have set a simple program to create a txt file, open it and append a simple txt string.

I have the card reader on PortA for all tests - Jumper on A
PIC18F4550

All set to FAT 16
Software mode is set as
CS Bit2
Clock Bit3
Data In Bit 4
Data out Bit 5

Hardware Mode
CS Bit2

Test 1 & Test 2
Cardreader in software mode & LCD on Port B
Cardreader in software mode & LCD on Port D
Works ok Gives retvval = 0 on file create

Test 3
Cardreader in hardware mode & LCD on Port B
This gives random characters on the LCD , and does not write to card

Test 4
Cardreader in Hardware mode & LCD on Port D
Gives retval 238 on file create and does not create file
But does not put random characters on LCD
Create_open_write-works-softwaremode.fcf
(9 KiB) Downloaded 337 times
Create_open_write-Hardware mode-portd.fcf
(9 KiB) Downloaded 324 times
Create_open_write-Hardware mode.fcf
(9 KiB) Downloaded 295 times
1 in 10 people understand binary, the other one doesn't !

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Card Reader

Post by Benj »

Hi John,

When the FAT16 component is in hardware mode it uses the SPI peripheral pins on the chip. For the 18F4550 device these pins are as follows.

SDO - RC7
SDI - RB0
SCK - RB1

Using hardware mode the only pin that is freely available to be moved around is the chip select pin.

This explains why you are getting LCD corruption when this is connected to PortB in hardware mode.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times

Re: Card Reader

Post by JohnCrow »

Thanks Benj
1 in 10 people understand binary, the other one doesn't !

Post Reply