ST7565 + MCP23S17 / Conflict?


I’m using multiplexing with two MCP23S17s and a ST7565 GLCD.

I can get each to respond as expected on their own, but together has turned in to a bit of a minefield!

Here’s my code:




CS   - (7)
RST  - (8)
A0   - (9)
SID  - (11)
SCLK - (13)


CS   - (10)
MOSI - (11)
MISO - (12)
SCLK - (13)


#include <SPI.h>
#include <MCP23S17.h>
#include "ST7565.h"

MCP onechip(0);
MCP twochip(1);

ST7565 glcd(11, 13, 9, 8, 7);

void setup() {





void loop() {


  glcd.drawstring(0, 0, "!!!TEXT!!!");

I can call the libs etc, but as soon as I set up ‘MCP name_Of_IC’ (MCP onechip(0) / MCP twochip(1)) I get a change of colour, but lose the printout on the LCD.

I thought this may be something to do with the clock divider in ‘MCP23S17.cpp’. but changingn this has no effect.

Does anyone have any ideas as to how to get this working?

I may have missed something obvious, however, I can now feel my brain leaking out of my ear…

Thanks in advance for any help!

ST7565 glcd(11, 13, 9, 8, 7);

Pins 11 and 13 are part of the SPI interface. They are NOT available for you to attach your LCD to, while using the SPI interface.

OK. Thank you.

I assumed I could use the same clock and data out.

I will try it with different pins.

You can if they are both using the SPI bus. It isn't clear from what you've written whether or not that is true.

I am currently using the default libs for both.

I was told that by ditching the standard lib and bitbanging the outputs I could get a near x10 refresh rate, as things look a bit sluggish when it comes to bitmaps etc, so will be trying this out in the next few days hopefully.

Could I move everything back up with this approach?

I'm looking in to rooting out all the digitalWrites generally, but was told that software serial may be the way forward.

I also have an SD attached, and it's all happily working, but I have now run out of dynamic memory (I've still got a fair bit of room in the program memory).

I'd also like to free some more pins up, so will have a look around for anything SD/LCD/Expander related to see if I can get this all working a bit faster/more responsive.

I think I saw something about using the SD as RAM/additional memory.

Longer term I'll probably end up moving everything up to the DuE anyway, otherwise it looks like I'm going to be using lots of dedicated 328s..

I'm looking to keep things all as streamlined as possible, so, any suggestions on the combination of these would be appreciated!