0
\$\begingroup\$

I am designing an RS-485 interface with STM32F0xx series MCU.

The scheme uses USART RX interrupt.

I am wondering, if I set up the baud rate as certain value(for example, 9600), is there possibility that the interrupt fire more often than every one character time due to noise or some other disturbance in the RS-485 interface?

I am worried that if above happen, it might lock up the MCU and prevent it from doing other tasks.

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

The timing for the interrupt comes from the local clock so although interference could cause the data to be garbled it can't cause an interrupt more frequently than once for every 9 or 10 bits (depending upon whether you have it set for 1 or 2 stop bits - assuming 8 bit characters).

The start bit triggers the beginning of the counter that will end with an interrupt.

\$\endgroup\$
2
  • \$\begingroup\$ That would be 10 or 11 bit periods between interrupts, you would include the start bit in the calculation. The first interrupt can occur 9.5 bit periods after the first start bit edge is detected and then every 10 bit periods thereafter assuming continuous data. The UART part will prevent more frequent interrupts but may also generate spurious ones if there is lots of noise and no data but not more frequently as it samples all the bits. \$\endgroup\$
    – KalleMP
    Commented Sep 10, 2015 at 6:00
  • 1
    \$\begingroup\$ Very true - I forgot about the start bit. \$\endgroup\$ Commented Sep 10, 2015 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.