EEVblog Electronics Community Forum
A Free & Open Forum For Electronics Enthusiasts & Professionals
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
This topic
This board
Entire forum
Google
Bing
Home
Help
Search
About us
Links
Login
Register
EEVblog Electronics Community Forum
»
Electronics
»
Microcontrollers
»
SPI on SAMD21G18 not working
« previous
next »
Print
Search
Pages: [
1
]
Go Down
Author
Topic: SPI on SAMD21G18 not working (Read 1077 times)
0 Members and 1 Guest are viewing this topic.
malrip
Newbie
Posts: 5
Country:
SPI on SAMD21G18 not working
«
on:
February 16, 2022, 05:02:07 pm »
Hello,
I've been attempting to use SERCOM2 SPI Master on the SAMD21G18J but have been unsuccessful. I tried the configurations with SERCOM0 and SERCOM4, and they both worked. The most intriguing behavior is that when I initialize the SERCOM2 SPI, all of the other I/O pins stop working as well. The clock is not generated, and CS is not operational.
I tried several bootloaders, but the results were the same. To begin, I used the bootloader of an Arduino nano IOT 33, which uses the same chip, in order to use the arduino IDE more easily. Then, I tested with the bootloaders Arduino zero and adafruit M0 bootloader. The idea of testing other bootloarders was because arduino ano iot 33 uses SPI SERCOM2 to communicate with his WIFI module, and could be protected some how. Any insight will be useful.
The schematic is displayed below:
https://community.atmel.com/sites/default/files/forum-images/462842-body-1645030566-1.jpg
The SERCOM2 Pads:
https://aws1.discourse-cdn.com/arduino/original/4X/7/3/9/73938e5c4bae0c9fbcc55e3ba7afc86408f0e02b.png
Main routine:
https://www.codepile.net/pile/y6bB1d6w
Header file:
https://www.codepile.net/pile/l56XN6x3
Logged
snarkysparky
Frequent Contributor
Posts: 418
Country:
Re: SPI on SAMD21G18 not working
«
Reply #1 on:
February 16, 2022, 07:35:23 pm »
I look at it quickly so I may have missed something.
I see you setup the slave select. But you also have to setup the other pins. Is that somewhere else ?
Logged
malrip
Newbie
Posts: 5
Country:
Re: SPI on SAMD21G18 not working
«
Reply #2 on:
February 16, 2022, 10:47:34 pm »
No problem. I have set to master at line 41: SERCOM2->SPI.CTRLA.bit.MODE = 0x3; //SPI in Master mode
The other pins are set on lines 38, and 39, DIPO and DOPO registers.
Logged
thm_w
Super Contributor
Posts: 7037
Country:
Non-expert
Re: SPI on SAMD21G18 not working
«
Reply #3 on:
February 17, 2022, 12:58:36 am »
atmel link:
https://www.avrfreaks.net/forum/spi-samd21g18-not-working
I'm sure this is unrelated, but, why is pin 18 not connected to Gnd?
Can you try without a bootloader, do you have a proper programmer? But then you'd have to set up clocks, etc.
«
Last Edit: February 17, 2022, 01:04:48 am by thm_w
»
Logged
Profile -> Modify profile -> Look and Layout -> Don't show users' signatures
malrip
Newbie
Posts: 5
Country:
Re: SPI on SAMD21G18 not working
«
Reply #4 on:
February 17, 2022, 11:13:58 am »
Oh, I forgot about this pin. If SERCOM2 requires this pin to function, it would be a strange coincidence. I'll solder this pin to ground and see what happens. Yes, I burned the bootloader using Segger J-link and Atmel Studio.
Logged
Print
Search
Pages: [
1
]
Go Up
« previous
next »
Share me
Smf
EEVblog Electronics Community Forum
»
Electronics
»
Microcontrollers
»
SPI on SAMD21G18 not working
There was an error while thanking
Thanking...
EEVblog Main Site
EEVblog on Youtube
EEVblog on Twitter
EEVblog on Facebook
EEVblog on Odysee