No announcement yet.

USART Interrupt Setup

  • Filter
  • Time
  • Show
Clear All
new posts

  • USART Interrupt Setup

    Hi all,
    I'm having difficulty setting up a USART line with the interrupt enabled. I am using the NUCLEO-F401RE development board, which uses an STM32F401RET6U ARM chip. I can use the USART line just fine when I don't set the interrupt mode, and don't set the interrupt buffers. Once either or both are set, I am unable to receive or transmit anything coherent over the rx/tx lines. Is there any sequential dependency, where a particular call order is necessary? What I have so far:

    usart6.SetIntrBuffers(tx_usart.buff, 512, rx_usart.buff, 512);
    usart6.SetReadFilter(rx_interrupt, rx_usart.pbytes);
    usart6.ControlStreamBuffering(stdout, true);

    The read filter calls my rx_interrupt function

    int rx_interrupt(unsigned char ch)
    rx_usart.buff[rx_usart.ptr++] = (int)ch;
    return rx_usart.ptr;

    Even without the rx_interrupt, however, I am unable to transmit if I set the interrupt mode. From what I understand, the putchar function is still called for the interrupt mode, unless there's something else I am supposed to set up for the transmit side? I've been operating off of the JSAPI for STM32F4xx MCU page on imagecraft (link below)

    Any insight or suggestion appreciated!

  • #2
    Hi, possibly there is a misunderstanding - when you use the interrupt driven mode, you do not need to do your own buffering or RX interrupt handling, as those are done internally by JSAPI. So once you have the above code fragment (but remove the "SetReadFilter" call), then you can use getchar/putchar/kbhit to read and write characters, as before.

    I will check the Help file to make sure that the info is clear.


    • #3
      Hi Richard, thanks for the response...
      When I call SetIntrMode(), I am unable to get any data in or out. Either I get nothing, or gibberish. Are there additional steps which go with calling SetIntrMode()?
      Also, which help file are you referring to? I was not able to find any reference to setting up the USART interrupt mode under Help>Imagecraft Help. The only information I found was at
      But the documentation makes it sound as though I should be able to use features such as SetReadFilter(). However, as soon as I enable any interrupt mode, I only get gibberish


      • #4
        jmdokter let's take this to email support. Send me your project files to and I will take a look.


        • #5
          A C++ porting error has been found and fixed in the UART interrupt mode support in JSAPI. The fix will be released in JumpStart C++ for Cortex 9.04.01 expected to be released by July 20, 2018 or so.