here it is not allowing to post. 403 error.
The default sample rate appears to be 250 sps. You could try slowing it down to about 10 sps to test it out.
I do not have a MAX30003 board so I cannot actually try it out.
I cannot proceed any further without some new information.
ok. thanks. i have checked using logic analyser. when i simply run max30003 code then it gives correct output but when used sd.begin() then it gives issue to output of max30003 and make it 0.
The frequencies of SCK for MAX and SD are different. Is there any relation?
Please let me know if you have any new information.
I will leave you with this for today.
Hi there,
Just saying thank you…
This thread is a Clinic on HOW to ASK and answer posted questions.
Steller on both sides. Not to mention the outstanding INFORMATION exposed by the exercise. Knowledge Bomb
GL PJ
I used two SPI interfaces in this add External Grove FLASH Chip Demo
this snip from that code that may be relevant for using 2nd SPI int on the Nrf52840
@PJ_Glasso, thanks for the info.
The problem is to connect two SPI devices to one SPI interface. Since @kushal_patel seems to have a logic analyzer, I think he can solve this problem as long as he observes the proper waveforms.
I tried it with my BMP388 instead of the MAX30003. The SD part is a copy of your sketch.Even with the SPI clock set to 32 MHz, both SD and BMP388 operated without problems.
In your sketch, you operate the chip select to LOW and HIGH before and after accessing the device, but I don’t think this is necessary.
I don’t know if this will be helpful, but here is a sketch I tried.
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP3XX.h>
#include <SD.h>
#define BMP_SCK D8
#define BMP_MISO D9
#define BMP_MOSI D10
#define BMP_CS D7
#define chipSelect D0
#define SEALEVELPRESSURE_HPA (1013.25)
Sd2Card card;
SdVolume volume;
SdFile root;
Adafruit_BMP3XX bmp;
void setup() {
Serial.begin(115200);
while (!Serial);
delay(2000);
Serial.println("BMP388 / SD SPI TEST");
// SD card Initialization
Serial.print("\nInitializing SD card...");
pinMode(chipSelect,OUTPUT);
digitalWrite(chipSelect,LOW); //enable device
// if (!card.init(SPI_HALF_SPEED, chipSelect)) {
if (!card.init(32000000UL, chipSelect)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card inserted?");
Serial.println("* is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
while (1);
} else {
Serial.println("Wiring is correct and a card is present.");
}
Serial.println();
Serial.print("Card type: ");
switch (card.type()) {
case SD_CARD_TYPE_SD1:
Serial.println("SD1");
break;
case SD_CARD_TYPE_SD2:
Serial.println("SD2");
break;
case SD_CARD_TYPE_SDHC:
Serial.println("SDHC");
break;
default:
Serial.println("Unknown");
}
if (!volume.init(card)) {
Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
while (1);
}
Serial.print("Clusters: ");
Serial.println(volume.clusterCount());
Serial.print("Blocks x Cluster: ");
Serial.println(volume.blocksPerCluster());
Serial.print("Total Blocks: ");
Serial.println(volume.blocksPerCluster() * volume.clusterCount());
Serial.println();
uint32_t volumesize;
Serial.print("Volume type is: FAT");
Serial.println(volume.fatType(), DEC);
volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
volumesize /= 2; // SD card blocks are always 512 bytes (2 blocks are 1KB)
Serial.print("Volume size (Kb): ");
Serial.println(volumesize);
Serial.print("Volume size (Mb): ");
volumesize /= 1024;
Serial.println(volumesize);
Serial.print("Volume size (Gb): ");
Serial.println((float)volumesize / 1024.0);
Serial.println("\nFiles found on the card (name, date and size in bytes): ");
root.openRoot(volume);
root.ls(LS_R | LS_DATE | LS_SIZE);
digitalWrite(chipSelect,HIGH); //disable device
// BMP388 Initialization
// if (! bmp.begin_SPI(BMP_CS)) {
if (! bmp.begin_SPI(BMP_CS, &SPI, 32000000UL)) {
Serial.println("Could not find a valid BMP3 sensor, check wiring!");
while (1);
}
bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
bmp.setPressureOversampling(BMP3_OVERSAMPLING_4X);
bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
bmp.setOutputDataRate(BMP3_ODR_50_HZ);
}
// **********************************************************************************
void loop(void) {
if (! bmp.performReading()) {
Serial.println("Failed to perform reading :(");
return;
}
Serial.print("Temperature = ");
Serial.print(bmp.temperature);
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bmp.pressure / 100.0);
Serial.println(" hPa");
Serial.print("Approx. Altitude = ");
Serial.print(bmp.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");
Serial.println();
delay(1000);
}