Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read SPI data from slave #68

Open
silentjet opened this issue Jul 15, 2023 · 2 comments
Open

Unable to read SPI data from slave #68

silentjet opened this issue Jul 15, 2023 · 2 comments
Assignees
Labels
ArduinoCore-samd Label for ArduinoCore-samd UAY Unassigned yet

Comments

@silentjet
Copy link

silentjet commented Jul 15, 2023

Hi,
I'm trying to read the software version from peripheral device as a sanity check upon software startup and faced with very strange issue. I wrote a bare-bone code to check that, and it still has the same issue.

I'm sending a command 0x70 and I expect two bytes of response. Using a logic analyzer I can clearly see the response arrives and values are meaningful. But at the same time what is returned by SPI.transfer() it is zero instead of visible on analyzer values. I look through the library code and found out something like that
https://github.com/Seeed-Studio/ArduinoCore-samd/blob/v1.8.4/cores/arduino/SERCOM.cpp#L362

uint8_t SERCOM::transferDataSPI(uint8_t data)
{
  sercom->SPI.DATA.bit.DATA = data; // Writing data into Data register

  while(sercom->SPI.INTFLAG.bit.RXC == 0); // Waiting Complete Reception

  return sercom->SPI.DATA.bit.DATA;  // Reading data
}

I do not have too much knowledge about that, but I assume it shall work properly. But in reality it doesn't.

Hardware: Seeeduino XAIO SAMD21
Framework version: 1.8.4 installed via Arduino-IDE (GNU/Linux amd64)

image

@MatthewJeffson MatthewJeffson added UAY Unassigned yet ArduinoCore-samd Label for ArduinoCore-samd labels Oct 9, 2024
@Lesords Lesords self-assigned this Oct 14, 2024
@Lesords
Copy link

Lesords commented Oct 16, 2024

Hello,

I'm very sorry to have kept you waiting so long.

Do you still have this problem now?

@silentjet
Copy link
Author

silentjet commented Oct 17, 2024

Hello,
Sorry, can't say, cause I switched to another board (riscv based xaio).
I hope visible code can help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ArduinoCore-samd Label for ArduinoCore-samd UAY Unassigned yet
Projects
Status: Todo
Development

No branches or pull requests

3 participants