Hello,
I'm using a TFT display based on ILI9341 driver, this uses a SPI line, at same time I would use ICM 26948 sharing the same SPI bus but with different Chip Select.
I tried to understand how to implement a second SPI bus by "https://learn.adafruit.com/using-atsamd ... -a-new-spi" but, I'sorry, without success.
So, please could someone redirect me to some example or indication for
- a common spi bus for TFT and ICM26948
- or some example to introduce the second SPI bus for the ADAFRUIT M4 Express
Thank a lot
Urkadurka
Express M4
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_carter
- Posts: 29163
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Express M4
In general, SPI should allow sharing the MOSI/MISO/SCLK pins. Each device needs its own CS pin.
What is the "banned 26948" device? Can you link to a product page?
What is the "banned 26948" device? Can you link to a product page?
- Urkadurka
- Posts: 8
- Joined: Fri Oct 03, 2014 12:16 pm
Re: Express M4
Hello,
Sorry a mistake of mine the item is ICM20948 (https://learn.adafruit.com/adafruit-tdk ... -9-dof-imu)
I tried to declare instance for TFT and accelerometer
TFT : tft.begin ....
ACCEL : while (!icm.begin_SPI(ICM_CS, ICM_SCK, ICM_MISO, ICM_MOSI))
Clearly the CS are different but the two instances seems not compatible, it means that I can access to the accelerometer but not on TFT.
It seems like something not compatible, or, I suppose, not correctly written in my code
TFT :
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
with
#define TFT_CS 6 // TFT select pin
#define TFT_DC 5 // TFT display/command pin
For the ICM80948
Instance of ICM Class I used Adafruit_ICM20948 icm;
Then here I try to open the communication
while (!icm.begin_SPI(ICM_CS, ICM_SCK, ICM_MISO, ICM_MOSI)) {
Serial.println("Failed to find MISO MOSI ICM20948 chip");
delay(500);
}
with these declarations :
// For SPI mode, we need a CS pin
#define ICM_CS 10
// For software-SPI mode we need SCK/MOSI/MISO pins
#define ICM_SCK 25
#define ICM_MISO 23
#define ICM_MOSI 24
I'm sure that I'm wrong but I need some support to understand to diagnose where and why :)
Thanks
Urkadurka
Sorry a mistake of mine the item is ICM20948 (https://learn.adafruit.com/adafruit-tdk ... -9-dof-imu)
I tried to declare instance for TFT and accelerometer
TFT : tft.begin ....
ACCEL : while (!icm.begin_SPI(ICM_CS, ICM_SCK, ICM_MISO, ICM_MOSI))
Clearly the CS are different but the two instances seems not compatible, it means that I can access to the accelerometer but not on TFT.
It seems like something not compatible, or, I suppose, not correctly written in my code
TFT :
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
with
#define TFT_CS 6 // TFT select pin
#define TFT_DC 5 // TFT display/command pin
For the ICM80948
Instance of ICM Class I used Adafruit_ICM20948 icm;
Then here I try to open the communication
while (!icm.begin_SPI(ICM_CS, ICM_SCK, ICM_MISO, ICM_MOSI)) {
Serial.println("Failed to find MISO MOSI ICM20948 chip");
delay(500);
}
with these declarations :
// For SPI mode, we need a CS pin
#define ICM_CS 10
// For software-SPI mode we need SCK/MOSI/MISO pins
#define ICM_SCK 25
#define ICM_MISO 23
#define ICM_MOSI 24
I'm sure that I'm wrong but I need some support to understand to diagnose where and why :)
Thanks
Urkadurka
- adafruit_support_carter
- Posts: 29163
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Express M4
Hmm. The link didn't come through for some reason. Are you using one these?
https://www.adafruit.com/product/4554
https://www.adafruit.com/product/4554
- Urkadurka
- Posts: 8
- Joined: Fri Oct 03, 2014 12:16 pm
Re: Express M4
Yes !
This is the one that I'm using
Thanks
Urkadurka
This is the one that I'm using
Thanks
Urkadurka
- adafruit_support_carter
- Posts: 29163
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Express M4
Try using this form of the call to initialize the ICM20948 for hardware SPI:
Be sure that ICM_CS is a different pin than used for the TFT_CS
Code: Select all
icm.begin_SPI(ICM_CS);
- Urkadurka
- Posts: 8
- Joined: Fri Oct 03, 2014 12:16 pm
Re: Express M4
Thanks for the suggestion, but I'm sorry I don't know so much the library strutcure, methods & properties.
Please do you have a link where I can read some documentation ?
Thanks
Please do you have a link where I can read some documentation ?
Thanks
- Urkadurka
- Posts: 8
- Joined: Fri Oct 03, 2014 12:16 pm
Re: Express M4
Hello, please to you have some indications about to manage at same time, one the same SPI bus or different SPI buses these two ADAFRUIT devices ?
1. https://www.adafruit.com/product/4554 , MPU9250
2. https://www.adafruit.com/product/1743, TFT display based on ILI9341
I don't need the solution but at least, please some indications ti understand the analysis way.
Thanks
1. https://www.adafruit.com/product/4554 , MPU9250
2. https://www.adafruit.com/product/1743, TFT display based on ILI9341
I don't need the solution but at least, please some indications ti understand the analysis way.
Thanks
Please be positive and constructive with your questions and comments.