1

I have interfaced sd card and ADS1262 (ADC module) with Arduino mega board and sharing the SPI control pin i.e. SCK, MISO and MOSI. I have found that sd card is not initialized and ADS1262 is giving garbage value. Now if I remove the MISO pin of sd card then ADS1262 is giving right (although SD card is not initialized.) Vice-versa, if I remove the MISO pin of ADS1262, sd card is initialized and working perfectly (although ADS1262 is giving garbage value.)

Certainly, there is issue of MISO pin. How can I share MISO pin with both slaves so that both can work properly.

Any comments please.

I am using shifter - TXS0108E.

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.

enter image description here

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.

Schematic:

enter image description here

5
  • 1
    Please show us how you've connected everything. Especially the CS pins and the TXS0108E.
    – Gerben
    Commented Mar 9, 2017 at 9:55
  • It could be the TXS0108 interfering with the SPI bus. MISO must be in a high impedance mode on all inactive devices - the TXS may not be doing that. You need to force it by holding OE LOW when the TFT is not in use. Connect it to the TFT's CS pin through a NOT gate, or use a second IO pin and assert it the opposite of the TFT CS pin.
    – Majenko
    Commented Mar 9, 2017 at 11:43
  • Also SD cards are notoriously bad at sharing the SPI bus. Try different SD cards.
    – Majenko
    Commented Mar 9, 2017 at 11:43
  • See How do you use SPI on an Arduino?. From your now-deleted comment: all other devices are expected to have their MISO line in a third state - in other words, input (high impedance). First state is output+high, second state is output+low, third state is input.
    – Nick Gammon
    Commented Mar 9, 2017 at 20:32
  • Hi Nick, i got the point that all other devices are expected to have their MISO line in a third state but I am not getting the logic that how can I put the inactive device's MISO line in a third state. TFT and SD card both are working on the TXS0108E and the ADS1262 is working directly on 5V. I have still many IO pins to use so it is better to use IO pin to make the MISO pin in third state, if any logic is there.
    – user29850
    Commented Mar 14, 2017 at 4:07

2 Answers 2

1

You probably want to use two SPI busses. If you absolutely need to use one bus, attach a digital out pin to each of the CS pins, one on the 1262 and one on the SD card. When you need to talk to one of the deviced, pull its CS line low to enable it.

2
  • I am interfacing ADS1262, SD card and TFT with arduino mega. In that, I am sharing the all three spi lines i.e. miso,mosi and sck. All three slaves has individual cs line. But only, TFT is working fine, ads1262 is giving garbage value and sd card is not initialized, Although, individually, each slave is working fine. I have tested two slaves with arduino mega (instead of all three slaves) and found above given table's result. If I remove the one slave's miso pin, the other slave is working fine and vice versa. So it is the purely spi base problem. but i don't get idea to solve the problem.
    – user29850
    Commented Mar 9, 2017 at 6:47
  • 1
    You mention in passing that you use a shifter, yet you don't say what you are shifting or where you are shifting it. A full schematic of the whole SPI portion of your project is required.
    – Majenko
    Commented Mar 9, 2017 at 10:57
0

Some sd card modules which use 5v-3.3v logic level shifters may not have a proper circuit wich is very well explained in this guys blog

http://www.vishnumaiea.in/projects/hardware/interfacing-catalex-micro-sd-card-module

so until you don't make some changes in the sd card module you wont be able to have multiple slaves on your spi bus.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.