It is random.  So in a 50-ish byte packet I will see sequences of missing bytes 
which can be 1, 2 or event 3 bytes long missing.

For example,  I am seeing on the logic analyser the ESP sending the following 
hex bytes:

c0 01 08 04 00 07 12 20 55 00 00 00 00 c0

NuttX is seeing:

c0 01 04 20 55 00 00 c0

Regards,
Mark
—
Mark Stevens
mark.stev...@wildernesslabs.co






> On 9 May 2024, at 14:56, Nathan Hartman <hartman.nat...@gmail.com> wrote:
> 
> 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

Reply via email to