EEPROM sharing between 2 STM32 microcontrollers - Page 1
Forum section: electronics / projects

author: emilmon
author_rank: Newbie
timestamp: June 22, 2015, 10:52:36 am
content: hi,i am planning to design a redundant system which contains 2 micro controllers. i am using STM32F103VCT micro controller. i am using an EEPROM which is SPI compatible.The primary micro controller will write and read all the time to the EEPROM. The redundant micro controller will read the data when the primary micro controller fails.can any one suggest whether i acan connect the SPI channels directly or i have to use any switches.thanksemil

author: Kjelt
author_rank: Super Contributor
timestamp: June 22, 2015, 11:27:21 am
content: I think you need a spi mux where the second uC can overrule the first.If the first uC crashes you can not guarantee that the spi buslines of the uC will be Z (floating) so if the uC crashes with the SPI lines pulled active low there is no communication possible.That said, for redundant systems, if you are writing to the eeprom all the time please make sure the guaranteed write cycles of the eeprom * times you are writing > lifetime of the product.

author: Psi
author_rank: Super Contributor
timestamp: June 22, 2015, 11:42:20 am
content: You could have the backup MCU acting as a SPI passthrough between the eeprom chip and the main MCU.If the main MCU fails the backup can have full eeprom control.If the backup MCU fails the main mcu will at least detect the fault because it wont have eeprom access any more.I guess it depends if you want fault detection more than fault tolerance or vice versa.Ideally you could use a dual port SPI eeprom chip

author: wraper
author_rank: Unknown
timestamp: June 22, 2015, 11:47:32 am
content: If two microcontrollers use the same eeprom, I wouldn't call such a system redundant. I would expect corrupted data in the eeprom.

author: Fungus
author_rank: Super Contributor
timestamp: June 22, 2015, 12:17:53 pm
content: An i2c EEPROM will share much more easily.PS: What happens if the first MCU fails with active signals on the SPI bus? The second MCU needs to be able to completely disconnect the first MCU.

author: Fungus
author_rank: Super Contributor
timestamp: June 22, 2015, 12:19:36 pm
content: Quote from: Psi on June 22, 2015, 11:42:20 amWhat happens if the backup MCU fails first? In that case neither will have access.There's no point in adding more chips if they don't actually increase the overall reliability.

author: German_EE
author_rank: Super Contributor
timestamp: June 22, 2015, 05:00:35 pm
content: You might be able to get this to work but it will require some very careful programming. SPI works by using a shift register on each device so if you have sixteen bits of data then you present it one bit at a time to the input pin using sixteen clock pulses. Another sixteen pulses should shift the data out of the device through the data out pin and on to the next chip.So.......Shift data out of CPU # 1 into the EEPROM, then shift it into CPU # 2, then shift it back into CPU # 1 where it can be checked. The problem with this scheme is that CPU # 2 can only access the memory via CPU # 1 and if the first CPU dies then so does your system.Let me think about this one for a while

author: LabSpokane
author_rank: Super Contributor
timestamp: June 22, 2015, 05:08:37 pm
content: This is a genuine question, not a criticism:How did you determine that the MCU would be the failure mode that would require redundancy as opposed to any other component?

author: BennVenn
author_rank: Regular Contributor
timestamp: June 22, 2015, 08:43:30 pm
content: Have MCU1 and MCU2 on the same SPI bus with MCU2 ports floating. MCU1 provides a heartbeat to MCU2. If MCU2 doesn't detect the heartbeat it will force MCU1 into a reset state which will make MCU1 SPI bus high-z and MCU2 can gain control until MCU1 performs a controlled reset where it is handed over control.

author: Jeroen3
author_rank: Super Contributor
timestamp: June 26, 2015, 10:08:09 am
content: What are the possible causes for MCU1 to fail?You need to know these to make any claims about the reliability of the dual mcu system.Or are you attempting dual mcu to avoid firmware bugs?

author: Scrts
author_rank: Frequent Contributor
timestamp: June 26, 2015, 10:57:34 am
content: And why not using dual core systems? ST already have these and we use them with lockstep.Freescale too. Renesas too.

author: ketil b
author_rank: Regular Contributor
timestamp: June 26, 2015, 11:24:12 pm
content: If you are going for a redundant system is it not better to have two mcu's and two eeproms then have the mcu's communicate to keep the eeproms in sinc. This may also give you a way to tell if the other mcu is down, if you try sinc and get timed out.thanksketil