I finally found why I never succeeded to get the right baudrate when using the usart library.
When you want to use SPBRG and SPBGRH for baudrate generation, you have to set TXSTAbits.BRGH but you have also to set BAUDCONbits.BRG16.
Here is a patch that fixes the bug for pic18f4550.
I don't know if all MCU that brings TXSTAbits.BRGH bring also BAUDCONbits.BRG16.
Log in to post a comment.