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

Thread: Change interrupt priority Teensy 4.0

  1. #1

    Change interrupt priority Teensy 4.0

    hi

    I work with a Teensy 4.0 and I tried to change the interrupt priority and it does not work, it always keeps the same priority.

    in void setup()
    NVIC_SET_PRIORITY(IRQ_LPUART3, 157);

    after I read to see if it change

    in void loop()
    serial.print(IRQ_LPUART3);

    and it stay at is priority like 22 for LPUART3

    what a do wrong.

    Thank

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,522
    The default T4 UART priority when using the TeensyDuino code is set with :: #define IRQ_PRIORITY 64 // 0 = highest priority, 255 = lowest

    If using that PJRC cores codebase it should read that when tested after .begin(), and would have to be changed after .begin. That priority could be changed in the local source file for Serial4.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,827
    Defragster is right, you need to make the change after Serial4.begin().

    But you have another error, with this:


    Quote Originally Posted by Ian Larouche View Post
    serial.print(IRQ_LPUART3);
    You need to use this:

    serial.print(NVIC_GET_PRIORITY(IRQ_LPUART3));

    Using only IRQ_LPUART3 will print which interrupt number the serial port uses, not it's priority setting.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,522
    Quote Originally Posted by PaulStoffregen View Post
    ...You need to use this:

    serial.print(NVIC_GET_PRIORITY(IRQ_LPUART3));

    Using only IRQ_LPUART3 will print which interrupt number the serial port uses, not it's priority setting.
    Good catch Paul - I meant to get back to that thought maybe code was missing, and why I noted it should show 64 before change … of course the value of IRQ_LPUART3==22

Posting Permissions

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