UART, UART, UART (and shell)

As explained in this post, we have decided to use FreeRTOS on our main board. Last week, Sibille and Vlaya have successfully adapted the frame sending code for SPI buses. For The past few days, Sibille and I have wrestled with the UART communication code. 

Here is how the code evolved since my last post.

Shell implementation

At first, when I began coding the UART server, it was closely related to the shell (over WiFi). I also communicated with the ChibiOS shell on the other side of the UART. The next step of my reflexion was to realize that it wasn’t natural to have the shell on the STM32 rather than the ESP32 and I stopped using the ChibiOS shell. … Read more

UART’s breakthrough !

Today, thanks to Xavier’s tips, I finally managed to write a satisfying workflow for the UART server. I used the ChibiOS’ mailbox system on the STM32 and emulated it with queues on the ESP32.

Each applications is in charge of allocating the actual memory space of the data. The server only manages a 256 words long table to store a single pointer for each of the 256 possible ports. This pointer references two mailboxes. One enables the application to provide a buffer and its length to the server while the other enables the server to signal that a given buffer has been filled with a given number of bytes.… Read more

UART flow control

Today, as I was working on implementing the different servers from my last post, I realized a problem occurring on the UART connection between the main_esp and the main_stm. As I previously discussed in that post, I had to tackle the issue of distributing the traffic on the UART data bus.

To this end, I began to write a sort of server on the ESP32. It copies the port system on an internet server. The first byte of each frame encodes the function the following data line must be transferred to. In this approach, two problems must be tackled.… Read more

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.… Read more