Forum Discussion

Patrik78's avatar
Patrik78
Icon for New Contributor rankNew Contributor
3 years ago

UART 16550 IP - Stick parity problem

Hello,

in my company we're facing a problem while using UART 16550 IP in stick parity mode: on LSR register we set SP=1, EPS=1, PEN=1 in order to use MARK_PARITY.

While in transmission everything works as expected, in receiving data the UART behave as in LSR register the SP bit is not set.

So, it works as mark parity in Tx, and parity even in Rx.

Any suggestions? Is this a correct behaviour for the IP?

We're using Quartus 18.1.

17 Replies

  • ShengN_altera's avatar
    ShengN_altera
    Icon for Super Contributor rankSuper Contributor

    Hi @Patrik78 ,

    Seems like there's no problem with the data package and LCR. Then it's better to issue a Break Interrupt (bi) between the received data packages by holding serial input, sin, in a logic '0' state for longer than the sum of start time + data bits + parity + stop bits and after that logic '1'. Because as mentioned in document that the Parity Error (PE) bit (LSR[2]) will be set if a break interrupt has occurred, as indicated by Break Interrupt (BI) bit (LSR[4]).

    Let me know if you have any further update.

    Thanks,

    Best regards,

    Sheng

    p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.

  • Patrik78's avatar
    Patrik78
    Icon for New Contributor rankNew Contributor

    Hello Sheng,

    we can't use break signal in our application, so we're forced to make the parity check work without the use of break.

    Could you check other reasons why the PE is set receiving 0x55 with '0' as parity bit, and not set when receiving 0x57 with '0' as parity bit , assuming receiver is set to check parity MARK?

  • ShengN_altera's avatar
    ShengN_altera
    Icon for Super Contributor rankSuper Contributor

    Hi @Patrik78 ,

    [Edited]

    Seems like the result shows that you're using 'odd parity' for parity selection. Have you using the correct LCR?

    Thanks,

    Best regards,

    Sheng

    • ctavoni's avatar
      ctavoni
      Icon for New Contributor rankNew Contributor

      Hello Sheng,

      sorry but I can not understand why is so difficult to have a clear answer on 16550 IP.

      We want to know if the Stick Parity function implemented in the 16550 IP works as the Mark-Space parity in other standard Uarts.

      In practice Sticky Parity is simply when the parity bit is always transmitted and checked as a '1' or '0' independently from other the data bits or other UART functionalities

      Do it works on 16550 IP?

      Best regards

      Claudio

  • ShengN_altera's avatar
    ShengN_altera
    Icon for Super Contributor rankSuper Contributor

    Hi @Patrik78 ,

    Thanks for all the details provided. Let me further consult opinion from internal engineering team and get back to you soon.

    Thanks,

    Best Regards,

    Sheng

  • ShengN_altera's avatar
    ShengN_altera
    Icon for Super Contributor rankSuper Contributor

    Hi @Patrik78 ,

    Expert feedback:

    Example flow for data transmitted (assuming stick parity not enabled):

    Data

    Even Parity (Tx)

    Even Parity (Rx)

    0x55

    0101 0101 + 0 (check bit ‘0;’ because even par)

    0101 0101 + 0 (checked bit ‘0’)

    0x57

    01010111 + 1 (check bit ‘1;’ because even par)

    01010111 + 1 (checked bit ‘1’)

    Data

    Odd Parity (Tx)

    Odd Parity (Rx)

    0x55

    01010101 + 1 (plus bit ‘1;’ because odd par)

    01010101 + 1 (checked bit ‘1’)

    0x57

    01010111 + 0 (plus bit ‘0;’ because odd par)

    01010111 + 0 (checked bit ‘0’)

    (Since Stick parity is enable, parity does not depend on data):

    Data

    Even Parity (Tx) (SP=1, EPS=1, PEN=1)

    Odd Parity (Rx) (SP=1, EPS=0, PEN=1)

    Error

    0x55

    01010101 + 0 (plus bit ‘0;’ because even par)

    01010101 + 0 (checked bit ‘0’)

    Should get an error because Rx data is even parity

    0x57

    01010111 + 0 (plus bit ‘0;’ because even par with stick par)

    01010111 + 0 (check bit ‘1;’ because even par)

    Should not get an error because Rx data is odd parity

    ***The receiver side it will only check, the parity bit addition will be at the transmitter side only.

    Both transmitting and receiving UARTs recommended to be configured same parity, either even or odd.

    Recommended not to use the Stick Parity to 1, since the parity bits will be set, it will not be dependent on the data transmitted.

    Thanks,

    Best regards,

    Sheng

    p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.