linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Vikram Narayanan <vikram186-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: Configuration of MAX7301
Date: Thu, 3 Mar 2011 09:57:48 -0700	[thread overview]
Message-ID: <AANLkTi=vnpu+L2r0-KcE=PuH=GB7r27b9P-2_M_+TKF=@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=y=5Xs1GJVsMjxH-js6pDTn37844NNAGK2oM1t-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, Mar 3, 2011 at 3:57 AM, Vikram Narayanan <vikram186-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi,
>
> I am trying to interface the MAX7301 IC with my Samsung S3C2440 processor.
> The problem is the S3c supports only 8 bit word length for SPI transfer,
> whereas my MAX requires 16 bit word length.

You're talking about spi which at it's heart is just a stream of bits.
 Not 8 bit, not 16 bit.  Just a stream.  The device may make
assumptions about how the stream is framed into 16 bit hunks, and the
spi_master may have limitations on how the data buffer is organized (8
bit bytes), but that does not prevent the two from working together.

What you need to do is arrange the data in the transfer buffer so that
the bits get streamed out in the order expected by the MAX7301.  It's
educational to break out an oscilloscope and experiment with different
transfers so you can get familiar with how the bits appear on the
wire.  Then you'll be able to figure out how to arrange the transfer
so that the device gets what it needs.

I do *not* recommend using the bitbang driver when you've got a proper
spi master at your disposal.

g.

> I couldn't find any info on the datasheet to use the IC on a 8 bit word
> length. can i make the max7301_write function,
>
> static int max7301_write(struct spi_device *spi, unsigned int reg, unsigned
> int val)
> {
>    u8 command = reg & 0x7F;
>    u8 data = val & 0xFF;
>    spi_write(spi, (const u8*)&command, sizeof(command));
>    spi_write(spi, (const u8*)&data, sizeof(data));
>    return 0;
> }
>
> Will this make the IC work? Please share your ideas.
> --
> Regards
> Vikram
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
> generated by your applications, servers and devices whether physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> spi-devel-general mailing list
> spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/spi-devel-general
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 

  parent reply	other threads:[~2011-03-03 16:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 10:57 Configuration of MAX7301 Vikram Narayanan
     [not found] ` <AANLkTi=y=5Xs1GJVsMjxH-js6pDTn37844NNAGK2oM1t-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-03 11:07   ` Jassi Brar
     [not found]     ` <AANLkTimzhpAFgJTGtc3AZz_QKQ+Ps5iHU8ML9g8UO=9j-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-03 11:21       ` Vikram Narayanan
2011-03-03 13:24       ` Vikram Narayanan
2011-03-03 16:57   ` Grant Likely [this message]
2011-03-03 17:08     ` Vikram Narayanan
2011-03-03 21:00       ` Vikram Narayanan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=vnpu+L2r0-KcE=PuH=GB7r27b9P-2_M_+TKF=@mail.gmail.com' \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=vikram186-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).