ADS1262 SPI Issue

I am interfacing ADS1262 with Arduino mega2560 along with TFT and sd card.
The example given in library of ads1262 is working perfectly but when I interface ads1262 with other slave at that time, sometimes it activate and given output and sometimes it does not activate so not getting serial output.
The library is given on GitHub - Protocentral/ProtoCentral_ads1262: https://www.protocentral.com/breakout-boards/1005-protocentral-ads1262-32-bit-precision-adc-breakout-board.html.
Is there voltage related problem or anything else? As I am using Vcc from external supply.
I have attached the main part of the program as “ADS1262 Issue” file while full program is attached for your reference.
It may be purely SPI communication base issue.

Circuit.pdf (350 KB)

ADS1262 Issue.pdf (33.7 KB)

Potentiostat_Code_8.2.17.ino (21.1 KB)

You cannot use voltage divider as level converters on an SPI bus. Get a level converter with MOSFETs (or a similar technology) to connect 3V3 devices.

Hi Pylon,

The voltage divider is used to convert 5V to 3.3V for TFT and TFT is working fine.
But when I inteface ADS1262 with TFT, at that time the ADS1262 is not giving right value although TFT is still working fine.
Individually, the ADS1262 is working normal and giving right value.
Along with TFT, ADS1262 is giving garbage value.

One more thing I have found that the SPISetClockDivider is different for TFT (DIV2) and ADS1262 (DIV8). Is it affect the ADS1262 operation?? (Giving garbage value!!!)

The voltage divider is used to convert 5V to 3.3V for TFT and TFT is working fine.

But the voltage divider is connected to the SPI bus and flattens all signals on it. It's possible that your display is not so picky about that but the ADS1262 is. All chips have small capacitances on the digital signals and together with the resistors of the voltage divider they form RC filters which flattens the edges of the signals. This is especially bad for the SCKL signal which is often required to have fast edges. Use a logic level converter and remove the voltage dividers!

One more thing I have found that the SPISetClockDivider is different for TFT (DIV2) and ADS1262 (DIV8). Is it affect the ADS1262 operation?? (Giving garbage value!!!)

You didn't provide a link to the libraries you use, so I cannot tell you if that might be a problem. If the library use the new SPI.beginTransaction() and SPI.endTransaction() calls this should be a problem, otherwise it probably is.

Hello Pylon,

Please find the library link for ADS1262 and TFT.

The Adafruit library has a low level SPI transaction implementation included while the ProtoCentral library hasn't. This means if you call the initialization method of the ADS1262 library after the initialization of the display, you should be fine. As you didn't provide full code to us, you have to check yourself. What SD card board do you use? Is it's CS really connected to pin 53? Why do you handle the SPI CS in your code although the SD library of current IDEs (>= 1.8.0) handle that correctly?

Hi Pylon,

I have attached code for reference.
In the code, you can see that the initialization of TFT is called first and after that initialization of ADS1262 is called (Although voltage divider is there with TFT). Still ADS1262 is giving garbage value.
I am using CATALEX MicroSD Card Adapter (photo attached) and yes, its CS is connected to pin 53.
Sorry but I am not getting you last statement “Why do you handle the SPI CS in your code although the SD library of current IDEs (>= 1.8.0) handle that correctly?”. What is it mean? Please elaborate.

Potentiostat_Code.ino (20.2 KB)

How do you connect that SD card board to the Arduino? Do you have schematic for it? I cannot find any useful information about that board, seems to be one of the overly cheap Chinese boards: https://www.reddit.com/r/arduino/comments/2vkp81/fyi_catalex_microsd_card_adapter_does_not_play/. Does it have a level converter onboard? Do you feed it with 3V3 or 5V? Is a voltage regulator on that board? SD cards work with 3V3 and all SPI signals must have that voltage level.

Try removing the SD card board. If it works then you can try the work-around mentioned in the above post.

Hello Pylon,

The schematic for SD card and ADS1262 to board is given in attached file.
I am feeding 3.3V. It is working independently but facing issue in SPI with other slaves.

Circuit.pdf (350 KB)

The schematic for SD card and ADS1262 to board is given in attached file.
I am feeding 3.3V.

I was asking for the schematics of that SD card board. You already posted the wiring diagram.

Interestingly in the wiring diagram you’re feeding the SD card board with 5V.

It is working independently but facing issue in SPI with other slaves.

Did you read the linked article? I would throw away that SD card board and get one with that is known to work in the Arduino environment.

BTW: I still think you should replace your voltage dividers by a level converter. You can then use the same signal to feed your Catelex SD card adapter.

Hello Pylon,

I have already replace the voltage divider by level shifter - TXS0108E (image attached). In this configuration, I am feeding 3.3V to sd card.
I have also removed the Catelex SD card adapter and used the SD adapter of 2.2 TFT (Image attached) along with TFT but in that case also facing the MISO pin issue (as described earlier, https://forum.arduino.cc/index.php?topic=460701.0).
The sd card is not initialized with TFT (TFT is working fine) means both are not working together.

For SPI interfacing, I have tested two slaves with Mega board and found the below result when MISO is connected with both slaves and MISO pin is removing one by one from slaves.

SPI Interfacing MISO PIN Connection Result
TFT + SD TFT-YES SD-YES TFT Working, SD not initialized
TFT + SD TFT-NO SD-YES TFT not Working, SD working
ADS1262 + SD ADS - YES SD-YES Both are not working
ADS1262 + SD ADS - YES SD-NO ADS working, SD not initialized
ADS1262 + SD ADS - NO SD-YES ADS not working, SD working
ADS1262 + TFT ADS - YES TFT - YES TFT Working, ADS1262 not working
ADS1262 + TFT ADS - YES TFT - No TFT not Working, ADS1262 working

From Above result, I thing it may be the problem of MISO pin.

I am not getting the idea, how to solve the problem in SPI interfacing in multiple slaves.

15801287_1235761693183674_897005879_n.jpg

TXS0108E.JPG

I have read in one article that "Only one device, the one whose SS line is asserted low, is participating in the transfer by driving its MISO line – all other devices are expected to have their MISO line in a third state."
How can we put MISO line in a third state of all other slave devices?
Any comment please.

I have read in one article that "Only one device, the one whose SS line is asserted low, is participating in the transfer by driving its MISO line - all other devices are expected to have their MISO line in a third state."
How can we put MISO line in a third state of all other slave devices?

By driving their CS line high. I always thought that you're doing that. It's probably not a problem of the MISO line but a problem of your programming. Please post the code you're using for your tests. The code you already posted cannot be the one you used because it doesn't compile (there are syntax errors).

Keep in mind that the SPI bus has several options that must fit the used chip and often are set in the library code only in the initialization. If that is the case only the library initialized last uses the correct settings the others may fail if they use other options. Options are the SPI mode and the speed. Newer versions of the IDE changed the interface and offer the possibility to use SPI.startTransaction() and SPI.endTransaction(). You might want to add that to your libraries to support your multi-device setup.

Hi Pylon,

Please find the test code for TFT and SD Card interfaced with Arduino Mega.
In code, the SD card is not initialized although TFT is working normal.
If I remove the MISO pin of TFT from set up, the SD Card is initialized.

SD_TFT.ino (1.21 KB)

I have also tested with SPI settings for multi device set up but found same problem.

I am interfacing TFT and SD card with arduino mega board and running a simple code, given below, but sd card is not initialized.

#include “SPI.h”
#include “Adafruit_GFX.h”
#include “Adafruit_ILI9341.h”

#include <Wire.h>
#include <SD.h>

#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS A5

File myFile;

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

#define HALF_CLOCK_PERIOD 1

void setup()
{
Serial.begin(9600);
SPI.begin();
pinMode(53, OUTPUT);

if (!SD.begin(53)) {
Serial.println(“SD initialization failed!”);
}
else Serial.println(“SD Card initialization done.”);

tft.begin();
tft.println(“Welcome”);
}

void loop()
{

}

When I remove the MISO pin of TFT, at that time SD card is initialized and working normal.
I think it is a SPI based issue. I have tried a lot but could not get the success.
How can i solve the issue?

How can I generate a separate MISO & MOSI pin for SD card and other slaves??

Please provide a link to your TFT display driver. It seems that it's not really using a correct SPI interface.

How can I generate a separate MISO & MOSI pin for SD card and other slaves??

It's probably not the SD card that causes problems but the TFT, at least from your description of the problems.

Do you have schematics of the boards (TFT) you have in use?

Pylon,

The photo of TFT display is attached here. Its a QVGA 2.2 TFT SPI 240x320 display and driver link is GitHub - adafruit/Adafruit_ILI9341: Library for Adafruit ILI9341 displays.
I have attached the schematic, which found by google search.

The attached schematics shows a setup with an ATmega328 that has both the TFT and the SD card connected. So it seems that this configuration should run. Please provide a wiring diagram of your current setup. I'm not clear about how you integrated the level converter in your setup. As both devices in concern (TFT and SD card) are operating at 3V3 they should be both behind the level converter. On the high voltage side of the level converter just the Mega should be connected.

Just to clear that point to: if you connect both the TFT and the SD card you use the code last posted? In this case the SD card cannot be initialized because the CS line of the TFT is not pulled high while accessing the SD card.

The library you're using are not explicitly made to work together, you have to help them a bit.

Hi Pylon,

Please find the wiring diagram of current setup.
As you can see that both device i.e. TFT and SD card are at the 3V3 side where as ADS1262 (ADC Module) is at 5V side.

I have interface all three slaves with Arduino Mega and the program is attached here.
I have tested and found that the SD card is not initialized where as TFT and ADS1262 is working fine.

When I remove the ADS1262 and run the program for TFT and SD card, at that time, TFT and SD card both are working fine.

ADS1262 is operating on SPI mode 1. May it be the issue of SPI mode? Which spi mode is use for SD card?

_270317_SD_ADS_TFT.ino (4.62 KB)

Circuit_16.3.17.pdf (530 KB)

When I remove the ADS1262 and run the program for TFT and SD card, at that time, TFT and SD card both are working fine.

No, it's an issue with the level converter. The level converter blocks the MISO line for the ADS 1262 because you pulled OE HIGH. If you connect OE to GND you get the desired behavior of the level converter but the speed is lowered to max. 1.2 MHz so you have to ensure that the SPI runs at 1MHz.