Hello,

I have a problem with my software which has strange non-reproducible errors.
It looks like some static variables are being overwritten by some part of the program.
The variable holds the correct value over the complete duration until the error occurs.
The errors usually occur within 10min - 24h.
The only function that can change the value of the variable is not called at any time.

For 3 days I try to reproduce the error unsuccessfully.

I simulate the critical program parts at the moment with 5000 times speed.

In order to be able to simulate at this speed I had to deactivate a function.
This function sent a data string with a length of about 500byte to Serial6.
The program seems to be stable with deactivated function and 5000 times speed.

Serial6 is connected to a SIM808 radio module and has a baud rate of 460800, Flow Control disabled.

A total of 3 serial ports are running.

Serial1 baud rate 500000
Serial2 baud rate 625000
Serial6 baud rate 460800

I adjusted the buffer size as follows.


#ifndef SERIAL6_TX_BUFFER_SIZE
#define SERIAL6_TX_BUFFER_SIZE 2056 // number of outgoing bytes to buffer
#endif
#ifndef SERIAL6_RX_BUFFER_SIZE
#define SERIAL6_RX_BUFFER_SIZE 2056 // number of incoming bytes to buffer
#endif
#define RTS_HIGH_WATERMARK (SERIAL6_RX_BUFFER_SIZE-24) // RTS requests sender to pause
#define RTS_LOW_WATERMARK (SERIAL6_RX_BUFFER_SIZE-38) // RTS allows sender to resume
#define IRQ_PRIORITY 64 // 0 = highest priority, 255 = lowest

#ifndef SERIAL2_TX_BUFFER_SIZE
#define SERIAL2_TX_BUFFER_SIZE 128 // number of outgoing bytes to buffer
#endif
#ifndef SERIAL2_RX_BUFFER_SIZE
#define SERIAL2_RX_BUFFER_SIZE 128 // number of incoming bytes to buffer
#endif
#define RTS_HIGH_WATERMARK (SERIAL2_RX_BUFFER_SIZE-24) // RTS requests sender to pause
#define RTS_LOW_WATERMARK (SERIAL2_RX_BUFFER_SIZE-38) // RTS allows sender to resume
#define IRQ_PRIORITY 64 // 0 = highest priority, 255 = lowest
#ifndef SERIAL1_TX_BUFFER_SIZE
#define SERIAL1_TX_BUFFER_SIZE 256 // number of outgoing bytes to buffer
#endif
#ifndef SERIAL1_RX_BUFFER_SIZE
#define SERIAL1_RX_BUFFER_SIZE 1024 // number of incoming bytes to buffer
#endif
#define RTS_HIGH_WATERMARK (SERIAL1_RX_BUFFER_SIZE-24) // RTS requests sender to pause
#define RTS_LOW_WATERMARK (SERIAL1_RX_BUFFER_SIZE-38) // RTS allows sender to resume
#define IRQ_PRIORITY 64 // 0 = highest priority, 255 = lowest
Would it be possible for the above error to occur when multiple serial ports are being claimed at the same time at this relatively high baud rate?
I've seen that all UARTs work with the same IRQ priority.
Could that possibly explain an error like mine?

Unfortunately, I can not provide the program for inspection.

Thanks to everyone who takes the time to read this.