Pages: [1]   Go Down
Author Topic: has anyone used USART1 as spi sucessfully ?  (Read 504 times)
0 Members and 1 Guest are viewing this topic.
Ottawa,Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 82
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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;
}

Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8501
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Ottawa,Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 82
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8501
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Ottawa,Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 82
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: