7E1 UART2 mode problem - bad frames

Workaround: use 8n1 frame and calculate 8th (MSB) bit which will be parity bit in 7e1 - it works but if problem I mentioned above is bug in the firmware it should be fixed.

u8 addparity(u8 data) {
    u8 parity = 0x00;
    u8 tmp = data;
    tmp &= 0x7F;
    
    while (tmp) {
        parity = ~parity;
        tmp = tmp & (tmp - 1);
    }
    
parity &= 0x80;
return (data & 0x7F) | parity;

}

Still I need fix this problem due to program speed reason.