Hello PJRC Folk,
I am attempting to use SPI to interface with a Pressure Sensor (https://invensense.tdk.com/wp-content/uploads/2022/08/DS-000416-ICP-20100-v1.4.pdf). There is only one using SPI communication. I have had multiple generations of this interface and the most recent does not work. I have pinpointed the problem to the Chip-Select pin - for some Chip-Select pin selections on Teensy 4.0 this code works, for others it does not. I was operating under the assumption that any Digital IO pin should function as a Chip-Select pin (excluding some libraries, but I'm only using the standard SPI library).
I have searched through documentation on the forum and haven't found a similar issue for Teensy 4.0 as all information for standard SPI library, single device communication, says this should work.
As an example, if I use chip-select pin 16 SPI communication works, however if I use pin 7 for chip-select SPI communication does not work.
In general, the code selects parameters for the pressure sensor triggering an interrupt for each sample at 25Hz sample rate. The sensor drives a pin on Teensy low when new data is available, the interrupt triggers a data read, and the data is displayed in the next loop.
I have attached my full source code as it includes a library I wrote myself.
Thank you for any help
View attachment ICP20100_Testing.ino
View attachment ICP20100.h
View attachment ICP20100.cpp
I am attempting to use SPI to interface with a Pressure Sensor (https://invensense.tdk.com/wp-content/uploads/2022/08/DS-000416-ICP-20100-v1.4.pdf). There is only one using SPI communication. I have had multiple generations of this interface and the most recent does not work. I have pinpointed the problem to the Chip-Select pin - for some Chip-Select pin selections on Teensy 4.0 this code works, for others it does not. I was operating under the assumption that any Digital IO pin should function as a Chip-Select pin (excluding some libraries, but I'm only using the standard SPI library).
I have searched through documentation on the forum and haven't found a similar issue for Teensy 4.0 as all information for standard SPI library, single device communication, says this should work.
As an example, if I use chip-select pin 16 SPI communication works, however if I use pin 7 for chip-select SPI communication does not work.
In general, the code selects parameters for the pressure sensor triggering an interrupt for each sample at 25Hz sample rate. The sensor drives a pin on Teensy low when new data is available, the interrupt triggers a data read, and the data is displayed in the next loop.
I have attached my full source code as it includes a library I wrote myself.
Thank you for any help
View attachment ICP20100_Testing.ino
View attachment ICP20100.h
View attachment ICP20100.cpp