For users of the Atmel AT91SAM7 and AT91SAM9 ARM CPU chips. Atmel has taken a new direction by combining on chip flash and ram with the ARM CPU on a single die. This provides low cost devices for small systems using the ARM CPU.
This group is to exchange information to help users get started and learn how to use the devices.
hi friendz....
i am interfacing a SD/MMC card to LPC2148 using SSP (SPI1) but and i am interfacing it on
stadalone basis i.e.with no operating sys base... has anyone worked on it ?
i am not getting clock after initalising SPI_init routeen is
unsigned char i, Dummy;
*S1SPCR1 = 0x00; /* SSP master (off) in normal mode */
*PINSEL1 = *PINSEL1 & 0XFFFFFF03;
*PINSEL1 = *PINSEL1 | 0x000000A8;//0X01000000;
*IODIR0 = SPI_SEL; /* SSEL is output 0x00100000*/
*IOSET0 = SPI_SEL; /* set SSEL to high0x00100000 */
*VPBDIV = 0x00; /* Set PCLK 1/4 of CCLK */
/* Set data to 8-bit, Frame format SPI, CPOL = 0, CPHA = 0,
and SCR is 15 */
*S1SPCR = 0x0707;
/* SSPCPSR clock prescale register, master mode, minimum divisor
is 0x02*/
*SSPCPSR = 0x2;
/* Device select as master, SSP Enabled, normal operational mode */
*S1SPCR = 0x02;
for ( i = 0; i < 8; i++ )
{
Dummy = *S1SPDR; /* clear the RxFIFO */
}
----- Original Message ----
From: gamerz267
To: A...@yahoogroups.com
Sent: Monday, 7 April, 2008 8:54:10 AM
Subject: [AT91SAM] Re: spi pdc aic interupt
Im interfacing with ADC and DACs its working now
i configure the interuppt first like this
/*3. Configure interrupt for SPI0 in AIC*/
// Disable the interrupt first
AT91C_BASE_AIC- >AIC_IDCR = (1 << AT91C_ID_SPI0) ;
// Configure mode and handler
// For SPI
AT91C_BASE_AIC- >AIC_SMR[ AT91C_ID_ SPI0] = ((unsigned int)
(AT91C_AIC_PRIOR_ HIGHEST | AT91C_AIC_SRCTYPE_ INT_HIGH_ LEVEL));
AT91C_BASE_AIC- >AIC_SVR[ AT91C_ID_ SPI0] = ((unsigned int)
SPI0_Handler) ;
then i configure the spi
then enable the interupt
// Configure interrupt enable register
// Enables one or more interrupt sources of a SPI0
AT91C_BASE_SPI0- >SPI_IER = AT91C_SPI_ENDTX;
// Enable the interrupt on the interrupt controller
//AT91C_BASE_ AIC->AIC_ IECR = ((unsigned int) 1 << AT91C_ID_SPI0) ;
// Enables a SPI peripheral
// Enables the transmitter of a SPI0
AT91C_BASE_SPI0- >SPI_CR = AT91C_SPI_SPIEN;
--- In AT91SAM@yahoogroups .com, "hudson_low" wrote:
>
> Hi gamerz,
>
> I wondering what device u interface with using SPI?
> Do u need pull-Up on PA16_SPI0_MISO?
>
> Have u got it working Yet?
> Mind the to share the working code?
> I need some help getting my spi ISR right as well
>
> regards
> HS
>
> --- In AT91SAM@yahoogroups .com, "gamerz267" wrote:
> >
> > is there some special trick to get the interrupt working with spi. My
> > code doesnt cause a interupt. Am i doing something wrong??
> >
> >
> >
> > AT91F_PMC_EnablePer iphClock(
> > AT91C_BASE_PMC, // PIO controller base address
> > ((unsigned int) 1 << AT91C_ID_SPI0) );
> >
> > // Open PIO for SPI0
> > //AT91F_SPI0_ CfgPIO();
> > AT91F_PIO_CfgPeriph (
> > AT91C_BASE_PIOA, // PIO controller base address
> > ((unsigned int) AT91C_PA15_SPI0_ NPCS3) |
> > ((unsigned int) AT91C_PA16_SPI0_ MISO) |
> > ((unsigned int) AT91C_PA17_SPI0_ MOSI) |
> > ((unsigned int) AT91C_PA18_SPI0_ SPCK), // Peripheral A
> > 0); // Peripheral B
> >
> > /*2. Configure interrupt for SPI0 in AIC*/
> > //AT91F_AIC_ DisableIt( AT91C_BASE_ AIC, AT91C_ID_SPI0) ;
> > // Configure the AIC for SPI interrupts
> > AT91F_AIC_Configure It(
> > AT91C_BASE_AIC,
> > AT91C_ID_SPI0,
> > AT91C_AIC_PRIOR_ HIGHEST,
> > AT91C_AIC_SRCTYPE_ HIGH_LEVEL,
> > AT91F_SPI0_Interrup t_handler) ;
> > // Enable the interrupt on the interrupt controller
> > AT91F_AIC_EnableIt( AT91C_BASE_ AIC, AT91C_ID_SPI0) ;
> >
> >
> > /*3. Configuration SPI*/
> > // Reset SPI
> > //AT91F_SPI_ Reset(AT91C_ BASE_SPI0) ;
> >
> > // Configure SPI in Master Mode with with cs
> > AT91F_SPI_CfgMode( AT91C_BASE_ SPI0, SPI_MODE);
> >
> > // Configure CSx
> > AT91F_SPI_CfgCs( AT91C_BASE_ SPI0, 3, SPI_NPCS3_CONFIG) ; //CS3
> >
> > // Configure interupt when End of Transfer
> > AT91F_SPI_EnableIt( AT91C_BASE_ SPI0, AT91C_SPI_TDRE) ;
> >
> > // SPI_Enable
> > AT91F_SPI_Enable( AT91C_BASE_ SPI0);
> >
> > --- In AT91SAM@yahoogroups .com, "gamerz267" wrote:
> > >
> > > ok the clock was already enabled. Do i have to enable it for the aic
> > too?
> > > If so how do i do that?
> > >
> > >
> > > --- In AT91SAM@yahoogroups .com, "Eric Pasquier" wrote:
> > > >
> > > > Yes.
> > > > You have to set the internal MCK clock for each peripheral,
> > > disconnected by default for lower consumption.
> > > >
> > > > And, of course, you have to set others parmeters like number of
> > > bits, transfer rate, ... depending of your application.
> > > >
> > > > Eric Pasquier
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: gamerz267
> > > > To: AT91SAM@yahoogroups .com
> > > > Sent: Thursday, January 24, 2008 11:24 PM
> > > > Subject: [AT91SAM] Re: spi pdc aic interupt
> > > >
> > > >
> > > > Do you mean this
> > > >
> > > > AT91F_PMC_EnablePer iphClock(
> > > > AT91C_BASE_PMC, // PIO controller base address
> > > > ((unsigned int) 1 << AT91C_ID_SPI0) );
> > > >
> > > > // from lib_AT91SAM7X256. h
> > > > void AT91F_PMC_EnablePer iphClock (
> > > > AT91PS_PMC pPMC, // \arg pointer to PMC controller
> > > > unsigned int periphIds) // \arg IDs of peripherals
> > > > {
> > > > pPMC->PMC_PCER = periphIds;
> > > > }
> > > >
> > > > --- In AT91SAM@yahoogroups .com, "Eric Pasquier"
> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > Did you set the peripheral clock (PMC_PCER) ?
> > > > >
> > > > > Eric.
> > > > >
> > > > >
> > > > > ----- Original Message -----
> > > > > From: gamerz267
> > > > > To: AT91SAM@yahoogroups .com
> > > > > Sent: Thursday, January 24, 2008 3:28 AM
> > > > > Subject: [AT91SAM] spi pdc aic interupt
> > > > >
> > > > >
> > > > > i need some help with using aic with pdc. How do you initiate
> > > it. This
> > > > > is how i set it up.
> > > > >
> > > > > // Configure interupt when End of Transfer
> > > > > AT91F_SPI_EnableIt( pSPI, AT91C_SPI_ENDTX) ;
> > > > >
> > > > > // Configure the AIC for SPI interrupts
> > > > > AT91F_AIC_Configure It(AT91C_ BASE_AIC, AT91C_ID_SPI0,
> > > > > AT91C_AIC_PRIOR_ HIGHEST, AT91C_AIC_SRCTYPE_ INT_HIGH_ LEVEL,
> > > > SPI0_Handler) ;
> > > > >
> > > > > // Enable the interrupt on the interrupt controller
> > > > > AT91F_AIC_EnableIt( AT91C_BASE_ AIC, AT91C_ID_SPI0) ;
> > > > >
> > > >
> > >
>
Explore your hobbies and interests. Go to http://in.promos.yahoo.com/groups/

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )