Go Down

Topic: has anyone used USART1 as spi sucessfully ? (Read 576 times) previous topic - next topic

ralphnev

the reason i'm asking is :
i want to use a PDC, which can be used with the USART & not with spi0/1


I'm guessing i have to modify pins in variants.cpp for digital outputs for the strange selection of pins
(A11-A16)

code so far:
Quote

void setup_spi()
{
    USART_SetTransmitterEnabled(USART1, FALSE);
    USART_DisableIt( USART1, 0xffff) ;
    USART_Configure(USART1,US_MR_USART_MODE_SPI_MASTER,  4100000, VARIANT_MCK);
    USART_SetTransmitterEnabled(USART1, TRUE);
    pmc_enable_periph_clk (ID_USART1); 
  
}
int spiout (void * buffer, uint32_t bufSize)
{
    USART_WriteBuffer(USART1,buffer,bufSize);
return usedSensorWidth;
}


Graynomad

Quote
which can be used with the USART & not with spi0/1

Why does it need a USART, if the USART is in SPI mode what's the difference?

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

ralphnev



Why does it need a USART, if the USART is in SPI mode what's the difference?


as stated:
the two SPI peripherals can not use PDC, USART(1-4) in spi mode CAN use the PDC

Other chips of the same family spi periphieral can use the PDC ...
why they don`t on the SAM3x8 .. no idea
..

Graynomad

Oh yes, sorry I was thinking an external protocol. You can't use the DMAC?

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

ralphnev


Oh yes, sorry I was thinking an external protocol. You can't use the DMAC?


for one application yes/ suppose so ..
looks more complicated than the PDC (& which i've used already  ... )
hmmm ...

but fot the other application / I can't because i would like to use the spi for SD card access
(using the USART as a fifo gateway to store data in an external memory)

Go Up