Who am I talking to ?

Today, I came across a problem regarding the information exchange between the STM32 and ESP32 of the main_pcb. What makes the situation a bit special is that not only can the STM32 want to talk to the ESP32, it can also send it information meant for another device. The latter case is about responding to a shell command which must be forwarded through WiFi. Thus the ESP32 here acts a little like a router.

The problem was the following. How can we know if a given byte is meant to be forwarded or not ? As we planned not only an UART connection but also an SPI connection between the STM32 and the STM32, we can use one for each type. Another hardware solution is to add a another line to the UART bus (we plan to use only this one if possible) which only gets low or high to signal what to do with the byte being delivered. The last solution we came up with is a software one. We could simply add to every message its length and its destination.

I think that the easiest and fastest solution is the second one. However we may have some synchronization problems where some bytes are wrongly allocated. We will conduct some tests in this direction soon.

Leave a Reply

Your email address will not be published. Required fields are marked *