Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

A little help with SD cards . . . ?

A little help with SD cards . . . ?

2006-04-25 by kernels_nz

Hi guys,

Ive googled it to death, and read all the app notes and data sheets I
could get my hands on, but clearly I havent read them hard enough!

Just a few questions if anyone has used them succesfully please.

1. As i read and understand it, can I only use 512byte block sizes for
single block writing in SPI mode ? Do I then have to write as a
minimum 512bytes of info everytime I write to the card ?

2. Can anyone enlighten me as to how the physical sectors work ? How
many blocks per sector etc ? As I understand it, I need to supply a
start address for all write / read instructions, just wondering how I
know what address to give to make sure I start at the edges of blocks
and stay in the same sector.

If anyone has written any notes etc. that may be useful they would be
greatly appreciated. 

Cheers
Hein B
Auckland, New Zealand.

Re: [AVR-Chat] A little help with SD cards . . . ?

2006-04-25 by Jesper Hansen

kernels_nz wrote:
> Hi guys,
> 
> Ive googled it to death, and read all the app notes and data sheets I
> could get my hands on, but clearly I havent read them hard enough!
> 
> Just a few questions if anyone has used them succesfully please.
> 
> 1. As i read and understand it, can I only use 512byte block sizes for
> single block writing in SPI mode ? Do I then have to write as a
> minimum 512bytes of info everytime I write to the card ?

You MUST write complete 512 byte blocks. When reading you can terminate 
a read by raising CS, but when writing this is not possible. If you do 
not fullfill a block write, no data will be written at all.

> 2. Can anyone enlighten me as to how the physical sectors work ? How
> many blocks per sector etc ? As I understand it, I need to supply a
> start address for all write / read instructions, just wondering how I
> know what address to give to make sure I start at the edges of blocks
> and stay in the same sector.

Forget all about physical sectors and just think of the card as a 
collection of 512 byte blocks. If you start playing with different block 
sizes (which only works on read anyway) you'll quickly end up confused. 
Simply address the card by logical sector numbers, by simply shifting up 
the sector number 9 bits and feed that address to the card.

/Jesper

Re: A little help with SD cards . . . ?

2006-04-26 by kernels_nz

Hi Jesper,

Thanks for that, it was as I understood it from the datasheets, just
wanted to double check with someone more familiar. Just one more
thing, am I then correct in assuming that Block1 is bytes 0 to 511,
block 2 is bytes 512 to 1023 etc. ? And the address I supply for write
instructions, I always then just change bits higher than the 9th bit
(512) ? 

Cheers again
Hein
Auckland, New Zealand.

--- In AVR-Chat@yahoogroups.com, Jesper Hansen <jesperh@...> wrote:
>
> kernels_nz wrote:
> > Hi guys,
> > 
> > Ive googled it to death, and read all the app notes and data sheets I
> > could get my hands on, but clearly I havent read them hard enough!
> > 
> > Just a few questions if anyone has used them succesfully please.
> > 
> > 1. As i read and understand it, can I only use 512byte block sizes for
> > single block writing in SPI mode ? Do I then have to write as a
> > minimum 512bytes of info everytime I write to the card ?
> 
> You MUST write complete 512 byte blocks. When reading you can terminate 
> a read by raising CS, but when writing this is not possible. If you do 
> not fullfill a block write, no data will be written at all.
> 
> > 2. Can anyone enlighten me as to how the physical sectors work ? How
> > many blocks per sector etc ? As I understand it, I need to supply a
> > start address for all write / read instructions, just wondering how I
> > know what address to give to make sure I start at the edges of blocks
> > and stay in the same sector.
> 
> Forget all about physical sectors and just think of the card as a 
> collection of 512 byte blocks. If you start playing with different
block 
> sizes (which only works on read anyway) you'll quickly end up confused. 
> Simply address the card by logical sector numbers, by simply
shifting up 
Show quoted textHide quoted text
> the sector number 9 bits and feed that address to the card.
> 
> /Jesper
>

Re: [AVR-Chat] Re: A little help with SD cards . . . ?

2006-04-26 by Jesper Hansen

kernels_nz wrote:
> Thanks for that, it was as I understood it from the datasheets, just
> wanted to double check with someone more familiar. Just one more
> thing, am I then correct in assuming that Block1 is bytes 0 to 511,
> block 2 is bytes 512 to 1023 etc. ? 

Yes.

> And the address I supply for write
> instructions, I always then just change bits higher than the 9th bit
> (512) ? 

Yes. You should always adddress the card at sector/block boundaries.

ADC sample time

2006-04-26 by Peter Harrison

Hi

I have an optical sensor. It triggers an emitter and reads a response 
from a photodiode and amplifier. after firing the emitter, I wait until 
the amplifier has had time to reach a stable output - say 5us - then I 
initiate an ADC conversion.

Now, If I turn off the emitter too soon, the ADC result is decreased so 
my question is: How long should I keep the signal present at the ADC 
input to allow the internal sample and hold capacitor to charge?

According to the (ATMEGA32) datasheet, the S/H capacitor has a value of 
14pF but the series resistance of the multiplexer is shown as 
1..100kOhm. This seems a bit of a large range. Time constants could be 
up to 1.4us requiring that I wait as long as 7us or so to charge the 
capacitor. The source impedance is an op-amp output so it should not 
have any effect to speak of. The sheet also describes the sampling time 
as negligible. Seems like a new, optimistic definition of the word to me.

My code seems to need to wait at least 1us before turning off the 
emitter. As I need to perform 5k conversions per second, I could do 
without wasting all that time in the timer interrupt waiting for the 
signal to settle. I already have to arrange that on a timer tick, I 
collect the previous result and then fire off another conversion.

Have I got it right and this is just how it works, or have I missed 
something? Is the switch resistance really that variable?

Pete Harrison.

Re: [AVR-Chat] ADC sample time

2006-04-26 by Jim Wagner

My recollection is (without checking data sheet - BAD!) is
that the S/H switch is triggered about 1.5 ADC clocks after
the ADC starts. I would guess that this could play a
significant role in your problem. The data sheet also
inferred, if I remember (again, unchecked) that the S/H
switch was closed for one half an ADC clock. There is an
ADC timing diagram for many of the devices that show you
this basic operation.

Jim


On Wed, 26 Apr 2006 20:03:34 +0100
 Peter Harrison <peter.harrison@helicron.net> wrote:
> Hi
> 
> I have an optical sensor. It triggers an emitter and
> reads a response 
> from a photodiode and amplifier. after firing the
> emitter, I wait until 
> the amplifier has had time to reach a stable output - say
> 5us - then I 
> initiate an ADC conversion.
> 
> Now, If I turn off the emitter too soon, the ADC result
> is decreased so 
> my question is: How long should I keep the signal present
> at the ADC 
> input to allow the internal sample and hold capacitor to
> charge?
> 
> According to the (ATMEGA32) datasheet, the S/H capacitor
> has a value of 
> 14pF but the series resistance of the multiplexer is
> shown as 
> 1..100kOhm. This seems a bit of a large range. Time
> constants could be 
> up to 1.4us requiring that I wait as long as 7us or so to
> charge the 
> capacitor. The source impedance is an op-amp output so it
> should not 
> have any effect to speak of. The sheet also describes the
> sampling time 
> as negligible. Seems like a new, optimistic definition of
> the word to me.
> 
> My code seems to need to wait at least 1us before turning
> off the 
> emitter. As I need to perform 5k conversions per second,
> I could do 
> without wasting all that time in the timer interrupt
> waiting for the 
> signal to settle. I already have to arrange that on a
> timer tick, I 
> collect the previous result and then fire off another
> conversion.
> 
> Have I got it right and this is just how it works, or
> have I missed 
> something? Is the switch resistance really that variable?
> 
> Pete Harrison.
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 

---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Re: [AVR-Chat] ADC sample time

2006-04-27 by Ned Konz

On Apr 26, 2006, at 12:03 PM, Peter Harrison wrote:

> Hi
>
> I have an optical sensor. It triggers an emitter and reads a response
> from a photodiode and amplifier. after firing the emitter, I wait  
> until
> the amplifier has had time to reach a stable output - say 5us - then I
> initiate an ADC conversion.
>
> Now, If I turn off the emitter too soon, the ADC result is  
> decreased so
> my question is: How long should I keep the signal present at the ADC
> input to allow the internal sample and hold capacitor to charge?
>
> According to the (ATMEGA32) datasheet, the S/H capacitor has a  
> value of
> 14pF but the series resistance of the multiplexer is shown as
> 1..100kOhm. This seems a bit of a large range. Time constants could be
> up to 1.4us requiring that I wait as long as 7us or so to charge the
> capacitor. The source impedance is an op-amp output so it should not
> have any effect to speak of. The sheet also describes the sampling  
> time
> as negligible. Seems like a new, optimistic definition of the word  
> to me.
>
The 7usec is not out of line, considering that the sample/hold is  
sampling until 1.5 sample clocks after asserting ADSC (which is, at  
best, 7.5usec given that 200KHz is the max clock for 10 bit  
conversions).

> My code seems to need to wait at least 1us before turning off the
> emitter. As I need to perform 5k conversions per second, I could do
> without wasting all that time in the timer interrupt waiting for the
> signal to settle. I already have to arrange that on a timer tick, I
> collect the previous result and then fire off another conversion.
>
Have you considered "free-running" mode?

> Have I got it right and this is just how it works, or have I missed
> something? Is the switch resistance really that variable?

-- 
Ned Konz
MetaMagix embedded consulting
MetaMagix@gmail.com

Re: [AVR-Chat] ADC sample time

2006-04-27 by Peter Harrison

Ned Konz wrote:
> On Apr 26, 2006, at 12:03 PM, Peter Harrison wrote:
> 
>> Hi
>>
>> I have an optical sensor. It triggers an emitter and reads a response
>> from a photodiode and amplifier. after firing the emitter, I wait  
>> until
>> the amplifier has had time to reach a stable output - say 5us - then I
>> initiate an ADC conversion.
>>
>> Now, If I turn off the emitter too soon, the ADC result is  
>> decreased so
>> my question is: How long should I keep the signal present at the ADC
>> input to allow the internal sample and hold capacitor to charge?
>>
>> According to the (ATMEGA32) datasheet, the S/H capacitor has a  
>> value of
>> 14pF but the series resistance of the multiplexer is shown as
>> 1..100kOhm. This seems a bit of a large range. Time constants could be
>> up to 1.4us requiring that I wait as long as 7us or so to charge the
>> capacitor. The source impedance is an op-amp output so it should not
>> have any effect to speak of. The sheet also describes the sampling  
>> time
>> as negligible. Seems like a new, optimistic definition of the word  
>> to me.
>>
> The 7usec is not out of line, considering that the sample/hold is  
> sampling until 1.5 sample clocks after asserting ADSC (which is, at  
> best, 7.5usec given that 200KHz is the max clock for 10 bit  
> conversions).

Ah... We have a thing at work where the act of asking the question seems 
to help the brain formulate a solution. I had overlooked the 1.5 clocks 
bit and now I have read the sheet again in the light of that I think I 
can substantially improve things. For example, since I am likely to have 
to wait 7us anyway for a sample and hold action (with a 200kHz ADC 
clock) then I might as well trigger a conversion at the same time as the 
emitter is fired. The sensor amplifier will have reached its output 
level by the time the ADC does the sample anyway. The second delay seems 
to be redundant. That will halve the time spent in the sensor interrupt. 
(in the original post, I said I waited 1us for a sample when I should 
have written 10us)

I could still do with knowing how long the sample takes though. If the 
series resistor really is only 1k, I can motor on a bit more. Perhaps I 
will have to do some tests and vary the delay to see the effect on the 
response.

> Have you considered "free-running" mode?
> 

Not really appropriate I think. There are four channels, each must be 
fired and read individually in sequence and a complete set must be done 
every millisecond. That seems to require the triggered measurements.

Pete Harrison

Re: [AVR-Chat] ADC sample time

2006-04-27 by David VanHorn


Not really appropriate I think. There are four channels, each must be
fired and read individually in sequence and a complete set must be done
every millisecond. That seems to require the triggered measurements.
You could kick off the sequence from a timer, then go free-running, changing the channel on every aquisition till you're done with the sequence.

Re: [AVR-Chat] PalmIII LCD and touchscreen information.

2006-11-21 by Leon Heller

----- Original Message ----- 
Show quoted textHide quoted text
From: "Q boll" <msg_qboll@hotmail.com>
To: <AVR-Chat@yahoogroups.com>
Sent: Tuesday, November 21, 2006 10:43 AM
Subject: [AVR-Chat] PalmIII LCD and touchscreen information.


> Hi All,
> 
> I was wondering if someone has some information about
> this PalmIII pilot LCD + touchscreen. I mean the connector
> pinout and how to control it.(datasheet)
> 
> I want to control it with an ATMega128 but

It's probably RS-232 like my Palm IIIx.

Leon

PalmIII LCD and touchscreen information.

2006-11-21 by Q boll

Hi All,

I was wondering if someone has some information about
this PalmIII pilot LCD + touchscreen. I mean the connector
pinout and how to control it.(datasheet)

I want to control it with an ATMega128 but

After looking for a few hours googlen I cann’t find any information.

Thanks,

Pascal

_________________________________________________________________
Nieuw: Live Mail. Mis het niet en profiteer direct van de voordelen! 
http://imagine-windowslive.com/mail/launch/default.aspx?Locale=nl-nl

RE: [AVR-Chat] PalmIII LCD and touchscreen information.

2006-11-21 by Qboll

Hi Leon,
 
I don't mean the connector of the PalmIII itself but
the connector on the LCD INSIDE the PalmIII.
 
Pascal
Show quoted textHide quoted text
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On
Behalf Of Leon Heller
Sent: dinsdag 21 november 2006 12:07
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] PalmIII LCD and touchscreen information.
 
----- Original Message ----- 
From: "Q boll" <msg_qboll@hotmail. <mailto:msg_qboll%40hotmail.com> com>
To: <AVR-Chat@yahoogroup <mailto:AVR-Chat%40yahoogroups.com> s.com>
Sent: Tuesday, November 21, 2006 10:43 AM
Subject: [AVR-Chat] PalmIII LCD and touchscreen information.

> Hi All,
> 
> I was wondering if someone has some information about
> this PalmIII pilot LCD + touchscreen. I mean the connector
> pinout and how to control it.(datasheet)
> 
> I want to control it with an ATMega128 but

It's probably RS-232 like my Palm IIIx.

Leon
 


[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.