Multiple SPI devices

I have an ST7920 128x64 LCD display in SPI mode, however I also need to use an SD card reader module. I tried to give them both different SS pins, but it seems the lcd doesn't care if SS is low or not, it always listens for the data. Am I doing something wrong here?

The ST7920 has a /CS pin. It should be active when you write to the display. And in-active when you stop writing.
Any respectable library will control the /CS pin correctly.

Which library? The Library Manager (or build report) will tell you.
What constructor? Have you specified the CS pin?

David.

david_prentice:
The ST7920 has a /CS pin. It should be active when you write to the display. And in-active when you stop writing.
Any respectable library will control the /CS pin correctly.

Which library? The Library Manager (or build report) will tell you.
What constructor? Have you specified the CS pin?

David.

I'm using the U8g2 library, here is the constructor:
U8G2_ST7920_128X64_1_HW_SPI u8g2(U8G2_R0, /* CS=/ 53, / reset=*/ 8);
The CS pin (labeled RS on the display) is low when I'm measuring it, but when I set it to high in the software it goes high, but the lcd doesn't care.

My apologies. There seem to be several reports on the Internet about CS being ignored.

I will try for myself later.

David.

Yes, the ST7920 still responds to SPI even when CS is in-active.

    const int SPI_CS = 7;
    const int OLED_CS = 10;
    digitalWrite(OLED_CS, LOW);  // CS is active-high for ST7920
    delay(1000);
    pinMode(SPI_CS, OUTPUT);
    digitalWrite(SPI_CS, LOW);   // most SPI devices are active-low
    for (int i = 0; i < 32; i++) SPI.transfer(0x55);
    digitalWrite(SPI_CS, HIGH);
    delay(1000);

Looking at the datasheet it implies that CS is important as an active-high “chip-select”. A Rising edge is used for for synchronising e.g. for sending the RW and RS bits.

From the internet discussions people try disabling SCK to the ST7920 when CS is in-active.

The easiest solution is to bit-bash software SPI for the ST7920 on different GPIO pins.

David.