Discussion in "Project Help" started by    labarbacue    Apr 24, 2009.
Fri Apr 24 2009, 02:45 pm
#1
Hi im trying to implement a sd card with my at89c5131a , i am using the tutorial of this page . When i am configuring the startup.a51 , i don't find a way to configure the SPI port like in the tutorial (the manual CS line and all of this ) . Because i don't have CS line , i have SS line , is the same? How can i setup it like the tutorial ? Thanks in advance!
Fri Apr 24 2009, 09:04 pm
#2
Yes, the SS line means slave select. The tutorial refers to the CS line, which is a chip select line...

Same thing...

Fri Apr 24 2009, 09:33 pm
#3
Thanks for the reply , the only thing that i dont understand is why is he configuring the startup.a51 . It's because of his micro? Normal microcontrollers need a configuration lik his ? Thanks
Fri Apr 24 2009, 11:08 pm
#4
The reason I used the startup.a51 file was it was convenient. You can do the setup in C if you like - the SFR's are accessible from there as well.



[ Edited Fri Apr 24 2009, 11:23 pm ]
Fri Apr 24 2009, 11:30 pm
#5
Hi Dave ,

What i don't understand on your tutorial is what exactly are you configuring on the startup.a51 . I have looked the datasheet of your microcontroller and i think that is because if you don't configure it , it is not an SPi port is it? But if this is right , normal microcontrollers don't need this configuration? Thank you for you answers!
Fri Apr 24 2009, 11:34 pm
#6
Here are some pointers for you particular microcontroller:

Using this datasheet: http://www.atmel.com/dyn/resources/prod_documents/doc4338.pdf

Referring to: page 90, Figure 42, and page 91

You can see a similar implementation to the tutorial, using several port pins to select which device you will be communicating with.

If you are only going to have the single device, you can simplify the design by following the example on page 93, Figure 44.

 labarbacue like this.
Fri Apr 24 2009, 11:36 pm
#7
...and, yes - the port configuration function registers are setup to change the functioning of the ports on my processor. The ports can be many different things, but I wanted them to be SPI, so I programmed them in the startup.a51 file. I could have just as easily programmed them at the beginning of main() if I wanted to...

Fri Apr 24 2009, 11:55 pm
#8
Thank you one more time to take so many time with my problem . Ok so with your answers have appeard other questions .... So if i'm not wrong , i don't need to touch anything on startup.a51 because on my microcontroller are the way that is correct right ? . Another thing ... about the CS or SS in my case , as you have told me , in figure 44 it appears connected to Vcc , but this line hasn't got to be selected manually as you told in the tutorial ? Thanks in advance!

Sat Apr 25 2009, 12:29 am
#9
yes, you can leave startup.a51 alone.

yes, you can ignore the SS line if you are using only a single SPI device.

Make sure to connect the MOSI line to the data in line on the SD card, and make sure to connect the MISO line to the data out line on the SD card. Make sure the SCK line is connected to the clock input on the SD card. Also, make sure you are running your microcontroller at 3.3vdc...

Wed May 06 2009, 04:56 pm
#10
Hi Dave , i have another question about your tutoria . Well , the question is that i have to implement the transferring and receiving function , because i don't know what exacly does this code(especially the while with semicolons!?):

BYTE SPI_Byte( BYTE ThisByte )
{
while( !(SPISTAT & TISF) );
while( (SPISTAT & BUSY) );
SPITDR = ThisByte;
while( !(SPISTAT & RISF) );
while( (SPISTAT & BUSY) );
return( SPIRDR );
}

Thanks and sorry for the inconveniencies !

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Richardedils
Wed Apr 24 2024, 04:07 am
ChrisLub
Tue Apr 23 2024, 05:21 pm
Davidbab
Tue Apr 23 2024, 10:41 am
Richardrit
Tue Apr 23 2024, 09:54 am
HenryLaf
Mon Apr 22 2024, 03:50 pm
bleradrar
Mon Apr 22 2024, 06:38 am
ppu-pro_ka
Sun Apr 21 2024, 07:39 pm
Infewow
Sun Apr 21 2024, 06:30 pm