public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] SPI usage
@ 2007-02-26 14:49 Julien Stéphane
  2007-02-27 21:13 ` [ECOS] " Nicolas Brouard
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Stéphane @ 2007-02-26 14:49 UTC (permalink / raw)
  To: ecos-discuss; +Cc: Etique Philippe

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ECOS] RE: SPI usage
  2007-02-26 14:49 [ECOS] SPI usage Julien Stéphane
@ 2007-02-27 21:13 ` Nicolas Brouard
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Brouard @ 2007-02-27 21:13 UTC (permalink / raw)
  To: 'Julien Stéphane', ecos-discuss; +Cc: 'Etique Philippe'

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-27 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-26 14:49 [ECOS] SPI usage Julien Stéphane
2007-02-27 21:13 ` [ECOS] " Nicolas Brouard

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).