This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE?: RE?: RE?: Does AT91 SPI driver support external SPI devices?


On Wed, Feb 28, 2007 at 05:45:38PM +0100, Julien St?phane wrote:
> Yes, the processor is a AT91M55800A. Effectively, it has only one SPI device.
> 
> First, I printed the values of "val" in the set_npcs
> function. Effectively, they change when I change the dev_num
> value. As I understand the function and the values printed, it is
> not writed to work with a multiplexor.

Yes it is. Look at spi_at91_start_transfer() where it calls
spi_at91_set_npcs().

> static void
> spi_at91_set_npcs(cyg_spi_at91_bus_t *spi_bus,int val)
> {
>    /*cyg_uint32 ctr;
>    for(ctr=0;ctr<4;ctr++)
>    {
>       printf("### val1=%i, val2=%i ###\n",val, (val & (1<<ctr)));
>       if(spi_bus->cs_en[ctr])
>       {
>         HAL_ARM_AT91_GPIO_PUT(spi_bus->cs_gpio[ctr], (val & (1<<ctr)));
>       }
>    }*/
>    
>    HAL_ARM_AT91_GPIO_PUT(spi_bus->cs_gpio[0], 0);
>    HAL_ARM_AT91_GPIO_PUT(spi_bus->cs_gpio[1], 1);
>    HAL_ARM_AT91_GPIO_PUT(spi_bus->cs_gpio[2], 0);
>    HAL_ARM_AT91_GPIO_PUT(spi_bus->cs_gpio[3], 1);
> }
> 

> I have tried many values for the different bits because I don't know
> which is the MSB and the LSB. No changes appeared. I never had the
> chip select CS5-8 activated.

And what happens to the actual chip pins, not the demultiplexor pins.
Does the chip pins change?

It could be something like the GPIO functions are not working for the
AT91M55800A.

Which pin is your LED on?

Try something like:
HAL_ARM_AT91_GPIO_CFG_DIRECTION(AT91_PIN_LED, AT91_PIN_OUT);
for(;;) {
        HAL_ARM_AT91_GPIO_PUT(AT91_PIN_LED,0);
        cyg_thread_delay(100);
        HAL_ARM_AT91_GPIO_PUT(AT91_PIN_LED,1);
        cyg_thread_delay(100);
}

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]