SD e-block

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

SD e-block

Post by proton »

Hi,

You show a example of playing a wav file from a sd card e-block, but can you give me some more info

1. the chip config in example is shaded out, what is the clock speed (internal,rc,xtal)
2. the sound output is on what pin (pwm)
3. what input is card reader on
4. what kind of circuit did you use to play the sound
5. what is the jumper position on the board as could not see the ic listed

looking forward to your reply

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: SD e-block

Post by Enamul »

Hi,
1. the chip config in example is shaded out, what is the clock speed (internal,rc,xtal)
The example 7. Streaming a WAV file using PWM to play audio uses ECIO-40 where 48MHz clock was used as system clock. But you can use the same code with 4 to 48MHz external clock source with PIC18f4455. You can tell us which PIC you are going to use and which programmer or development board you are using.
2. the sound output is on what pin (pwm)
The example uses channel 1 as PWM output which is connected to RC2 (PIN17 of PIC18f4455 but PIN 29 of ECIO-40).
3.what input is card reader on
Card reader has following connections:
Chip select>>PORTA<2>
Clock >>PORTA<3>
Data In >>PORTA<4>
Data Out >>PORTA<5>
4.what kind of circuit did you use to play the sound
As this is audio signal any simple audio driver using transistor from RC2 which will drive a speaker is enough to play the sound..
5. what is the jumper position on the board as could not see the ic listed
http://www.matrixmultimedia.com/resourc ... 7-30-1.pdf
I can see the IC list with jumper position here in the above datasheet...which pic you intend to use..please let us know.
Enamul
University of Nottingham
enamul4mm@gmail.com

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

I was going to use a PIC16F877/A with it's internal clock on a EB006 development board using Flowcode 4, there a limit to the size of memory card or class

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: SD e-block

Post by Enamul »

Actually You can't use PIC16f877a for SD card due to it's RAM size..Better to move to PIC18f4455 with 20MHz external clock and EB006 is fine..
You can follow following Ben's post.
http://www.matrixmultimedia.com/mmforum ... =26&t=4850
Enamul
University of Nottingham
enamul4mm@gmail.com

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

1
Last edited by proton on Sat Sep 08, 2012 10:13 pm, edited 1 time in total.

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: SD e-block

Post by Benj »

Hello,

Please try this example instead. It uses the FAT component rather then a custom component.
Attachments
7. Streaming a WAV file using PWM.fcf
(16.21 KiB) Downloaded 371 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: SD e-block

Post by Enamul »

Hi,
Although what Ben's post is right one for ECIO-40 but if you are using PIC18f4455 with 20MHz external clock you should use the attached file..We have recently tested this one which seems to have right config for PIC18f4455.

One suggestion for posting the error, it's better to post the msg file in achievement which is in the same folder of your .fcf file. It saves space of the post and looks better.
Attachments
Sound Wav Player FAT16 V0.4.fcf
(16.04 KiB) Downloaded 392 times
Enamul
University of Nottingham
enamul4mm@gmail.com

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

Hi,

Can iuse a 19.6608 Crystal ? thats all i got at hand at the moment. Because at present i'm using that crystal and getting the following on the LCD

Opening file
File Error: 239

Rgds

Wayne

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: SD e-block

Post by Benj »

Hi Wayne,

We have had reports that a 19.6608MHz crystal will work with the 18F4455 family to get a clock of around 48MHz and this is stable enough to run the USB components. Simply change the PLL crystal value in the chip configuration to 20MHz and it should work ok.

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

Hi

What is PLL ? is it a internal clock ? and how do i change it

Thanks for your help

Rgds

Wayne

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: SD e-block

Post by Benj »

Hi Wayne,

PLL (phase locked loop) is a clock frequency multiplier, it takes your input clock frequency and converts it up into a high frequency to drive the primary oscillator at 48MHz allowing for a system clock speed of 12MIPs which is compatible with full speed USB.

To change the PLL settings for the 18F4455 family simply change the "OSC Select" config setting to match your crystal. "div by 5 {20MHz input}" for your 19.6608MHz crystal.

This article contains details of how to setup the config settings for these devices.
http://www.matrixmultimedia.com/resourc ... %20PIC.pdf

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

Hi,

Still getting message LCD

Opening File
File Error: 239

Any advise

Rgds

Wayne

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: SD e-block

Post by Enamul »

Hi,
Can you post your program please? Also a bit details about your problem..
Enamul
University of Nottingham
enamul4mm@gmail.com

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

Hi,

its the example program you sent me, please check chip config on my program

using EB006 Board with a 19.6608 Mhz
EB037 with jumpers on "A" and 5V and 16M MMC Card

Thanks

Wayne
Attachments
Sound Wav Player FAT16 V0.4.fcf
(16.04 KiB) Downloaded 276 times

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: SD e-block

Post by Benj »

Hi Wayne,

The CPU Sys CLK Select should be set to No Divide. You can also probably disable the fail safe clock monitor.

Other then that everything looks ok.

If you want to confirm on hardware then perform the simple 1 second flasher test.

What about trying the FAT component on PortD, I believe there may be some complexity with some of the PortA pins which can cause problems.

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

Hi,

Still having problems now it will not ID the chip when compiling or clicking on auto detect. Place a 16f877 in the ic socket and it see's it no problem, changed it with a new 18f4455 and i get " Could not ID onboard chip "

Any ideas

Wayne

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: SD e-block

Post by Enamul »

Hi,
Do you have any other module connected in PORTs especially PORTB? please remove all modules from ports and try to detect PIC18f4455.
Enamul
University of Nottingham
enamul4mm@gmail.com

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: SD e-block

Post by Benj »

Hello,

It might also be worth playing around with these options in PPP to see if any of these help.
Attachments
PPP_Options.jpg
PPP_Options.jpg (77.61 KiB) Viewed 14015 times

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

Hi,

OK i have load a program to the 4455 ic that just prints "HI" in one second intervals to the LCD , but when loaded to the hardware it takes 20 seconds to repeat the message. i think this is the problem but how do i solve it to get the timing correct

Rgds

Wayne

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: SD e-block

Post by Benj »

Hi Wayne,

Check your clock speed and configuration settings are correct for your hardware in the project options and the delays should start working correctly.

If your in doubt then attach your program to the forums and detail the setup of your hardware. eg what crystal speed etc.

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

Its a 20 Mhz crystal (i also tried a 19.6608) on a EB006 development board and used the setting from emanuel program and also tried to adjust them but nothing seem to change ???

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: SD e-block

Post by Enamul »

Hi,
Can you please post the program so that we can see whether you have changed correctly or not?
Enamul
University of Nottingham
enamul4mm@gmail.com

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

Hi,

I am now a step closer, the card was not formatted right. But the only problem now is i only get about 2 seconds of sound then it locks up and all i get is a hiss or a looped noise like a dirty cd . any ideas ?

Thanks for your help so far

Wayne

proton
Flowcode V4 User
Posts: 50
Joined: Sun Feb 03, 2008 10:14 pm
Has thanked: 1 time
Contact:

Re: SD e-block

Post by proton »

hI

Please find attached program

regards

Wayne
Attachments
Sound Wav Player FAT16 V0.4.fcf
(16.03 KiB) Downloaded 275 times

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: SD e-block

Post by Benj »

Hi Wayne,

Have you tried doing a full format of the SD card (not a quick format) and then putting the wav file on the card.

Is the problem cyclical eg it comes and goes or once the corruption has been reached is that it?

Does the EOF marker come up on the LCD at all?

I have recently made numerous fixes to the FAT component for v5 to try and speed up the access speeds and to help the calculations work correctly with larger addresses. Saying this I did have a WAV player working nicely in v4 using this chip so it should work. Is the sample rate on your wav file ok? eg 8KHz 8-bit mono?

Post Reply