public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Nicolas Brouard" <nicolas.brouard@silicomp.ca>
To: "'Julien Stéphane'" <Stephane.Julien@he-arc.ch>,
	ecos-discuss@ecos.sourceware.org
Cc: "'Etique Philippe'" <Philippe.Etique@he-arc.ch>
Subject: [ECOS] RE: SPI usage
Date: Tue, 27 Feb 2007 21:13:00 -0000	[thread overview]
Message-ID: <20070227211300.W1yVALuhuqm8hmUfI3h9d7SFfsHWRcGf86miMb1cHNA@z> (raw)
In-Reply-To: <F7620004260C5D4DB836EDBF8CC6872D2FDAA0@neptune.intra.eiaj.ch>

Hi, 

SPI devices should be defined in the file spi_eb55.c. You can specify the CS
in the field .dev_num.
 
// -------------------------------------------------------------------------
// AT91EB55 SPI exported devices 
 
// AT45DB321B DataFlash
static cyg_spi_at91_device_t spi_dataflash_dev0 CYG_SPI_DEVICE_ON_BUS(0) = 
{
    .spi_device.spi_bus = &cyg_spi_at91_bus.spi_bus,
    .dev_num     = 0,       // Device number = CHIP SELECT
    .cl_pol      = 1,       // Clock polarity (0 or 1)
    .cl_pha      = 0,       // Clock phase (0 or 1)
    .cl_brate    = 8192000, // Clock baud rate
    .cs_up_udly  = 1,       // Delay in usec between CS up and transfer
start
    .cs_dw_udly  = 1,       // Delay in usec between transfer end and CS
down
    .tr_bt_udly  = 1        // Delay in usec between two transfers
};
cyg_spi_device *cyg_spi_dataflash_dev0 = &spi_dataflash_dev0.spi_device;


If you prefer not modify in spi_eb55.c, you can put the device definition in
your drive file. This is an example for the ADC on the AT91EB55 board :

#define CHIP_SELECT 5       ///< Chip select pour selectionner l'ADC
/// Definition du device SPI associe au bus SPI defini dans le driver SPI
pour AT91
static cyg_spi_at91_device_t spi_adc_dev  CYG_SPI_DEVICE_ON_BUS(0) = {
    .spi_device.spi_bus = &cyg_spi_at91_bus.spi_bus,
    .dev_num = CHIP_SELECT,
    .cl_pol = 0,
    .cl_pha = 1, // Il est important de mettre la phase a 1 pour la lecture
des data sur le front montant de l'horloge.
    .cl_brate = 500000, // 500 KHz (Min 10 KHz, Max 1 MHz pour cet ADC en
2.7 Volts)
    .cs_up_udly = 0,
    .cs_dw_udly = 0,
    .tr_bt_udly = 0
};

For sending data, use 

-----Original Message-----
From: Julien Stéphane [mailto:Stephane.Julien@he-arc.ch] 
Sent: Monday, February 26, 2007 09:49
To: ecos-discuss@ecos.sourceware.org
Cc: Etique Philippe
Subject: SPI usage

Hy everybody,
 
I have problems developing an application using SPI on AT91EB55. When I send
a tick, then I connot send datas any more because the programm is blocking.
If I don't send ticks, it blocks on the next transfer.
 
I have checked the clock phase, clock polarity and chip select. Could it
come from an hardware problem or I'm wrong in my code?
 
Thank you very much for your help.... 
Stéphane



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

      reply	other threads:[~2007-02-27 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-26 14:49 [ECOS] " Julien Stéphane
2007-02-27 21:13 ` Nicolas Brouard [this message]

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=20070227211300.W1yVALuhuqm8hmUfI3h9d7SFfsHWRcGf86miMb1cHNA@z \
    --to=nicolas.brouard@silicomp.ca \
    --cc=Philippe.Etique@he-arc.ch \
    --cc=Stephane.Julien@he-arc.ch \
    --cc=ecos-discuss@ecos.sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).