Hi,
In our board we have two ucontrollers sharing the same SPI bus. One of them is a S3A3.
We implemented a "bus claim system" in order to syncronize both masters, so they can know if the bus is available to be used or not. This "bus claim system" os working well.
The problem here is to have both SPI peripheral "opened" at the same time.
If we left the S3A3 SPI closed, we can communicate with the slave using the other ucontroller.
If we left the other ucontroller SPI closed, we can communicate with the slave using the S3A3.
If both SPI are opened, one messes with the other. For instance, S3A3 tries to generate the CLOCK signal, but this pin is being kept low in the other side by the other ucontroller which is in idle, so the S3A3 can't rise the signal until 3.3v (it reaches only 200mV).
I tried to solve this problem by keeping the SPI driver closed on the S3A3 when idle. Then, when I need to use the SPI (and I am able to use it after checking the sincronization system) I open the SPI driver, use the SPI and close it again. ( spi_mem.p_api->open(spi_mem.p_ctrl, spi_mem.p_cfg) and spi_mem.p_api->close(spi_mem.p_ctrl) )
I seems to work for a few cycles, then it breaks. The problem hangs.
Is it happening because I am making to many calls to open() and close()? Or maybe those calls are happening too often? Is there a limit to this approach?
Is there a alternative way to solve this?