I'm using a PIC24FJ1024GA606 and I'm using the internal Fast RC Oscillator.
Here is my config:
// FOSCSEL #pragma config FNOSC = FRCPLL // Oscillator Source Selection (FRC with PLL module) #pragma config PLLMODE = PLL96DIV2 // PLL Mode Selection (96 MHz PLL. (8 MHz input)) #pragma config IESO = OFF // Two-speed Oscillator Start-up Enable bit (Start up with user-selected oscillator source) // FOSC #pragma config POSCMD = NONE // Primary Oscillator Mode Select bits (None) #pragma config OSCIOFCN = OFF // OSC2 Pin Function bit (OSC2 is clock output) #pragma config SOSCSEL = OFF // SOSC Power Selection Configuration bits (SOSC is not used) #pragma config PLLSS = PLL_FRC // PLL Secondary Selection Configuration bit (PLL is fed by the FRC) #pragma config IOL1WAY = ON // Peripheral pin select configuration bit (Allow many reconfigurations) #pragma config FCKSM = CSDCMD // Clock Switching Mode bits (Both Clock switching and Fail-safe Clock Monitor are disabled)
The issue I'm running into is that 115200 baud UART has a high error rate when sending data sequentially (my bootloader flashes firmware via UART at 115200 baud). From what I've read, the Internal Oscillator isn't really up to the task when it comes to low error rates for high speed UART and I need to use an external crystal.
It should be noted that if I set the baud rate to 111000, where my BRG (currently 8) has a low deviation from the baud rate, everything works fine and there are no errors.
First of all, is this diagnosis of my problem correct?
If yes, what kind of oscillator should I use so that I can effectively use 115200 baud?
If it matters: I'm also using a timer with a 1ms interrupt rate and another timer with a 1us interrupt rate. My FCY is 16,000,000.