Hi,
I have been able to add software SPI ports but they are slow. On the grand central M4 is it possible to add a 2nd SPI hardware port. If so, please let me know how to do this.
Thanks,
Jim
Add 2nd Hardware SPI port
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15660
- Joined: Tue Oct 20, 2015 3:22 pm
- lalith
- Posts: 12
- Joined: Tue Nov 26, 2019 10:13 am
Re: Add 2nd Hardware SPI port
I tried the method by the way it is in the link and i am not successful. I am using itsybitsy m4 SAMD51 device. I wanted to use sercom0 and i think I cannot find the pin numbers defined properly in variants.h file for the sercom0. please help me. here is my code: I think the pins are A1, D2(2), A5 I am looking at
Code: Select all
#include "SparkFunLSM6DS3.h"
#include "SPI.h"
#include "wiring_private.h"
SPIClass mySPI (&sercom0, 5, 7, 6, SPI_PAD_2_SCK_3, SERCOM_RX_PAD_1);
int LSM_CS = 13 ;
void setup() {
// put your setup code here, to run once:
pinMode(LSM_CS, OUTPUT);
mySPI.begin();
pinPeripheral(5, PIO_SERCOM_ALT);
pinPeripheral(7, PIO_SERCOM_ALT);
pinPeripheral(6, PIO_SERCOM_ALT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LSM_CS, LOW);
mySPI.transfer(0x88|0x0F);
int whoami = mySPI.transfer(0x88);
Serial.println(whoami, HEX);
digitalWrite(LSM_CS, HIGH);
}
Last edited by Franklin97355 on Fri Jan 17, 2020 2:46 pm, edited 2 times in total.
Reason: Added code tags
Reason: Added code tags
- lalith
- Posts: 12
- Joined: Tue Nov 26, 2019 10:13 am
Re: Add 2nd Hardware SPI port
I think the pins are A1, D2(2), A5 I am looking at
- Jimbee
- Posts: 45
- Joined: Wed Aug 01, 2018 12:49 pm
Re: Add 2nd Hardware SPI port
Hi Dave,
Thanks for your link. As stated I can create software spi ports no problem but they are slower. I need to create a 2nd hardware port - not sure if this can be done without editing library files.
Thanks,
Jim
Thanks for your link. As stated I can create software spi ports no problem but they are slower. I need to create a 2nd hardware port - not sure if this can be done without editing library files.
Thanks,
Jim
- lalith
- Posts: 12
- Joined: Tue Nov 26, 2019 10:13 am
Re: Add 2nd Hardware SPI port
Hi, what do you mean by that you created a software spi port? do you mean using sercom? or bitbanging? can you share the code how you added?
Please be positive and constructive with your questions and comments.