SERCOM SPI - Data register

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

In SERCOM SPI slave communication , the slave is returning the same data  what master sends instead of returning the slave data (when Master trasnmit 0xAA ,slave should transmit 0x56) .

 

Suspecting that DATA register is not cleared after transmission. How to verify the data register cleared or not ?

Since  INTFLAG.DRE  bit in sercom_d51.h file is hardware register , can i access it through my software directly?

 

 

Karthi

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I’d suggest you look elsewhere. How have you determined what the slave is actually returning? Do you have a logic analyser? Do you realise with spi, if you send 0xaa, that the slave is concurrently returning a value as it has not received the 0xaa yet?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Thanks for your reply,

 

 

we verified our communication  with SPI analyzer.  In MOSI line we read 0xAA. but in MISO line we are getting the response of 0xAA in 3rd transmission ( for first two times 0x00 , 0xAA).  For first time transmission , slave is returning the junk data as it is sending the response in same clock. But from second transmission slave should respond correctly.but it's not.

 

 So we are suspecting that the data register not cleared before transmission.So its returning the same transmitted data as it is.

 

please provide your input on this issue.

Karthi

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The DATA register is not one register! There is the send and receive halves of it. I suspect that you code may not be handling the peripheral correctly.

Have you looked at the Arduino spi drivers for it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

Thank you. We are done with the SPI single byte read and write operation. Now we want to use spi multi byte transfer.

 

According to  SAMD51 datasheet, We have tried to enable the DATA32B bit in CTRLC register ( 35.8.3 Control C ) using Atmel studio 7.

 

We have tried with following API's.

 

hri_sercomspi_set_CTRLC_DATA32B_bit(hw);

hri_sercomspi_write_CTRLC_DATA32B_bit(hw , 1);

 

But we are failed to write or set the bit.

 

Kindly provide your input on this.

Karthi

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you set this before enable (the CTRLC register is enable protected)? Are you sure you need 32-bit DATA register, i.e., are you sure you need "better system bus utilization"?

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

We have enabled the bit, when spi module is disabled. But when we flashed this binary on board  , the board itself not booting properly (User led is not turned ON).

 

>>>>Are you sure you need 32-bit DATA register, i.e., are you sure you need "better system bus utilization"?

 

Yeah. We need multi byte transfer to increase the performance of AD operations.

 

Need your help to resolve this issue.

 

 

Karthi