From: "Julien Stéphane" <Stephane.Julien@he-arc.ch>
To: <ecos-discuss@ecos.sourceware.org>
Cc: "Etique Philippe" <Philippe.Etique@he-arc.ch>
Subject: [ECOS] SPI problem on AT91EB55
Date: Tue, 27 Feb 2007 09:25:00 -0000 [thread overview]
Message-ID: <F7620004260C5D4DB836EDBF8CC6872D028943A5@neptune.intra.eiaj.ch> (raw)
Hy everybody,
I have problems for programming SPI on AT91EB55. I have plugged an oscilloscope to the corresponding pins of I/O extension connector and nothing come to the pins. Does it come from a driver problem or an error in code? I have checked the connections. Here is part of my code :
------------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include <cyg/hal/hal_diag.h>
#include <cyg/io/spi.h>
#include <cyg/io/spi_at91.h>
#include <cyg/io/spi_eb55.h>
#define DEV_NUM 4 //default 0
#define CL_POL 1 //default 1 / mode3=1
#define CL_PHA 1 //default 0 / mode3=1
#define CL_BRATE 3000000 //default 8192000, 2000000?, 3000000?
#define CS_UP_UDLY 1 //default 1
#define CS_DW_UDLY 1 //default 1
#define TR_BT_UDLY 1 //default 1
static cyg_spi_at91_device_t spi_eb55_device CYG_SPI_DEVICE_ON_BUS(DEV_NUM) = //CYG_SPI_DEVICE_ON_BUS(0)
{
.spi_device.spi_bus = &cyg_spi_at91_bus.spi_bus,
.dev_num = DEV_NUM, // Device number
.cl_pol = CL_POL, // Clock polarity (0 or 1)
.cl_pha = CL_PHA, // Clock phase (0 or 1)
.cl_brate = CL_BRATE, // Clock baud rate
.cs_up_udly = CS_UP_UDLY, // Delay in usec between CS up and transfer start
.cs_dw_udly = CS_DW_UDLY, // Delay in usec between transfer end and CS down
.tr_bt_udly = TR_BT_UDLY // Delay in usec between two transfers
};
cyg_spi_device *cyg_spi_eb55_device = &spi_eb55_device.spi_device;
int main(void)
{
cyg_uint8 tx_data0, tx_data1, tx_data2, tx_data3;
cyg_uint8 rx_data;
printf("Entering application !\n");
hal_diag_led(0x0);
tx_data0=0x0;
tx_data1=0x1;
tx_data2=0x90;
tx_data3=0x15;
printf("Sending data...\n");
cyg_spi_transfer(cyg_spi_eb55_device, 0, 1, &tx_data0, &rx_data);
printf("Datas deceived : %i\n",rx_data);
cyg_spi_transfer(cyg_spi_eb55_device, 0, 1, &tx_data1, &rx_data);
printf("Datas deceived : %i\n",rx_data);
cyg_spi_transfer(cyg_spi_eb55_device, 0, 1, &tx_data2, &rx_data);
printf("Datas deceived : %i\n",rx_data);
cyg_spi_transfer(cyg_spi_eb55_device, 0, 1, &tx_data3, &rx_data);
printf("Datas deceived : %i\n",rx_data);
cyg_spi_tick(cyg_spi_eb55_device, 0, 1000);
printf("End of main !\n");
//cyg_thread_exit();
}
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
next reply other threads:[~2007-02-27 9:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-27 9:25 Julien Stéphane [this message]
2007-02-27 10:09 ` Chris Zimman
2007-02-27 21:28 ` [ECOS] " Nicolas Brouard
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=F7620004260C5D4DB836EDBF8CC6872D028943A5@neptune.intra.eiaj.ch \
--to=stephane.julien@he-arc.ch \
--cc=Philippe.Etique@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).