Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy 3.5 UART IRQ_PRIORITY

  1. #1

    Teensy 3.5 UART IRQ_PRIORITY

    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.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,827
    Quote Originally Posted by PeterG. View Post
    I've seen that all UARTs work with the same IRQ priority.
    Could that possibly explain an error like mine?
    No. Each uses its own separate buffer and variables. Even though the priorities are the same, each accesses only its memory.

    Unfortunately, I can not provide the program for inspection.
    That's unfortunate, because the problem is almost certainly a buffer overflow somewhere in your code.

    Here's one from earlier today, as an example of the sort of thing you should check in your program.

    https://forum.pjrc.com/threads/53717...l=1#post188164

  3. #3
    Thank you Paul for your quick response.
    Which at least gives me the opportunity to ignore a direction in which I thought.
    I know that it is not nice to hide the code.
    As soon as I am sure that I have found the faulty program part, I will try to make a smaller program out of it.
    The entire program would be too big anyway.

    Do you think that it would be possible that the pulse current of the SIM808 module could cause such errors?
    I checked the 5V and the 3.3V supply.
    On the 5V supply you can clearly see the pulse currents.
    The 3.3V supply behind the linear regulator is clean.

    But purely hypothetical, can such an error occur due to supply problems?

    I ask because I have already invested 3 days to make sure there is no BufferOverflow and I'm running out of ideas.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •