Electronic – Multi master SPI mode? Or any intelligent way to switch only time between two masters

lcdmicrocontrollerspi

I have an LCD display which is powered from a pretty powerful micro, with GPU and all sorts of stuff. However, it turns out that it will take it over 5 seconds to boot the core. From a user experience perspective 5 seconds to see any boot up image/animation on screen after turn on is unacceptable.

So i was thinking of including a separate very cheap micro which can hold the master line for the first couple of seconds and provide the boot up image. It would then hand over the SPI bus to the main micro.

This of course is not the only use case of the smaller micro. I would also use it for all the backlight control. The larger micro might go into a sleep state and i would like for the smaller micro to still keep the display on. (So basically the main micro will simply tell the small micro what brightness to keep things on and a default brightness in case the main micro sleeps).

Is there any way i could hold the small micro as master for first 5 seconds and then let go to the main micro for the rest of the time (and as a bonus, hand it back to the small micro when the main micro goes into sleep)?

Thanks!

Best Answer

The main problem here is probably not to pick a suitable MUX - most analog switches will probably work. But rather how to sync "GPU" and "MCU". Because MCU should be speaking most of the time, except when GPU takes over, then it should be quiet.

The GPU can't just cut the SPI wires when it pleases, because then it will corrupt an on-going SPI transfer. This can have very bad side effects if the MCU is interrupted when writing commands to the display.

You can solve this by having the two devices listen to each others /SS lines and use that as a means of "arbitration".

GPU:

  • When /SS line out from MCU is pulled low, remain quiet during the on-going transmission.
  • When /SS from MCU goes high, grab the bus by starting a SPI transfer and thereby pulling /SS from GPU low.

MCU:

  • Before starting a SPI transmission, check /SS line from GPU.
  • If /SS line from GPU is high, we may send.
  • If /SS line from GPU is low, go passive/sleep for a certain amount of time, before checking again.

MUX:

  • Wire it so that the two different /SS lines are used as channel select, determining the source of MOSI and CLK. (MISO shouldn't be needed for most displays.) Either by finding a suitable switch or by inverting the signal of one of the masters through BJTs or similar.
  • You can perhaps make the MCU /SS recessive by connecting it through a 10k pull resistor, so that the GPU /SS can override it without having two outputs competing. I suppose there are lots of ways to solve this.