adafruit333
New member
Hello together,
i want to use the SparkFun Qwiic KX13x library in combination with a Teensy 4.1. In a first test i didnt connect the Sensor board just to check if the library is compatible with the Teensy.
I use newest versions available for Arduino IDE (1.8.16),Teensyduino and the Sparkfun library(1.0.6).
The Example code for i2c interface is running (Serial Monitor shows "Could not communicate with the the KX13X. Freezing.", what is expected because i did not connect a Sensor).
In the next step i modified the programm to run with SPI Interface:
The result is that the Serial monitor only shows "Welcome.", but nothing more. After some seconds the Teensy restarts. So i guess the beginSPI function seems not to work.
I tested the same code withArduino Mega and there it seems to work (Serial Monitor shows "Could not communicate with the the KX13X. Freezing.").
I found the beginSPI (bool beginSPI(uint*_t, uint32_t spiPortSpeed = 10000000, SPIClass &spiPort = SPI); - Start communication with the KX13x via SPI.) function at https://learn.sparkfun.com/tutorials/triple-axis-accelerometer-breakout---kx13x-qwiic-hookup-guide-/kx13x-arduino-library
Anyone has an idea what the issue could be or some experience with the Sparkfun KX13x library in combination with Teensy?
Thank you in advance and best regards!
i want to use the SparkFun Qwiic KX13x library in combination with a Teensy 4.1. In a first test i didnt connect the Sensor board just to check if the library is compatible with the Teensy.
I use newest versions available for Arduino IDE (1.8.16),Teensyduino and the Sparkfun library(1.0.6).
The Example code for i2c interface is running (Serial Monitor shows "Could not communicate with the the KX13X. Freezing.", what is expected because i did not connect a Sensor).
Code:
#include <Wire.h>
#include "SparkFun_Qwiic_KX13X.h"
QwiicKX132 kxAccel;
void setup() {
while(!Serial){
delay(50);
}
Serial.begin(115200);
Serial.println("Welcome.");
Wire.begin();
if( !kxAccel.begin() ){
Serial.println("Could not communicate with the the KX13X. Freezing.");
while(1);
}
else
Serial.println("Ready.");
if( !kxAccel.initialize(DEFAULT_SETTINGS)){ // Loading default settings.
Serial.println("Could not initialize the chip.");
while(1);
}
else
Serial.println("Initialized...");
}
In the next step i modified the programm to run with SPI Interface:
Code:
#include <SPI.h>
#include "SparkFun_Qwiic_KX13X.h"
QwiicKX132 kxAccel;
const int CS = 10;
void setup() {
while(!Serial){
delay(50);
}
Serial.begin(115200);
Serial.println("Welcome.");
SPI.begin();
if( !kxAccel.beginSPI(CS, 1000000, SPI) ){
Serial.println("Could not communicate with the the KX13X. Freezing.");
while(1);
}
else
Serial.println("Ready.");
if( !kxAccel.initialize(DEFAULT_SETTINGS)){ // Loading default settings.
Serial.println("Could not initialize the chip.");
while(1);
}
else
Serial.println("Initialized...");
}
The result is that the Serial monitor only shows "Welcome.", but nothing more. After some seconds the Teensy restarts. So i guess the beginSPI function seems not to work.
I tested the same code withArduino Mega and there it seems to work (Serial Monitor shows "Could not communicate with the the KX13X. Freezing.").
I found the beginSPI (bool beginSPI(uint*_t, uint32_t spiPortSpeed = 10000000, SPIClass &spiPort = SPI); - Start communication with the KX13x via SPI.) function at https://learn.sparkfun.com/tutorials/triple-axis-accelerometer-breakout---kx13x-qwiic-hookup-guide-/kx13x-arduino-library
Anyone has an idea what the issue could be or some experience with the Sparkfun KX13x library in combination with Teensy?
Thank you in advance and best regards!