Express M4

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Urkadurka
 
Posts: 8
Joined: Fri Oct 03, 2014 12:16 pm

Express M4

Post by Urkadurka »

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

User avatar
adafruit_support_carter
 
Posts: 29163
Joined: Tue Nov 29, 2016 2:45 pm

Re: Express M4

Post by adafruit_support_carter »

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?

User avatar
Urkadurka
 
Posts: 8
Joined: Fri Oct 03, 2014 12:16 pm

Re: Express M4

Post by Urkadurka »

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

User avatar
adafruit_support_carter
 
Posts: 29163
Joined: Tue Nov 29, 2016 2:45 pm

Re: Express M4

Post by adafruit_support_carter »

Hmm. The link didn't come through for some reason. Are you using one these?
https://www.adafruit.com/product/4554

User avatar
Urkadurka
 
Posts: 8
Joined: Fri Oct 03, 2014 12:16 pm

Re: Express M4

Post by Urkadurka »

Yes !
This is the one that I'm using

Thanks
Urkadurka

User avatar
adafruit_support_carter
 
Posts: 29163
Joined: Tue Nov 29, 2016 2:45 pm

Re: Express M4

Post by adafruit_support_carter »

Try using this form of the call to initialize the ICM20948 for hardware SPI:

Code: Select all

icm.begin_SPI(ICM_CS);
Be sure that ICM_CS is a different pin than used for the TFT_CS

User avatar
Urkadurka
 
Posts: 8
Joined: Fri Oct 03, 2014 12:16 pm

Re: Express M4

Post by Urkadurka »

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

User avatar
Urkadurka
 
Posts: 8
Joined: Fri Oct 03, 2014 12:16 pm

Re: Express M4

Post by Urkadurka »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Metro, Metro Express, and Grand Central Boards”