On Thu, May 9, 2024 at 3:31 AM Mark Stevens <mark.stev...@wildernesslabs.co.invalid> wrote:
> So we have a two chip board: > > * STM32 running NuttX (v7.5 I believe) > * ESP32 acting as a coprocessor running custom firmware > > The STM32 runs the show and the ESP32 provides services to the STM32 code. > > In normal run mode, NuttX has a kernel thread that reads data from the > ESP32 over UART (/dev/ttyS2) and then processes the data. This is working > fine as is. > > The UART is configured to use a 512 byte buffer. > > Every now and then we want to upload new firmware to the ESP32. This is > done by a user mode thread and it goes through the following steps: > > * Signals to the kernel thread that it should close the UART and exit. > * Opens the serial port > * Starts the programming sequence > > If we try to do this then the user mode thread misses bytes in the byte > stream. > > Kernel mode thread only: > When the system starts then this thread works fine, no bytes are lost. > > User mode thread only: > If we do not start the kernel mode thread then the programming works fine, > no bytes are lost. > > Both threads: > Starting the kernel works fine, we do not miss any bytes. The kernel > thread can be stopped, the UART is closed correctly. > > The user thread can open the serial port correctly after the kernel thread > has stopped but now it misses bytes. > > So we know the individual threads work as expected when used on their own > but not together. > > How anyone seen this or have any advice on how we can resolve the issue? > > Regards, > Mark > ______________________________ > mark.stev...@wildernesslabs.co > > > > Which bytes are missing? Are they the ones at the beginning of the message, or the end? Nathan